vector FOS mode

This commit is contained in:
commy2 2015-01-17 22:49:06 +01:00
parent 26409d0f50
commit fa2acfbb50
25 changed files with 348 additions and 304 deletions

View File

@ -1,30 +1,21 @@
#include "script_component.hpp" #include "script_component.hpp"
PREP(abort);
PREP(config);
PREP(convertFOS);
PREP(settings);
PREP(tabAzimuthKey);
PREP(tabDistanceKey);
/////
PREP(clearDisplay); PREP(clearDisplay);
PREP(convertToTexturesDegree); PREP(convertToTexturesDegree);
PREP(convertToTexturesDistance); PREP(convertToTexturesDistance);
PREP(convertToTexturesFOS);
PREP(showCenter); PREP(showCenter);
PREP(showP1); PREP(showP1);
PREP(onKeyDown); PREP(onKeyDown);
PREP(onKeyHold); PREP(onKeyHold);
PREP(onKeyUp); PREP(onKeyUp);
PREP(getDirection); PREP(getDirection);
PREP(getDistance); PREP(getDistance);
PREP(getHeightDistance); PREP(getHeightDistance);
PREP(getRelativeAzimuthDistance); PREP(getRelativeAzimuthDistance);
PREP(getRelativeDistance); PREP(getRelativeDistance);
PREP(getRelativeHeightLength); PREP(getRelativeHeightLength);
PREP(getFallOfShort);
PREP(showAzimuth); PREP(showAzimuth);
PREP(showAzimuthInclination); PREP(showAzimuthInclination);
PREP(showHeightDistance); PREP(showHeightDistance);

View File

@ -14,30 +14,18 @@ _dlgVector = GETUVAR(ACE_dlgVector,displayNull);
switch (_this select 0) do { switch (_this select 0) do {
case ("azimuth"): { case ("azimuth"): {
private ["_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8"]; (_dlgVector displayCtrl 1315) ctrlSetText "";
(_dlgVector displayCtrl 1316) ctrlSetText "";
_ctrlDigit5 = _dlgVector displayCtrl 1315; (_dlgVector displayCtrl 1317) ctrlSetText "";
_ctrlDigit6 = _dlgVector displayCtrl 1316; (_dlgVector displayCtrl 1318) ctrlSetText "";
_ctrlDigit7 = _dlgVector displayCtrl 1317; (_dlgVector displayCtrl 1319) ctrlSetText "";
_ctrlDigit8 = _dlgVector displayCtrl 1318;
_ctrlDigit5 ctrlSetText "";
_ctrlDigit6 ctrlSetText "";
_ctrlDigit7 ctrlSetText "";
_ctrlDigit8 ctrlSetText "";
}; };
case ("distance"): { case ("distance"): {
private ["_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4"]; (_dlgVector displayCtrl 1310) ctrlSetText "";
(_dlgVector displayCtrl 1311) ctrlSetText "";
_ctrlDigit1 = _dlgVector displayCtrl 1311; (_dlgVector displayCtrl 1312) ctrlSetText "";
_ctrlDigit2 = _dlgVector displayCtrl 1312; (_dlgVector displayCtrl 1313) ctrlSetText "";
_ctrlDigit3 = _dlgVector displayCtrl 1313; (_dlgVector displayCtrl 1314) ctrlSetText "";
_ctrlDigit4 = _dlgVector displayCtrl 1314;
_ctrlDigit1 ctrlSetText "";
_ctrlDigit2 ctrlSetText "";
_ctrlDigit3 ctrlSetText "";
_ctrlDigit4 ctrlSetText "";
}; };
}; };

View File

