diff --git a/addons/vector/XEH_preInit.sqf b/addons/vector/XEH_preInit.sqf index 5be4f38e3f..8f35478045 100644 --- a/addons/vector/XEH_preInit.sqf +++ b/addons/vector/XEH_preInit.sqf @@ -3,8 +3,6 @@ PREP(abort); PREP(config); PREP(convertFOS); -PREP(modeDistanceAzimuth); -PREP(modeDistanceHeight); PREP(modeFallOfShort); PREP(modeRelativeAzimuthDistance); PREP(modeRelativeDistance); @@ -18,12 +16,14 @@ PREP(convertToTexturesDegree); PREP(convertToTexturesDistance); PREP(getDirection); PREP(getDistance); +PREP(getHeightDistance); PREP(onKeyDown); PREP(onKeyHold); PREP(onKeyUp); PREP(showAzimuth); PREP(showAzimuthInclination); PREP(showCenter); +PREP(showHeightDistance); PREP(showDistance); GVAR(holdKeyHandler) = -1; diff --git a/addons/vector/functions/fnc_getDirection.sqf b/addons/vector/functions/fnc_getDirection.sqf index 50858f6d0c..3a131cbd19 100644 --- a/addons/vector/functions/fnc_getDirection.sqf +++ b/addons/vector/functions/fnc_getDirection.sqf @@ -13,6 +13,8 @@ _dlgVector = GETUVAR(ACE_dlgVector, displayNull); ] */ +#define MAX_ABSINCLINATION 45 + private ["_position", "_direction", "_azimuth", "_inclination"]; _position = ATLToASL positionCameraToWorld [0,0,0]; @@ -22,5 +24,6 @@ _azimuth = ((_direction select 0) - (_position select 0)) atan2 ((_direction sel _inclination = asin ((_direction select 2) - (_position select 2)); if (_azimuth < 0) then {_azimuth = _azimuth + 360}; +if (abs _inclination > MAX_ABSINCLINATION) then {_inclination = -1000}; [_azimuth, _inclination] diff --git a/addons/vector/functions/fnc_getDistance.sqf b/addons/vector/functions/fnc_getDistance.sqf index 6aacaa1b57..f1312be511 100644 --- a/addons/vector/functions/fnc_getDistance.sqf +++ b/addons/vector/functions/fnc_getDistance.sqf @@ -11,7 +11,7 @@ _dlgVector = GETUVAR(ACE_dlgVector,displayNull); _distance = ctrlText (_dlgVector displayCtrl 151); -if (_distance == "----") exitWith {-1}; +if (_distance == "----") exitWith {-1000}; _distance = round parseNumber _distance; @@ -19,7 +19,7 @@ if (GVAR(useFeet)) then { _distance = 3.28084 * _distance; }; -if (_distance > MAX_DISTANCE) exitWith {-1}; -if (_distance < MIN_DISTANCE) exitWith {-1}; +if (_distance > MAX_DISTANCE) exitWith {-1000}; +if (_distance < MIN_DISTANCE) exitWith {-1000}; _distance diff --git a/addons/vector/functions/fnc_getHeightDistance.sqf b/addons/vector/functions/fnc_getHeightDistance.sqf new file mode 100644 index 0000000000..d7efa900be --- /dev/null +++ b/addons/vector/functions/fnc_getHeightDistance.sqf @@ -0,0 +1,16 @@ +// by commy2 +#include "script_component.hpp" + +private ["_distance", "_direction", "_azimuth", "_inclination"]; + +_distance = call FUNC(getDistance); +_direction = call FUNC(getDirection); + +_azimuth = _direction select 0; +_inclination = _direction select 1; + +if (_distance < -999) exitWith { + [-1000,-1000] // return +}; + +[sin _inclination * _distance, cos _inclination * _distance] diff --git a/addons/vector/functions/fnc_onKeyDown.sqf b/addons/vector/functions/fnc_onKeyDown.sqf index 6630576069..a062103eba 100644 --- a/addons/vector/functions/fnc_onKeyDown.sqf +++ b/addons/vector/functions/fnc_onKeyDown.sqf @@ -46,7 +46,7 @@ switch (_this select 0) do { GVAR(isKeyDownDistance) = true; if (diag_tickTime < GVAR(keyDownTimeDistance) + 0.5) exitWith { - //"azimuth+inclination" call _fnc_setPFH; + "height+distance" call _fnc_setPFH; }; GVAR(keyDownTimeDistance) = diag_tickTime; diff --git a/addons/vector/functions/fnc_onKeyHold.sqf b/addons/vector/functions/fnc_onKeyHold.sqf index d5043fc40b..255c9acc4e 100644 --- a/addons/vector/functions/fnc_onKeyHold.sqf +++ b/addons/vector/functions/fnc_onKeyHold.sqf @@ -83,6 +83,29 @@ switch (_this select 0) do { }; }; + + case ("height+distance"): { + + private "_isReady"; + _isReady = diag_tickTime > GVAR(keyDownTimeDistance) + 0.5; + + [_isReady] call FUNC(showCenter); + + if (!GVAR(isKeyDownDistance)) then { + if (_isReady) then { + call FUNC(showHeightDistance); + [false] call FUNC(showCenter); + }; + + [_this select 1] call CBA_fnc_removePerFrameHandler; + + if (GVAR(holdKeyHandler) > -1) then { + GVAR(holdKeyHandler) = -1; + }; + }; + + }; + }; systemChat str (_this select 0);// diff --git a/addons/vector/functions/fnc_showHeightDistance.sqf b/addons/vector/functions/fnc_showHeightDistance.sqf new file mode 100644 index 0000000000..05d28bcf87 --- /dev/null +++ b/addons/vector/functions/fnc_showHeightDistance.sqf @@ -0,0 +1,36 @@ +// by commy2 +#include "script_component.hpp" + +private ["_dlgVector", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8"]; + +disableSerialization; +_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"]; + +_heightDistance = call FUNC(getHeightDistance); + +// height +_digits = [_heightDistance select 0] call FUNC(convertToTexturesDistance); + +_ctrlDigit1 ctrlSetText (_digits select 0); +_ctrlDigit2 ctrlSetText (_digits select 1); +_ctrlDigit3 ctrlSetText (_digits select 2); +_ctrlDigit4 ctrlSetText (_digits select 3); + +// non-slope distance +_digits = [_heightDistance select 1] call FUNC(convertToTexturesDistance); + +_ctrlDigit5 ctrlSetText (_digits select 0); +_ctrlDigit6 ctrlSetText (_digits select 1); +_ctrlDigit7 ctrlSetText (_digits select 2); +_ctrlDigit8 ctrlSetText (_digits select 3);