vector, relative slope distance and relative azimuth + distance modes, spaghetti

This commit is contained in:
commy2 2015-01-16 01:48:43 +01:00
parent 577e6c9672
commit addc7feb40
16 changed files with 204 additions and 305 deletions

View File

@ -11,24 +11,25 @@ PREP(tabDistanceKey);
PREP(clearDisplay); PREP(clearDisplay);
PREP(convertToTexturesDegree); PREP(convertToTexturesDegree);
PREP(convertToTexturesDistance); PREP(convertToTexturesDistance);
PREP(showCenter);
PREP(showP1);
PREP(onKeyDown);
PREP(onKeyHold);
PREP(onKeyUp);
PREP(getDirection); PREP(getDirection);
PREP(getDistance); PREP(getDistance);
PREP(getHeightDistance); PREP(getHeightDistance);
PREP(getRelativeAzimuthDistance); PREP(getRelativeAzimuthDistance);
PREP(getRelativeDistance);
PREP(onKeyDown);
PREP(onKeyHold);
PREP(onKeyUp);
PREP(showAzimuth); PREP(showAzimuth);
PREP(showAzimuthInclination); PREP(showAzimuthInclination);
PREP(showHeightDistance); PREP(showHeightDistance);
PREP(showDistance); PREP(showDistance);
PREP(showRelativeAzimuthDistance); PREP(showRelativeAzimuthDistance);
PREP(showRelativeDistance);
PREP(showCenter);
PREP(showP1);
GVAR(holdKeyHandler) = -1; GVAR(holdKeyHandler) = -1;
GVAR(isKeyDownAzimuth) = false; GVAR(isKeyDownAzimuth) = false;

View File

@ -10,7 +10,7 @@ _azimuth = _direction select 0;
_inclination = _direction select 1; _inclination = _direction select 1;
if (_distance < -999) exitWith { if (_distance < -999) exitWith {
[-1000,-1000] // return [-1000, -1000] // return
}; };
[sin _inclination * _distance, cos _inclination * _distance] [sin _inclination * _distance, cos _inclination * _distance]

View File

@ -1,53 +1,32 @@
// by commy2 // by commy2
#include "script_component.hpp" #include "script_component.hpp"
_distanceP1 = call AGM_Vector_fnc_getDistance; private ["_distanceP1", "_directionP1", "_azimuthP1", "_inclinationP1", "_distanceP2", "_directionP2", "_azimuthP2", "_inclinationP2"];
_directionP1 = call AGM_Vector_fnc_getDirection;
_distanceP1 = GVAR(pData) select 0;
_directionP1 = GVAR(pData) select 1;
_azimuthP1 = _directionP1 select 0; _azimuthP1 = _directionP1 select 0;
_inclinationP1 = _directionP1 select 1; _inclinationP1 = _directionP1 select 1;
_ctrlDigitE1 ctrlSetText "\AGM_Vector\rsc\d1.paa"; _distanceP2 = call FUNC(getDistance);
_ctrlDigitE2 ctrlSetText "\AGM_Vector\rsc\d-.paa"; _directionP2 = call FUNC(getDirection);
_ctrlDigitE3 ctrlSetText "\AGM_Vector\rsc\dP.paa";
waitUntil {!(AGM_vectorKey select 0)};
_distanceP2 = call AGM_Vector_fnc_getDistance;
_directionP2 = call AGM_Vector_fnc_getDirection;
_azimuthP2 = _directionP2 select 0; _azimuthP2 = _directionP2 select 0;
_inclinationP2 = _directionP2 select 1; _inclinationP2 = _directionP2 select 1;
_relDirection = sqrt ((_azimuthP1 - _azimuthP2)^2 + (_inclinationP1 - _inclinationP2)^2); private ["_relDirection", "_relDistance", "_relHeight", "_relLength", "_lenghtP1", "_lenghtP2", "_relAzimuth"];
_relDistance = sqrt (_distanceP1^2 + _distanceP2^2 - 2 * _distanceP1 * _distanceP2 * cos _relDirection);
_relDirection = sqrt ((_azimuthP1 - _azimuthP2) ^ 2 + (_inclinationP1 - _inclinationP2) ^ 2);
_relDistance = sqrt (_distanceP1 ^ 2 + _distanceP2 ^ 2 - 2 * _distanceP1 * _distanceP2 * cos _relDirection);
_relHeight = (sin _inclinationP1 * _distanceP1) - (sin _inclinationP2 * _distanceP2); _relHeight = (sin _inclinationP1 * _distanceP1) - (sin _inclinationP2 * _distanceP2);
_relLenght = sqrt (_relDistance^2 - _relHeight^2); if (str(_relLenght) == "-1.#IND") then {_relLenght = 0}; _relLength = sqrt (_relDistance ^ 2 - _relHeight ^ 2); if (str(_relLength) == "-1.#IND") then {_relLength = 0};
_lenghtP1 = cos _inclinationP1 * _distanceP1; _lenghtP1 = cos _inclinationP1 * _distanceP1;
_lenghtP2 = cos _inclinationP2 * _distanceP2; _lenghtP2 = cos _inclinationP2 * _distanceP2;
_relAzimuth = (sin _azimuthP2 * _lenghtP2 - sin _azimuthP1 * _lenghtP1) atan2 (cos _azimuthP2 * _lenghtP2 - cos _azimuthP1 * _lenghtP1); _relAzimuth = (sin _azimuthP2 * _lenghtP2 - sin _azimuthP1 * _lenghtP1) atan2 (cos _azimuthP2 * _lenghtP2 - cos _azimuthP1 * _lenghtP1);
if (_relAzimuth < 0) then {_relAzimuth = _relAzimuth + 360}; if (_relAzimuth < 0) then {_relAzimuth = _relAzimuth + 360};
if (_distanceP1 == -9999 || {_distanceP2 == -9999}) then { if (_distanceP1 < -999 || {_distanceP2 < -999}) exitWith {
_relDistance = -9999; [-1000, -1000] // return
_relAzimuth = -9999;
}; };
_digits = _relLenght call AGM_Vector_fnc_convertDistance; [_relAzimuth, _relLength]
_ctrlDigit1 ctrlSetText (_digits select 0);
_ctrlDigit2 ctrlSetText (_digits select 1);
_ctrlDigit3 ctrlSetText (_digits select 2);
_ctrlDigit4 ctrlSetText (_digits select 3);
_digits = _relAzimuth call AGM_Vector_fnc_convertDegree;
_ctrlDigit5 ctrlSetText (_digits select 0);
_ctrlDigit6 ctrlSetText (_digits select 1);
_ctrlDigit7 ctrlSetText (_digits select 2);
_ctrlDigit8 ctrlSetText (_digits select 3);
_ctrlVectorCenter ctrlShow false;
_ctrlDigitE1 ctrlShow false;
_ctrlDigitE2 ctrlShow false;
_ctrlDigitE3 ctrlShow false;
AGM_isVectorReady = true;