@ -0,0 +1,239 @@
/* by commy2
converts rangefinder distance into array of textures for the vectors scripted info control
*/
#include "script_component.hpp"
private ["_number", "_coordinate", "_isNegative"];
_number = _this select 0;
_coordinate = _this select 1;
_number = round (_number select _coordinate);
_isNegative = _number < 0;
_number = abs _number;
if (_number >= 10000) exitWith {
[QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa))] // return
};
private ["_digit0", "_digit1", "_digit2", "_digit3", "_digit4"];
_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 = QUOTE(PATHTOF(rsc\vector_d.paa));
_digit1 = "";
_digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
_digit3 = "";
_digit4 = "";
} else {
_digit0 = QUOTE(PATHTOF(rsc\vector_d.paa));
_digit1 = "";
_digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
_digit4 = "";
};
} else {
_digit0 = QUOTE(PATHTOF(rsc\vector_d.paa));
_digit1 = "";
_digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2];
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
_digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
};
} else {
_digit0 = "";
_digit1 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit2 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit3 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit4 = QUOTE(PATHTOF(rsc\vector_minus.paa));
};
} else {
if (_digit1 == 0) then {
if (_digit2 == 0) then {
if (_digit3 == 0) then {
_digit0 = QUOTE(PATHTOF(rsc\vector_a.paa));
_digit1 = "";
_digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
_digit3 = "";
_digit4 = "";
} else {
_digit0 = QUOTE(PATHTOF(rsc\vector_a.paa));
_digit1 = "";
_digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
_digit4 = "";
};
} else {
_digit0 = QUOTE(PATHTOF(rsc\vector_a.paa));
_digit1 = "";
_digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2];
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
_digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
};
} else {
_digit0 = "";
_digit1 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit2 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit3 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit4 = QUOTE(PATHTOF(rsc\vector_minus.paa));
};
};
};
case 1 : {
if (_isNegative) then {
if (_digit1 == 0) then {
if (_digit2 == 0) then {
if (_digit3 == 0) then {
_digit0 = QUOTE(PATHTOF(rsc\vector_l.paa));
_digit1 = "";
_digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
_digit3 = "";
_digit4 = "";
} else {
_digit0 = QUOTE(PATHTOF(rsc\vector_l.paa));
_digit1 = "";
_digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
_digit4 = "";
};
} else {
_digit0 = QUOTE(PATHTOF(rsc\vector_l.paa));
_digit1 = "";
_digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2];
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
_digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
};
} else {
_digit0 = "";
_digit1 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit2 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit3 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit4 = QUOTE(PATHTOF(rsc\vector_minus.paa));
};
} else {
if (_digit1 == 0) then {
if (_digit2 == 0) then {
if (_digit3 == 0) then {
_digit0 = QUOTE(PATHTOF(rsc\vector_r.paa));
_digit1 = "";
_digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
_digit3 = "";
_digit4 = "";
} else {
_digit0 = QUOTE(PATHTOF(rsc\vector_r.paa));
_digit1 = "";
_digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
_digit4 = "";
};
} else {
_digit0 = QUOTE(PATHTOF(rsc\vector_r.paa));
_digit1 = "";
_digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2];
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
_digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
};
} else {
_digit0 = "";
_digit1 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit2 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit3 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit4 = QUOTE(PATHTOF(rsc\vector_minus.paa));
};
};
};
case 2 : {
if (_isNegative) then {
if (_digit1 == 0) then {
if (_digit2 == 0) then {
if (_digit3 == 0) then {
_digit0 = QUOTE(PATHTOF(rsc\vector_u.paa));
_digit1 = QUOTE(PATHTOF(rsc\vector_p.paa));
_digit2 = "";
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
_digit4 = "";
} else {
_digit0 = QUOTE(PATHTOF(rsc\vector_u.paa));
_digit1 = QUOTE(PATHTOF(rsc\vector_p.paa));
_digit2 = "";
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
_digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
};
} else {
_digit0 = QUOTE(PATHTOF(rsc\vector_u.paa));
_digit1 = QUOTE(PATHTOF(rsc\vector_p.paa));
_digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2];
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
_digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
};
} else {
_digit0 = "";
_digit1 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit2 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit3 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit4 = QUOTE(PATHTOF(rsc\vector_minus.paa));
};
} else {
if (_digit1 == 0) then {
if (_digit2 == 0) then {
if (_digit3 == 0) then {
_digit0 = QUOTE(PATHTOF(rsc\vector_d.paa));
_digit1 = QUOTE(PATHTOF(rsc\vector_n.paa));
_digit2 = "";
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
_digit4 = "";
} else {
_digit0 = QUOTE(PATHTOF(rsc\vector_d.paa));
_digit1 = QUOTE(PATHTOF(rsc\vector_n.paa));
_digit2 = "";
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
_digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
};
} else {
_digit0 = QUOTE(PATHTOF(rsc\vector_d.paa));
_digit1 = QUOTE(PATHTOF(rsc\vector_n.paa));
_digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2];
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
_digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
};
} else {
_digit0 = "";
_digit1 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit2 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit3 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit4 = QUOTE(PATHTOF(rsc\vector_minus.paa));
};
};
};
};
[_digit0, _digit1, _digit2, _digit3, _digit4]

