mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
vector object height, length mode
This commit is contained in:
parent
6abc6073e1
commit
6658eafe3d
@ -23,6 +23,7 @@ PREP(getDistance);
|
||||
PREP(getHeightDistance);
|
||||
PREP(getRelativeAzimuthDistance);
|
||||
PREP(getRelativeDistance);
|
||||
PREP(getRelativeHeightLength);
|
||||
|
||||
PREP(showAzimuth);
|
||||
PREP(showAzimuthInclination);
|
||||
@ -30,6 +31,8 @@ PREP(showHeightDistance);
|
||||
PREP(showDistance);
|
||||
PREP(showRelativeAzimuthDistance);
|
||||
PREP(showRelativeDistance);
|
||||
PREP(showRelativeHeightLength);
|
||||
PREP(showFallOfShort);
|
||||
|
||||
GVAR(holdKeyHandler) = -1;
|
||||
GVAR(isKeyDownAzimuth) = false;
|
||||
|
29
addons/vector/functions/fnc_getRelativeHeightLength.sqf
Normal file
29
addons/vector/functions/fnc_getRelativeHeightLength.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
// 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 ["_azimuth", "_inclination", "_height", "_length"];
|
||||
|
||||
_azimuth = abs (_azimuthP1 - _azimuthP2);
|
||||
_inclination = abs (_inclinationP1 - _inclinationP2);
|
||||
_height = sqrt (_distanceP1 ^ 2 + _distanceP2 ^ 2 - 2 * _distanceP1 * _distanceP2 * cos _inclination);
|
||||
_length = sqrt (_distanceP1 ^ 2 + _distanceP2 ^ 2 - 2 * _distanceP1 * _distanceP2 * cos _azimuth);
|
||||
|
||||
if (_inclination < 0) then {_height = -1 * _height};
|
||||
|
||||
if (_distanceP1 < -999 || {_distanceP2 < -999}) exitWith {
|
||||
[-1000, -1000] // return
|
||||
};
|
||||
|
||||
[_height, _length]
|
@ -21,7 +21,8 @@ _fnc_setPFH = {
|
||||
switch (_this select 0) do {
|
||||
case ("azimuth"): {
|
||||
|
||||
if (GETGVAR(isKeyDownDistance,false) && {GETGVAR(currentMode,"") in ["relative_distance"]}) exitWith {};
|
||||
// prevent additinal modifier input if advanced mode it set, spaghetti
|
||||
if (GETGVAR(isKeyDownDistance,false) && {GETGVAR(currentMode,"") in ["relative_distance", "relative_height+length"]}) exitWith {};
|
||||
|
||||
["azimuth"] call FUNC(clearDisplay);
|
||||
|
||||
@ -47,7 +48,8 @@ switch (_this select 0) do {
|
||||
|
||||
case ("distance"): {
|
||||
|
||||
if (GETGVAR(isKeyDownAzimuth,false) && {GETGVAR(currentMode,"") in ["relative_azimuth+distance"]}) exitWith {};
|
||||
// prevent additinal modifier input if advanced mode it set, spaghetti
|
||||
if (GETGVAR(isKeyDownAzimuth,false) && {GETGVAR(currentMode,"") in ["relative_azimuth+distance", "fall_of_short"]}) exitWith {};
|
||||
|
||||
["distance"] call FUNC(clearDisplay);
|
||||
|
||||
|
@ -131,6 +131,29 @@ switch (_this select 0) do {
|
||||
|
||||
};
|
||||
|
||||
case ("relative_height+length"): {
|
||||
|
||||
private "_isReady";
|
||||
_isReady = diag_tickTime > GVAR(keyDownTimeAzimuth) + 0.5;
|
||||
|
||||
[_isReady] call FUNC(showCenter);
|
||||
|
||||
if (!GVAR(isKeyDownAzimuth) && {!GVAR(isKeyDownDistance)}) then {
|
||||
if (_isReady) then {
|
||||
call FUNC(showRelativeHeightLength);
|
||||
};
|
||||
[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";
|
||||
@ -154,6 +177,29 @@ switch (_this select 0) do {
|
||||
|
||||
};
|
||||
|
||||
case ("fall_of_short"): {
|
||||
|
||||
private "_isReady";
|
||||
_isReady = diag_tickTime > GVAR(keyDownTimeDistance) + 0.5;
|
||||
|
||||
[_isReady] call FUNC(showCenter);
|
||||
|
||||
if (!GVAR(isKeyDownAzimuth) && {!GVAR(isKeyDownDistance)}) then {
|
||||
if (_isReady) then {
|
||||
call FUNC(showFallOfShort);
|
||||
};
|
||||
[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);//
|
||||
|
@ -24,12 +24,23 @@ switch (_this select 0) do {
|
||||
GVAR(isKeyDownAzimuth) = false;
|
||||
|
||||
if (GVAR(isKeyDownDistance)) then {
|
||||
if (GVAR(currentMode) == "distance") then {
|
||||
|
||||
switch (GVAR(currentMode)) do {
|
||||
case ("distance"): {
|
||||
["azimuth"] call FUNC(clearDisplay);
|
||||
[true] call FUNC(showP1);
|
||||
GVAR(pData) = [call FUNC(getDistance), call FUNC(getDirection)];
|
||||
"relative_distance" call _fnc_setPFH;
|
||||
};
|
||||
|
||||
case ("height+distance"): {
|
||||
["azimuth"] call FUNC(clearDisplay);
|
||||
[true] call FUNC(showP1);
|
||||
GVAR(pData) = [call FUNC(getDistance), call FUNC(getDirection)];
|
||||
"relative_height+length" call _fnc_setPFH;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
@ -39,12 +50,23 @@ switch (_this select 0) do {
|
||||
GVAR(isKeyDownDistance) = false;
|
||||
|
||||
if (GVAR(isKeyDownAzimuth)) then {
|
||||
if (GVAR(currentMode) == "azimuth") then {
|
||||
|
||||
switch (GVAR(currentMode)) do {
|
||||
case ("azimuth"): {
|
||||
["distance"] call FUNC(clearDisplay);
|
||||
[true] call FUNC(showP1);
|
||||
GVAR(pData) = [call FUNC(getDistance), call FUNC(getDirection)];
|
||||
"relative_azimuth+distance" call _fnc_setPFH;
|
||||
};
|
||||
|
||||
case ("azimuth+inclination"): {
|
||||
["distance"] call FUNC(clearDisplay);
|
||||
[true] call FUNC(showP1);
|
||||
GVAR(pData) = [call FUNC(getDistance), call FUNC(getDirection)];
|
||||
"fall_of_short" call _fnc_setPFH;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
106
addons/vector/functions/fnc_showFallOfShort.sqf
Normal file
106
addons/vector/functions/fnc_showFallOfShort.sqf
Normal file
@ -0,0 +1,106 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (true) exitWith {};
|
||||
|
||||
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;
|
27
addons/vector/functions/fnc_showRelativeHeightLength.sqf
Normal file
27
addons/vector/functions/fnc_showRelativeHeightLength.sqf
Normal file
@ -0,0 +1,27 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_dlgVector";
|
||||
|
||||
disableSerialization;
|
||||
_dlgVector = GETUVAR(ACE_dlgVector,displayNull);
|
||||
|
||||
private ["_heightLength", "_digits"];
|
||||
|
||||
_heightLength = call FUNC(getRelativeHeightLength);
|
||||
|
||||
// height
|
||||
_digits = [_heightLength select 0] 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);
|
||||
|
||||
// length
|
||||
_digits = [_heightLength select 1] call FUNC(convertToTexturesDistance);
|
||||
|
||||
(_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);
|
Loading…
Reference in New Issue
Block a user