vector height + distance mode

This commit is contained in:
commy2 2015-01-15 17:24:19 +01:00
parent 3e9785e145
commit 530e93414a
7 changed files with 84 additions and 6 deletions

View File

@ -3,8 +3,6 @@
PREP(abort); PREP(abort);
PREP(config); PREP(config);
PREP(convertFOS); PREP(convertFOS);
PREP(modeDistanceAzimuth);
PREP(modeDistanceHeight);
PREP(modeFallOfShort); PREP(modeFallOfShort);
PREP(modeRelativeAzimuthDistance); PREP(modeRelativeAzimuthDistance);
PREP(modeRelativeDistance); PREP(modeRelativeDistance);
@ -18,12 +16,14 @@ PREP(convertToTexturesDegree);
PREP(convertToTexturesDistance); PREP(convertToTexturesDistance);
PREP(getDirection); PREP(getDirection);
PREP(getDistance); PREP(getDistance);
PREP(getHeightDistance);
PREP(onKeyDown); PREP(onKeyDown);
PREP(onKeyHold); PREP(onKeyHold);
PREP(onKeyUp); PREP(onKeyUp);
PREP(showAzimuth); PREP(showAzimuth);
PREP(showAzimuthInclination); PREP(showAzimuthInclination);
PREP(showCenter); PREP(showCenter);
PREP(showHeightDistance);
PREP(showDistance); PREP(showDistance);
GVAR(holdKeyHandler) = -1; GVAR(holdKeyHandler) = -1;

View File

@ -13,6 +13,8 @@ _dlgVector = GETUVAR(ACE_dlgVector, displayNull);
] ]
*/ */
#define MAX_ABSINCLINATION 45
private ["_position", "_direction", "_azimuth", "_inclination"]; private ["_position", "_direction", "_azimuth", "_inclination"];
_position = ATLToASL positionCameraToWorld [0,0,0]; _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)); _inclination = asin ((_direction select 2) - (_position select 2));
if (_azimuth < 0) then {_azimuth = _azimuth + 360}; if (_azimuth < 0) then {_azimuth = _azimuth + 360};
if (abs _inclination > MAX_ABSINCLINATION) then {_inclination = -1000};
[_azimuth, _inclination] [_azimuth, _inclination]

View File

@ -11,7 +11,7 @@ _dlgVector = GETUVAR(ACE_dlgVector,displayNull);
_distance = ctrlText (_dlgVector displayCtrl 151); _distance = ctrlText (_dlgVector displayCtrl 151);
if (_distance == "----") exitWith {-1}; if (_distance == "----") exitWith {-1000};
_distance = round parseNumber _distance; _distance = round parseNumber _distance;
@ -19,7 +19,7 @@ if (GVAR(useFeet)) then {
_distance = 3.28084 * _distance; _distance = 3.28084 * _distance;
}; };
if (_distance > MAX_DISTANCE) exitWith {-1}; if (_distance > MAX_DISTANCE) exitWith {-1000};
if (_distance < MIN_DISTANCE) exitWith {-1}; if (_distance < MIN_DISTANCE) exitWith {-1000};
_distance _distance

View File

@ -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]

View File

@ -46,7 +46,7 @@ switch (_this select 0) do {
GVAR(isKeyDownDistance) = true; GVAR(isKeyDownDistance) = true;
if (diag_tickTime < GVAR(keyDownTimeDistance) + 0.5) exitWith { if (diag_tickTime < GVAR(keyDownTimeDistance) + 0.5) exitWith {
//"azimuth+inclination" call _fnc_setPFH; "height+distance" call _fnc_setPFH;
}; };
GVAR(keyDownTimeDistance) = diag_tickTime; GVAR(keyDownTimeDistance) = diag_tickTime;

View File

@ -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);// systemChat str (_this select 0);//

View File

@ -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);