View File

@ -0,0 +1,26 @@
// 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 ["_abscissa", "_ordinate", "_applicate"];
_abscissa = _distanceP1 * sin (_azimuthP1 - _azimuthP2);
_ordinate = _distanceP1 * cos (_inclinationP1 - _inclinationP2) - _distanceP2 * cos (_azimuthP1 - _azimuthP2);
_applicate = (sin _inclinationP2 * _distanceP2) - (sin _inclinationP1 * _distanceP1);
if (_distanceP1 < -999 || {_distanceP2 < -999}) exitWith {
[-1000, -1000, -1000] // return
};
[_abscissa, _ordinate, _applicate]

View File

@ -1,104 +0,0 @@
// by commy2
#include "script_component.hpp"
private["_dlgVector", "_ctrlVectorCenter", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8", "_ctrlDigit9", "_ctrlDigitE1", "_ctrlDigitE2", "_ctrlDigitE3", "_distanceP1", "_directionP1", "_azimuthP1", "_inclinationP1", "_directionP2", "_azimuthP2", "_abscissa", "_ordinate", "_applicate", "_distanceP2", "_digits", "_inclinationP2", "_height", "_lenght", "_digits0", "_digits1", "_digits2"];
disableSerialization;
_dlgVector = uiNamespace getVariable "AGM_dlgVector";
_ctrlVectorCenter = _dlgVector displayCtrl 1;
_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;
_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;
_abscissa = _distanceP1 * sin (_azimuthP1 - _azimuthP2);
_ordinate = _distanceP1 * cos (_inclinationP1 - _inclinationP2) - _distanceP2 * cos (_azimuthP1 - _azimuthP2);
_applicate = (sin _inclinationP2 * _distanceP2) - (sin _inclinationP1 * _distanceP1);
if (_distanceP1 == -9999 || {_distanceP2 == -9999}) then {
_abscissa = -9999;
_ordinate = -9999;
_applicate = -9999;
};
_digits0 = [_ordinate, 0] call AGM_Vector_fnc_convertFOS;
_digits1 = [_abscissa, 1] call AGM_Vector_fnc_convertFOS;
_digits2 = [_applicate, 2] call AGM_Vector_fnc_convertFOS;
_ctrlVectorCenter ctrlShow false;
_ctrlDigitE1 ctrlShow false;
_ctrlDigitE2 ctrlShow false;
_ctrlDigitE3 ctrlShow false;
waitUntil {
_ctrlDigit0 ctrlSetText (_digits0 select 0);
_ctrlDigit1 ctrlSetText (_digits0 select 1);
_ctrlDigit2 ctrlSetText (_digits0 select 2);
_ctrlDigit3 ctrlSetText (_digits0 select 3);
_ctrlDigit4 ctrlSetText (_digits0 select 4);
_ctrlDigit5 ctrlSetText (_digits1 select 0);
_ctrlDigit6 ctrlSetText (_digits1 select 1);
_ctrlDigit7 ctrlSetText (_digits1 select 2);
_ctrlDigit8 ctrlSetText (_digits1 select 3);
_ctrlDigit9 ctrlSetText (_digits1 select 4);
waitUntil {!(AGM_vectorKey select 1) || {AGM_vectorKey select 0}};
waitUntil {AGM_vectorKey select 1 || {AGM_vectorKey select 0}};
if !(AGM_vectorKey select 0) then {
_ctrlDigit0 ctrlSetText (_digits2 select 0);
_ctrlDigit1 ctrlSetText (_digits2 select 1);
_ctrlDigit2 ctrlSetText (_digits2 select 2);
_ctrlDigit3 ctrlSetText (_digits2 select 3);
_ctrlDigit4 ctrlSetText (_digits2 select 4);
_ctrlDigit5 ctrlSetText "";
_ctrlDigit6 ctrlSetText "";
_ctrlDigit7 ctrlSetText "";
_ctrlDigit8 ctrlSetText "";
_ctrlDigit9 ctrlSetText "";
};
waitUntil {!(AGM_vectorKey select 1) || {AGM_vectorKey select 0}};
waitUntil {AGM_vectorKey select 1 || {AGM_vectorKey select 0}};
AGM_vectorKey select 0
};
_ctrlDigit0 ctrlSetText "";
_ctrlDigit1 ctrlSetText "";
_ctrlDigit2 ctrlSetText "";
_ctrlDigit3 ctrlSetText "";
_ctrlDigit4 ctrlSetText "";
_ctrlDigit5 ctrlSetText "";
_ctrlDigit6 ctrlSetText "";
_ctrlDigit7 ctrlSetText "";
_ctrlDigit8 ctrlSetText "";
_ctrlDigit9 ctrlSetText "";
AGM_isVectorReady = true;

View File

@ -1,68 +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", "_azimuth", "_inclination", "_height", "_lenght", "_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;
_azimuth = abs (_azimuthP1 - _azimuthP2);
_inclination = abs (_inclinationP1 - _inclinationP2);
_height = sqrt (_distanceP1^2 + _distanceP2^2 - 2 * _distanceP1 * _distanceP2 * cos _inclination);
_lenght = sqrt (_distanceP1^2 + _distanceP2^2 - 2 * _distanceP1 * _distanceP2 * cos _azimuth);
if (_inclination < 0) then {_height = -1 * _height};
if (_distanceP1 == -9999 || {_distanceP2 == -9999}) then {
_height = -9999;
_lenght = -9999;
};
_digits = _height 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 = _lenght call AGM_Vector_fnc_convertDistance;
_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

@ -41,7 +41,12 @@ switch (_this select 0) do {
"azimuth" call _fnc_setPFH; "azimuth" call _fnc_setPFH;
}; };
} else { } else {
"azimuth+distance" call _fnc_setPFH; if (GETGVAR(isKeyDownDistance,false)) then {
"azimuth+distance" call _fnc_setPFH;
} else {
["distance"] call FUNC(clearDisplay);
"azimuth" call _fnc_setPFH;
};
}; };
}; };
@ -51,6 +56,11 @@ switch (_this select 0) do {
// prevent additinal modifier input if advanced mode it set, spaghetti // prevent additinal modifier input if advanced mode it set, spaghetti
if (GETGVAR(isKeyDownAzimuth,false) && {GETGVAR(currentMode,"") in ["relative_azimuth+distance", "fall_of_short"]}) exitWith {}; if (GETGVAR(isKeyDownAzimuth,false) && {GETGVAR(currentMode,"") in ["relative_azimuth+distance", "fall_of_short"]}) exitWith {};
// toggle fos values
if (GETGVAR(currentMode,"") == "fall_of_short") exitWith {
[!(GETGVAR(FOSState,true))] call FUNC(showFallOfShort);
};
["distance"] call FUNC(clearDisplay); ["distance"] call FUNC(clearDisplay);
GVAR(isKeyDownDistance) = true; GVAR(isKeyDownDistance) = true;
@ -68,7 +78,12 @@ switch (_this select 0) do {
"distance" call _fnc_setPFH; "distance" call _fnc_setPFH;
}; };
} else { } else {
"azimuth+distance" call _fnc_setPFH; if (GETGVAR(isKeyDownAzimuth,false)) then {
"azimuth+distance" call _fnc_setPFH;
} else {
["azimuth"] call FUNC(clearDisplay);
"distance" call _fnc_setPFH;
};
}; };
}; };