View File

@ -0,0 +1,25 @@
// by commy2
#include "script_component.hpp"
private ["_distanceP1", "_directionP1", "_azimuthP1", "_inclinationP1", "_distanceP2", "_directionP2", "_azimuthP2", "_inclinationP2"];
_distanceP1 = GVAR(pData) select 0;
_directionP1 = GVAR(pData) select 1;
_azimuthP1 = _directionP1 select 0;
_inclinationP1 = _directionP1 select 1;
_distanceP2 = call FUNC(getDistance);
_directionP2 = call FUNC(getDirection);
_azimuthP2 = _directionP2 select 0;
_inclinationP2 = _directionP2 select 1;
private ["_relDirection", "_relDistance"];
_relDirection = sqrt ((_azimuthP1 - _azimuthP2) ^ 2 + (_inclinationP1 - _inclinationP2) ^ 2);
_relDistance = sqrt (_distanceP1 ^ 2 + _distanceP2 ^ 2 - 2 * _distanceP1 * _distanceP2 * cos _relDirection);
if (_distanceP1 < -999 || {_distanceP2 < -999}) exitWith {
-1000 // return
};
_relDistance

View File

@ -1,72 +0,0 @@
// by commy2
#include "script_component.hpp"
private["_dlgVector", "_ctrlVectorCenter", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8", "_ctrlDigitE1", "_ctrlDigitE2", "_ctrlDigitE3", "_distanceP1", "_directionP1", "_azimuthP1", "_inclinationP1", "_directionP2", "_azimuthP2", "_distanceP2", "_inclinationP2", "_digits", "_relDirection", "_relDistance", "_relHeight", "_relLenght", "_digits0", "_digits1", "_digits2", "_lenghtP1", "_lenghtP2", "_relAzimuth"];
disableSerialization;
_dlgVector = uiNamespace getVariable "AGM_dlgVector";
_ctrlVectorCenter = _dlgVector displayCtrl 1;
_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;
_ctrlDigitE1 = _dlgVector displayCtrl 21;
_ctrlDigitE2 = _dlgVector displayCtrl 22;
_ctrlDigitE3 = _dlgVector displayCtrl 23;
_ctrlVectorCenter ctrlSetText "\AGM_Vector\rsc\Vector_Center.paa";
_distanceP1 = call AGM_Vector_fnc_getDistance;
_directionP1 = call AGM_Vector_fnc_getDirection;
_azimuthP1 = _directionP1 select 0;
_inclinationP1 = _directionP1 select 1;
_ctrlDigitE1 ctrlSetText "\AGM_Vector\rsc\d1.paa";
_ctrlDigitE2 ctrlSetText "\AGM_Vector\rsc\d-.paa";
_ctrlDigitE3 ctrlSetText "\AGM_Vector\rsc\dP.paa";
waitUntil {!(AGM_vectorKey select 0)};
_distanceP2 = call AGM_Vector_fnc_getDistance;
_directionP2 = call AGM_Vector_fnc_getDirection;
_azimuthP2 = _directionP2 select 0;
_inclinationP2 = _directionP2 select 1;
_relDirection = sqrt ((_azimuthP1 - _azimuthP2)^2 + (_inclinationP1 - _inclinationP2)^2);
_relDistance = sqrt (_distanceP1^2 + _distanceP2^2 - 2 * _distanceP1 * _distanceP2 * cos _relDirection);
_relHeight = (sin _inclinationP1 * _distanceP1) - (sin _inclinationP2 * _distanceP2);
_relLenght = sqrt (_relDistance^2 - _relHeight^2); if (str(_relLenght) == "-1.#IND") then {_relLenght = 0};
_lenghtP1 = cos _inclinationP1 * _distanceP1;
_lenghtP2 = cos _inclinationP2 * _distanceP2;
_relAzimuth = (sin _azimuthP2 * _lenghtP2 - sin _azimuthP1 * _lenghtP1) atan2 (cos _azimuthP2 * _lenghtP2 - cos _azimuthP1 * _lenghtP1);
if (_relAzimuth < 0) then {_relAzimuth = _relAzimuth + 360};
if (_distanceP1 == -9999 || {_distanceP2 == -9999}) then {
_relDistance = -9999;
_relAzimuth = -9999;
};
_digits = _relLenght call AGM_Vector_fnc_convertDistance;
_ctrlDigit1 ctrlSetText (_digits select 0);
_ctrlDigit2 ctrlSetText (_digits select 1);
_ctrlDigit3 ctrlSetText (_digits select 2);
_ctrlDigit4 ctrlSetText (_digits select 3);
_digits = _relAzimuth call AGM_Vector_fnc_convertDegree;
_ctrlDigit5 ctrlSetText (_digits select 0);
_ctrlDigit6 ctrlSetText (_digits select 1);
_ctrlDigit7 ctrlSetText (_digits select 2);
_ctrlDigit8 ctrlSetText (_digits select 3);
_ctrlVectorCenter ctrlShow false;
_ctrlDigitE1 ctrlShow false;
_ctrlDigitE2 ctrlShow false;
_ctrlDigitE3 ctrlShow false;
AGM_isVectorReady = true;

View File

@ -1,58 +0,0 @@
// by commy2
#include "script_component.hpp"
private["_dlgVector", "_ctrlVectorCenter", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8", "_ctrlDigitE1", "_ctrlDigitE2", "_ctrlDigitE3", "_distanceP1", "_directionP1", "_azimuthP1", "_inclinationP1", "_directionP2", "_azimuthP2", "_distanceP2", "_inclinationP2", "_relDirection", "_relDistance", "_distance", "_digits"];
disableSerialization;
_dlgVector = uiNamespace getVariable "AGM_dlgVector";
_ctrlVectorCenter = _dlgVector displayCtrl 1;
_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;
_ctrlDigitE1 = _dlgVector displayCtrl 21;
_ctrlDigitE2 = _dlgVector displayCtrl 22;
_ctrlDigitE3 = _dlgVector displayCtrl 23;
_ctrlVectorCenter ctrlSetText "\AGM_Vector\rsc\Vector_Center.paa";
_distanceP1 = call AGM_Vector_fnc_getDistance;
_directionP1 = call AGM_Vector_fnc_getDirection;
_azimuthP1 = _directionP1 select 0;
_inclinationP1 = _directionP1 select 1;
_ctrlDigitE1 ctrlSetText "\AGM_Vector\rsc\d1.paa";
_ctrlDigitE2 ctrlSetText "\AGM_Vector\rsc\d-.paa";
_ctrlDigitE3 ctrlSetText "\AGM_Vector\rsc\dP.paa";
waitUntil {!(AGM_vectorKey select 1)};
_distanceP2 = call AGM_Vector_fnc_getDistance;
_directionP2 = call AGM_Vector_fnc_getDirection;
_azimuthP2 = _directionP2 select 0;
_inclinationP2 = _directionP2 select 1;
_relDirection = sqrt ((_azimuthP1 - _azimuthP2)^2 + (_inclinationP1 - _inclinationP2)^2);
_relDistance = sqrt (_distanceP1^2 + _distanceP2^2 - 2 * _distanceP1 * _distanceP2 * cos _relDirection);
if (_distanceP1 == -9999 || {_distanceP2 == -9999}) then {
_relDistance = -9999;
};
_digits = _relDistance call AGM_Vector_fnc_convertDistance;
_ctrlDigit1 ctrlSetText (_digits select 0);
_ctrlDigit2 ctrlSetText (_digits select 1);
_ctrlDigit3 ctrlSetText (_digits select 2);
_ctrlDigit4 ctrlSetText (_digits select 3);
_ctrlVectorCenter ctrlShow false;
_ctrlDigitE1 ctrlShow false;
_ctrlDigitE2 ctrlShow false;
_ctrlDigitE3 ctrlShow false;
AGM_isVectorReady = true;

View File

@ -14,15 +14,19 @@ _fnc_setPFH = {
GVAR(holdKeyHandler) = -1; GVAR(holdKeyHandler) = -1;
}; };
GVAR(currentMode) = _this;//
GVAR(holdKeyHandler) = [FUNC(onKeyHold), 0, _this] call CBA_fnc_addPerFrameHandler; GVAR(holdKeyHandler) = [FUNC(onKeyHold), 0, _this] call CBA_fnc_addPerFrameHandler;
}; };
switch (_this select 0) do { switch (_this select 0) do {
case ("azimuth"): { case ("azimuth"): {
if (GETGVAR(isKeyDownDistance,false) && {GETGVAR(currentMode,"") in ["relative_distance"]}) exitWith {};
["azimuth"] call FUNC(clearDisplay); ["azimuth"] call FUNC(clearDisplay);
GVAR(isKeyDownAzimuth) = true; GVAR(isKeyDownAzimuth) = true;
[false] call FUNC(showP1);
if (diag_tickTime < GVAR(keyDownTimeAzimuth) + 0.5) exitWith { if (diag_tickTime < GVAR(keyDownTimeAzimuth) + 0.5) exitWith {
"azimuth+inclination" call _fnc_setPFH; "azimuth+inclination" call _fnc_setPFH;
@ -31,12 +35,10 @@ switch (_this select 0) do {
GVAR(keyDownTimeAzimuth) = diag_tickTime; GVAR(keyDownTimeAzimuth) = diag_tickTime;
if (diag_tickTime > GVAR(keyDownTimeDistance) + 0.5) then { if (diag_tickTime > GVAR(keyDownTimeDistance) + 0.5) then {
if (GETGVAR(isKeyDownDistance,false)) exitWith { if !(GETGVAR(isKeyDownDistance,false)) then {
hint "P1 relative distance mode"; ["distance"] call FUNC(clearDisplay);
"azimuth" call _fnc_setPFH;
}; };
["distance"] call FUNC(clearDisplay);
"azimuth" call _fnc_setPFH;
} else { } else {
"azimuth+distance" call _fnc_setPFH; "azimuth+distance" call _fnc_setPFH;
}; };
@ -45,9 +47,12 @@ switch (_this select 0) do {
case ("distance"): { case ("distance"): {
if (GETGVAR(isKeyDownAzimuth,false) && {GETGVAR(currentMode,"") in ["relative_azimuth+distance"]}) exitWith {};
["distance"] call FUNC(clearDisplay); ["distance"] call FUNC(clearDisplay);
GVAR(isKeyDownDistance) = true; GVAR(isKeyDownDistance) = true;
[false] call FUNC(showP1);
if (diag_tickTime < GVAR(keyDownTimeDistance) + 0.5) exitWith { if (diag_tickTime < GVAR(keyDownTimeDistance) + 0.5) exitWith {
"height+distance" call _fnc_setPFH; "height+distance" call _fnc_setPFH;
@ -56,12 +61,10 @@ switch (_this select 0) do {
GVAR(keyDownTimeDistance) = diag_tickTime; GVAR(keyDownTimeDistance) = diag_tickTime;
if (diag_tickTime > GVAR(keyDownTimeAzimuth) + 0.5) then { if (diag_tickTime > GVAR(keyDownTimeAzimuth) + 0.5) then {
if (GETGVAR(isKeyDownAzimuth,false)) exitWith { if !(GETGVAR(isKeyDownAzimuth,false)) then {
hint "P1 relative azimuth + non-slope distance mode"; ["azimuth"] call FUNC(clearDisplay);
"distance" call _fnc_setPFH;
}; };
["azimuth"] call FUNC(clearDisplay);
"distance" call _fnc_setPFH;
} else { } else {
"azimuth+distance" call _fnc_setPFH; "azimuth+distance" call _fnc_setPFH;
}; };

View File

@ -56,8 +56,10 @@ switch (_this select 0) do {
[_isReady] call FUNC(showCenter); [_isReady] call FUNC(showCenter);
if (!GVAR(isKeyDownAzimuth) && {!GVAR(isKeyDownDistance)}) then { if (!GVAR(isKeyDownAzimuth) && {!GVAR(isKeyDownDistance)}) then {
call FUNC(showDistance); if (_isReady) then {
[false] call FUNC(showCenter); call FUNC(showDistance);
[false] call FUNC(showCenter);
};
[_this select 1] call CBA_fnc_removePerFrameHandler; [_this select 1] call CBA_fnc_removePerFrameHandler;
@ -106,6 +108,52 @@ switch (_this select 0) do {
}; };
case ("relative_distance"): {
private "_isReady";
_isReady = diag_tickTime > GVAR(keyDownTimeAzimuth) + 0.5;
[_isReady] call FUNC(showCenter);
if (!GVAR(isKeyDownAzimuth) && {!GVAR(isKeyDownDistance)}) then {
if (_isReady) then {
call FUNC(showRelativeDistance);
};
[false] call FUNC(showCenter);
[false] call FUNC(showP1);
[_this select 1] call CBA_fnc_removePerFrameHandler;
if (GVAR(holdKeyHandler) > -1) then {
GVAR(holdKeyHandler) = -1;
};
};
};
case ("relative_azimuth+distance"): {
private "_isReady";
_isReady = diag_tickTime > GVAR(keyDownTimeDistance) + 0.5;
[_isReady] call FUNC(showCenter);
if (!GVAR(isKeyDownAzimuth) && {!GVAR(isKeyDownDistance)}) then {
if (_isReady) then {
call FUNC(showRelativeAzimuthDistance);
};
[false] call FUNC(showCenter);
[false] call FUNC(showP1);
[_this select 1] call CBA_fnc_removePerFrameHandler;
if (GVAR(holdKeyHandler) > -1) then {
GVAR(holdKeyHandler) = -1;
};
};
};
}; };
systemChat str (_this select 0);// systemChat str (_this select 0);//

View File

@ -7,16 +7,45 @@ Handles releasing the special vector keys.
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private "_fnc_setPFH";
_fnc_setPFH = {
if (GVAR(holdKeyHandler) > -1) then {
[GVAR(holdKeyHandler)] call CBA_fnc_removePerFrameHandler;
GVAR(holdKeyHandler) = -1;
};
GVAR(currentMode) = _this;//
GVAR(holdKeyHandler) = [FUNC(onKeyHold), 0, _this] call CBA_fnc_addPerFrameHandler;
};
switch (_this select 0) do { switch (_this select 0) do {
case ("azimuth"): { case ("azimuth"): {
GVAR(isKeyDownAzimuth) = false; GVAR(isKeyDownAzimuth) = false;
if (GVAR(isKeyDownDistance)) then {
if (GVAR(currentMode) == "distance") then {
["azimuth"] call FUNC(clearDisplay);
[true] call FUNC(showP1);
GVAR(pData) = [call FUNC(getDistance), call FUNC(getDirection)];
"relative_distance" call _fnc_setPFH;
};
};
}; };
case ("distance"): { case ("distance"): {
GVAR(isKeyDownDistance) = false; GVAR(isKeyDownDistance) = false;
if (GVAR(isKeyDownAzimuth)) then {
if (GVAR(currentMode) == "azimuth") then {
["distance"] call FUNC(clearDisplay);
[true] call FUNC(showP1);
GVAR(pData) = [call FUNC(getDistance), call FUNC(getDirection)];
"relative_azimuth+distance" call _fnc_setPFH;
};
};
}; };
}; };

View File

@ -1,23 +1,18 @@
// by commy2 // by commy2
#include "script_component.hpp" #include "script_component.hpp"
private ["_dlgVector", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8"]; private "_dlgVector";
disableSerialization; disableSerialization;
_dlgVector = GETUVAR(ACE_dlgVector,displayNull); _dlgVector = GETUVAR(ACE_dlgVector,displayNull);
_ctrlDigit5 = _dlgVector displayCtrl 1315;
_ctrlDigit6 = _dlgVector displayCtrl 1316;
_ctrlDigit7 = _dlgVector displayCtrl 1317;
_ctrlDigit8 = _dlgVector displayCtrl 1318;
private ["_direction", "_digits"]; private ["_direction", "_digits"];
_direction = call FUNC(getDirection); _direction = call FUNC(getDirection);
_digits = _direction call FUNC(convertToTexturesDegree); _digits = _direction call FUNC(convertToTexturesDegree);
_ctrlDigit5 ctrlSetText (_digits select 0); (_dlgVector displayCtrl 1315) ctrlSetText (_digits select 0);
_ctrlDigit6 ctrlSetText (_digits select 1); (_dlgVector displayCtrl 1316) ctrlSetText (_digits select 1);
_ctrlDigit7 ctrlSetText (_digits select 2); (_dlgVector displayCtrl 1317) ctrlSetText (_digits select 2);
_ctrlDigit8 ctrlSetText (_digits select 3); (_dlgVector displayCtrl 1318) ctrlSetText (_digits select 3);

View File

@ -1,20 +1,11 @@
// by commy2 // by commy2
#include "script_component.hpp" #include "script_component.hpp"
private ["_dlgVector", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8"]; private "_dlgVector";
disableSerialization; disableSerialization;
_dlgVector = GETUVAR(ACE_dlgVector,displayNull); _dlgVector = GETUVAR(ACE_dlgVector,displayNull);
_ctrlDigit1 = _dlgVector displayCtrl 1311;
_ctrlDigit2 = _dlgVector displayCtrl 1312;
_ctrlDigit3 = _dlgVector displayCtrl 1313;
_ctrlDigit4 = _dlgVector displayCtrl 1314;
_ctrlDigit5 = _dlgVector displayCtrl 1315;
_ctrlDigit6 = _dlgVector displayCtrl 1316;
_ctrlDigit7 = _dlgVector displayCtrl 1317;
_ctrlDigit8 = _dlgVector displayCtrl 1318;
private ["_direction", "_digits"]; private ["_direction", "_digits"];
_direction = call FUNC(getDirection); _direction = call FUNC(getDirection);
@ -22,15 +13,15 @@ _direction = call FUNC(getDirection);
// azimuth // azimuth
_digits = [_direction select 0] call FUNC(convertToTexturesDegree); _digits = [_direction select 0] call FUNC(convertToTexturesDegree);
_ctrlDigit5 ctrlSetText (_digits select 0); (_dlgVector displayCtrl 1315) ctrlSetText (_digits select 0);
_ctrlDigit6 ctrlSetText (_digits select 1); (_dlgVector displayCtrl 1316) ctrlSetText (_digits select 1);
_ctrlDigit7 ctrlSetText (_digits select 2); (_dlgVector displayCtrl 1317) ctrlSetText (_digits select 2);
_ctrlDigit8 ctrlSetText (_digits select 3); (_dlgVector displayCtrl 1318) ctrlSetText (_digits select 3);
// inclination // inclination
_digits = [_direction select 1] call FUNC(convertToTexturesDegree); _digits = [_direction select 1] call FUNC(convertToTexturesDegree);
_ctrlDigit1 ctrlSetText (_digits select 0); (_dlgVector displayCtrl 1311) ctrlSetText (_digits select 0);
_ctrlDigit2 ctrlSetText (_digits select 1); (_dlgVector displayCtrl 1312) ctrlSetText (_digits select 1);
_ctrlDigit3 ctrlSetText (_digits select 2); (_dlgVector displayCtrl 1313) ctrlSetText (_digits select 2);
_ctrlDigit4 ctrlSetText (_digits select 3); (_dlgVector displayCtrl 1314) ctrlSetText (_digits select 3);

View File

@ -1,23 +1,18 @@
// by commy2 // by commy2
#include "script_component.hpp" #include "script_component.hpp"
private ["_dlgVector", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4"]; private "_dlgVector";
disableSerialization; disableSerialization;
_dlgVector = GETUVAR(ACE_dlgVector,displayNull); _dlgVector = GETUVAR(ACE_dlgVector,displayNull);
_ctrlDigit1 = _dlgVector displayCtrl 1311;
_ctrlDigit2 = _dlgVector displayCtrl 1312;
_ctrlDigit3 = _dlgVector displayCtrl 1313;
_ctrlDigit4 = _dlgVector displayCtrl 1314;
private ["_distance", "_digits"]; private ["_distance", "_digits"];
_distance = call FUNC(getDistance); _distance = call FUNC(getDistance);
_digits = [_distance] call FUNC(convertToTexturesDistance); _digits = [_distance] call FUNC(convertToTexturesDistance);
_ctrlDigit1 ctrlSetText (_digits select 0); (_dlgVector displayCtrl 1311) ctrlSetText (_digits select 0);
_ctrlDigit2 ctrlSetText (_digits select 1); (_dlgVector displayCtrl 1312) ctrlSetText (_digits select 1);
_ctrlDigit3 ctrlSetText (_digits select 2); (_dlgVector displayCtrl 1313) ctrlSetText (_digits select 2);
_ctrlDigit4 ctrlSetText (_digits select 3); (_dlgVector displayCtrl 1314) ctrlSetText (_digits select 3);

View File

@ -1,20 +1,11 @@
// by commy2 // by commy2
#include "script_component.hpp" #include "script_component.hpp"
private ["_dlgVector", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8"]; private "_dlgVector";
disableSerialization; disableSerialization;
_dlgVector = GETUVAR(ACE_dlgVector,displayNull); _dlgVector = GETUVAR(ACE_dlgVector,displayNull);
_ctrlDigit1 = _dlgVector displayCtrl 1311;
_ctrlDigit2 = _dlgVector displayCtrl 1312;
_ctrlDigit3 = _dlgVector displayCtrl 1313;
_ctrlDigit4 = _dlgVector displayCtrl 1314;
_ctrlDigit5 = _dlgVector displayCtrl 1315;
_ctrlDigit6 = _dlgVector displayCtrl 1316;
_ctrlDigit7 = _dlgVector displayCtrl 1317;
_ctrlDigit8 = _dlgVector displayCtrl 1318;
private ["_heightDistance", "_digits"]; private ["_heightDistance", "_digits"];
_heightDistance = call FUNC(getHeightDistance); _heightDistance = call FUNC(getHeightDistance);
@ -22,15 +13,15 @@ _heightDistance = call FUNC(getHeightDistance);
// height // height
_digits = [_heightDistance select 0] call FUNC(convertToTexturesDistance); _digits = [_heightDistance select 0] call FUNC(convertToTexturesDistance);
_ctrlDigit1 ctrlSetText (_digits select 0); (_dlgVector displayCtrl 1311) ctrlSetText (_digits select 0);
_ctrlDigit2 ctrlSetText (_digits select 1); (_dlgVector displayCtrl 1312) ctrlSetText (_digits select 1);
_ctrlDigit3 ctrlSetText (_digits select 2); (_dlgVector displayCtrl 1313) ctrlSetText (_digits select 2);
_ctrlDigit4 ctrlSetText (_digits select 3); (_dlgVector displayCtrl 1314) ctrlSetText (_digits select 3);
// non-slope distance // non-slope distance
_digits = [_heightDistance select 1] call FUNC(convertToTexturesDistance); _digits = [_heightDistance select 1] call FUNC(convertToTexturesDistance);
_ctrlDigit5 ctrlSetText (_digits select 0); (_dlgVector displayCtrl 1315) ctrlSetText (_digits select 0);
_ctrlDigit6 ctrlSetText (_digits select 1); (_dlgVector displayCtrl 1316) ctrlSetText (_digits select 1);
_ctrlDigit7 ctrlSetText (_digits select 2); (_dlgVector displayCtrl 1317) ctrlSetText (_digits select 2);
_ctrlDigit8 ctrlSetText (_digits select 3); (_dlgVector displayCtrl 1318) ctrlSetText (_digits select 3);

View File

@ -2,7 +2,7 @@
by commy2 by commy2
Shows or hides the vectors center square thingy. Shows or hides the 1-P text line.
*/ */
#include "script_component.hpp" #include "script_component.hpp"

View File

@ -1,74 +1,27 @@
// by commy2 // by commy2
#include "script_component.hpp" #include "script_component.hpp"
private["_dlgVector", "_ctrlVectorCenter", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8", "_ctrlDigitE1", "_ctrlDigitE2", "_ctrlDigitE3", "_distanceP1", "_directionP1", "_azimuthP1", "_inclinationP1", "_directionP2", "_azimuthP2", "_distanceP2", "_inclinationP2", "_digits", "_relDirection", "_relDistance", "_relHeight", "_relLenght", "_digits0", "_digits1", "_digits2", "_lenghtP1", "_lenghtP2", "_relAzimuth"]; private "_dlgVector";
disableSerialization; disableSerialization;
_dlgVector = uiNamespace getVariable "AGM_dlgVector"; _dlgVector = GETUVAR(ACE_dlgVector,displayNull);
_ctrlVectorCenter = _dlgVector displayCtrl 1;
_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;
_ctrlDigitE1 = _dlgVector displayCtrl 21;
_ctrlDigitE2 = _dlgVector displayCtrl 22;
_ctrlDigitE3 = _dlgVector displayCtrl 23;
_ctrlVectorCenter ctrlSetText "\AGM_Vector\rsc\Vector_Center.paa"; private ["_azimuthDistance", "_digits"];
_distanceP1 = call AGM_Vector_fnc_getDistance; _azimuthDistance = call FUNC(getRelativeAzimuthDistance);
_directionP1 = call AGM_Vector_fnc_getDirection;
_azimuthP1 = _directionP1 select 0;
_inclinationP1 = _directionP1 select 1;
_ctrlDigitE1 ctrlSetText "\AGM_Vector\rsc\d1.paa"; // relative azimuth
_ctrlDigitE2 ctrlSetText "\AGM_Vector\rsc\d-.paa"; _digits = [_azimuthDistance select 0] call FUNC(convertToTexturesDegree);
_ctrlDigitE3 ctrlSetText "\AGM_Vector\rsc\dP.paa";
waitUntil {!(AGM_vectorKey select 0)}; (_dlgVector displayCtrl 1315) ctrlSetText (_digits select 0);
(_dlgVector displayCtrl 1316) ctrlSetText (_digits select 1);
(_dlgVector displayCtrl 1317) ctrlSetText (_digits select 2);
(_dlgVector displayCtrl 1318) ctrlSetText (_digits select 3);
_distanceP2 = call AGM_Vector_fnc_getDistance; // relative non-slope distance
_directionP2 = call AGM_Vector_fnc_getDirection; _digits = [_azimuthDistance select 1] call FUNC(convertToTexturesDistance);
_azimuthP2 = _directionP2 select 0;
_inclinationP2 = _directionP2 select 1;
_relDirection = sqrt ((_azimuthP1 - _azimuthP2)^2 + (_inclinationP1 - _inclinationP2)^2); (_dlgVector displayCtrl 1311) ctrlSetText (_digits select 0);
_relDistance = sqrt (_distanceP1^2 + _distanceP2^2 - 2 * _distanceP1 * _distanceP2 * cos _relDirection); (_dlgVector displayCtrl 1312) ctrlSetText (_digits select 1);
_relHeight = (sin _inclinationP1 * _distanceP1) - (sin _inclinationP2 * _distanceP2); (_dlgVector displayCtrl 1313) ctrlSetText (_digits select 2);
_relLenght = sqrt (_relDistance^2 - _relHeight^2); if (str(_relLenght) == "-1.#IND") then {_relLenght = 0}; (_dlgVector displayCtrl 1314) ctrlSetText (_digits select 3);
_lenghtP1 = cos _inclinationP1 * _distanceP1;
_lenghtP2 = cos _inclinationP2 * _distanceP2;
_relAzimuth = (sin _azimuthP2 * _lenghtP2 - sin _azimuthP1 * _lenghtP1) atan2 (cos _azimuthP2 * _lenghtP2 - cos _azimuthP1 * _lenghtP1);
if (_relAzimuth < 0) then {_relAzimuth = _relAzimuth + 360};
if (_distanceP1 == -9999 || {_distanceP2 == -9999}) then {
_relDistance = -9999;
_relAzimuth = -9999;
};
_digits = _relLenght call AGM_Vector_fnc_convertDistance;
_ctrlDigit1 ctrlSetText (_digits select 0);
_ctrlDigit2 ctrlSetText (_digits select 1);
_ctrlDigit3 ctrlSetText (_digits select 2);
_ctrlDigit4 ctrlSetText (_digits select 3);
_digits = _relAzimuth call AGM_Vector_fnc_convertDegree;
_ctrlDigit5 ctrlSetText (_digits select 0);
_ctrlDigit6 ctrlSetText (_digits select 1);
_ctrlDigit7 ctrlSetText (_digits select 2);
_ctrlDigit8 ctrlSetText (_digits select 3);
_ctrlVectorCenter ctrlShow false;
_ctrlDigitE1 ctrlShow false;
_ctrlDigitE2 ctrlShow false;
_ctrlDigitE3 ctrlShow false;
AGM_isVectorReady = true;

View File

@ -0,0 +1,19 @@
// by commy2
#include "script_component.hpp"
private "_dlgVector";
disableSerialization;
_dlgVector = GETUVAR(ACE_dlgVector,displayNull);
private ["_distance", "_digits"];
_distance = call FUNC(getRelativeDistance);
// relative slope distance
_digits = [_distance] call FUNC(convertToTexturesDistance);
(_dlgVector displayCtrl 1311) ctrlSetText (_digits select 0);
(_dlgVector displayCtrl 1312) ctrlSetText (_digits select 1);
(_dlgVector displayCtrl 1313) ctrlSetText (_digits select 2);
(_dlgVector displayCtrl 1314) ctrlSetText (_digits select 3);