View File

@ -10,9 +10,14 @@ PFH executed while holding a vector key down.
switch (_this select 0) do { switch (_this select 0) do {
case ("azimuth"): { case ("azimuth"): {
private "_isReady";
_isReady = diag_tickTime > GVAR(keyDownTimeAzimuth) + 0.2;
[false] call FUNC(showCenter); [false] call FUNC(showCenter);
call FUNC(showAzimuth); if (_isReady) then {
call FUNC(showAzimuth);
};
if (!GVAR(isKeyDownAzimuth)) then { if (!GVAR(isKeyDownAzimuth)) then {
[_this select 1] call CBA_fnc_removePerFrameHandler; [_this select 1] call CBA_fnc_removePerFrameHandler;
@ -186,7 +191,8 @@ switch (_this select 0) do {
if (!GVAR(isKeyDownAzimuth) && {!GVAR(isKeyDownDistance)}) then { if (!GVAR(isKeyDownAzimuth) && {!GVAR(isKeyDownDistance)}) then {
if (_isReady) then { if (_isReady) then {
call FUNC(showFallOfShort); GVAR(FOSData) = call FUNC(getFallOfShort);//
[false] call FUNC(showFallOfShort);
}; };
[false] call FUNC(showCenter); [false] call FUNC(showCenter);
[false] call FUNC(showP1); [false] call FUNC(showP1);
@ -202,4 +208,4 @@ switch (_this select 0) do {
}; };
systemChat str (_this select 0);// //systemChat str (_this select 0);

View File

@ -53,6 +53,7 @@ switch (_this select 0) do {
switch (GVAR(currentMode)) do { switch (GVAR(currentMode)) do {
case ("azimuth"): { case ("azimuth"): {
["azimuth"] call FUNC(clearDisplay);
["distance"] call FUNC(clearDisplay); ["distance"] call FUNC(clearDisplay);
[true] call FUNC(showP1); [true] call FUNC(showP1);
GVAR(pData) = [call FUNC(getDistance), call FUNC(getDirection)]; GVAR(pData) = [call FUNC(getDistance), call FUNC(getDirection)];
@ -60,6 +61,7 @@ switch (_this select 0) do {
}; };
case ("azimuth+inclination"): { case ("azimuth+inclination"): {
["azimuth"] call FUNC(clearDisplay);
["distance"] call FUNC(clearDisplay); ["distance"] call FUNC(clearDisplay);
[true] call FUNC(showP1); [true] call FUNC(showP1);
GVAR(pData) = [call FUNC(getDistance), call FUNC(getDirection)]; GVAR(pData) = [call FUNC(getDistance), call FUNC(getDirection)];

View File

@ -1,106 +1,55 @@
// by commy2 // by commy2
#include "script_component.hpp" #include "script_component.hpp"
if (true) exitWith {}; GVAR(FOSState) = _this select 0;
private["_dlgVector", "_ctrlVectorCenter", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8", "_ctrlDigit9", "_ctrlDigitE1", "_ctrlDigitE2", "_ctrlDigitE3", "_distanceP1", "_directionP1", "_azimuthP1", "_inclinationP1", "_directionP2", "_azimuthP2", "_abscissa", "_ordinate", "_applicate", "_distanceP2", "_digits", "_inclinationP2", "_height", "_lenght", "_digits0", "_digits1", "_digits2"]; private "_dlgVector";
disableSerialization; disableSerialization;
_dlgVector = uiNamespace getVariable "AGM_dlgVector"; _dlgVector = GETUVAR(ACE_dlgVector,displayNull);
_ctrlVectorCenter = _dlgVector displayCtrl 1;
_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;
_ctrlVectorCenter ctrlSetText "\AGM_Vector\rsc\Vector_Center.paa"; private "_fosData";
_distanceP1 = call AGM_Vector_fnc_getDistance; _fosData = GVAR(FOSData);
_directionP1 = call AGM_Vector_fnc_getDirection;
_azimuthP1 = _directionP1 select 0;
_inclinationP1 = _directionP1 select 1;
_ctrlDigitE1 ctrlSetText "\AGM_Vector\rsc\d1.paa"; if !(_this select 0) then {
_ctrlDigitE2 ctrlSetText "\AGM_Vector\rsc\d-.paa"; private "_digits";
_ctrlDigitE3 ctrlSetText "\AGM_Vector\rsc\dP.paa";
waitUntil {!(AGM_vectorKey select 0)}; // of abscissa
_digits = [_fosData, 0] call FUNC(convertToTexturesFOS);
_distanceP2 = call AGM_Vector_fnc_getDistance; (_dlgVector displayCtrl 1310) ctrlSetText (_digits select 0);
_directionP2 = call AGM_Vector_fnc_getDirection; (_dlgVector displayCtrl 1311) ctrlSetText (_digits select 1);
_azimuthP2 = _directionP2 select 0; (_dlgVector displayCtrl 1312) ctrlSetText (_digits select 2);
_inclinationP2 = _directionP2 select 1; (_dlgVector displayCtrl 1313) ctrlSetText (_digits select 3);
(_dlgVector displayCtrl 1314) ctrlSetText (_digits select 4);
// of ordinate
_digits = [_fosData, 1] call FUNC(convertToTexturesFOS);
(_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);
(_dlgVector displayCtrl 1319) ctrlSetText (_digits select 4);
} else {
private "_digits";
// applicate
_digits = [_fosData, 2] call FUNC(convertToTexturesFOS);
(_dlgVector displayCtrl 1310) ctrlSetText (_digits select 0);
(_dlgVector displayCtrl 1311) ctrlSetText (_digits select 1);
(_dlgVector displayCtrl 1312) ctrlSetText (_digits select 2);
(_dlgVector displayCtrl 1313) ctrlSetText (_digits select 3);
(_dlgVector displayCtrl 1314) ctrlSetText (_digits select 4);
// nothing
(_dlgVector displayCtrl 1315) ctrlSetText "";
(_dlgVector displayCtrl 1316) ctrlSetText "";
(_dlgVector displayCtrl 1317) ctrlSetText "";
(_dlgVector displayCtrl 1318) ctrlSetText "";
(_dlgVector displayCtrl 1319) ctrlSetText "";
_abscissa = _distanceP1 * sin (_azimuthP1 - _azimuthP2);
_ordinate = _distanceP1 * cos (_inclinationP1 - _inclinationP2) - _distanceP2 * cos (_azimuthP1 - _azimuthP2);
_applicate = (sin _inclinationP2 * _distanceP2) - (sin _inclinationP1 * _distanceP1);
if (_distanceP1 == -9999 || {_distanceP2 == -9999}) then {
_abscissa = -9999;
_ordinate = -9999;
_applicate = -9999;
}; };
_digits0 = [_ordinate, 0] call AGM_Vector_fnc_convertFOS;
_digits1 = [_abscissa, 1] call AGM_Vector_fnc_convertFOS;
_digits2 = [_applicate, 2] call AGM_Vector_fnc_convertFOS;
_ctrlVectorCenter ctrlShow false;
_ctrlDigitE1 ctrlShow false;
_ctrlDigitE2 ctrlShow false;
_ctrlDigitE3 ctrlShow false;
waitUntil {
_ctrlDigit0 ctrlSetText (_digits0 select 0);
_ctrlDigit1 ctrlSetText (_digits0 select 1);
_ctrlDigit2 ctrlSetText (_digits0 select 2);
_ctrlDigit3 ctrlSetText (_digits0 select 3);
_ctrlDigit4 ctrlSetText (_digits0 select 4);
_ctrlDigit5 ctrlSetText (_digits1 select 0);
_ctrlDigit6 ctrlSetText (_digits1 select 1);
_ctrlDigit7 ctrlSetText (_digits1 select 2);
_ctrlDigit8 ctrlSetText (_digits1 select 3);
_ctrlDigit9 ctrlSetText (_digits1 select 4);
waitUntil {!(AGM_vectorKey select 1) || {AGM_vectorKey select 0}};
waitUntil {AGM_vectorKey select 1 || {AGM_vectorKey select 0}};
if !(AGM_vectorKey select 0) then {
_ctrlDigit0 ctrlSetText (_digits2 select 0);
_ctrlDigit1 ctrlSetText (_digits2 select 1);
_ctrlDigit2 ctrlSetText (_digits2 select 2);
_ctrlDigit3 ctrlSetText (_digits2 select 3);
_ctrlDigit4 ctrlSetText (_digits2 select 4);
_ctrlDigit5 ctrlSetText "";
_ctrlDigit6 ctrlSetText "";
_ctrlDigit7 ctrlSetText "";
_ctrlDigit8 ctrlSetText "";
_ctrlDigit9 ctrlSetText "";
};
waitUntil {!(AGM_vectorKey select 1) || {AGM_vectorKey select 0}};
waitUntil {AGM_vectorKey select 1 || {AGM_vectorKey select 0}};
AGM_vectorKey select 0
};
_ctrlDigit0 ctrlSetText "";
_ctrlDigit1 ctrlSetText "";
_ctrlDigit2 ctrlSetText "";
_ctrlDigit3 ctrlSetText "";
_ctrlDigit4 ctrlSetText "";
_ctrlDigit5 ctrlSetText "";
_ctrlDigit6 ctrlSetText "";
_ctrlDigit7 ctrlSetText "";
_ctrlDigit8 ctrlSetText "";
_ctrlDigit9 ctrlSetText "";
AGM_isVectorReady = true;