2015-01-15 06:18:57 +00:00
|
|
|
/*
|
|
|
|
|
|
|
|
by commy2
|
|
|
|
|
|
|
|
Handles pressing the special vector keys.
|
|
|
|
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-01-15 15:21:47 +00:00
|
|
|
private "_fnc_setPFH";
|
|
|
|
_fnc_setPFH = {
|
|
|
|
if (GVAR(holdKeyHandler) > -1) then {
|
|
|
|
[GVAR(holdKeyHandler)] call CBA_fnc_removePerFrameHandler;
|
|
|
|
GVAR(holdKeyHandler) = -1;
|
|
|
|
};
|
|
|
|
|
2015-01-21 20:15:51 +00:00
|
|
|
GVAR(currentMode) = _this;
|
2015-01-15 15:21:47 +00:00
|
|
|
GVAR(holdKeyHandler) = [FUNC(onKeyHold), 0, _this] call CBA_fnc_addPerFrameHandler;
|
|
|
|
};
|
|
|
|
|
2015-01-15 06:18:57 +00:00
|
|
|
switch (_this select 0) do {
|
|
|
|
case ("azimuth"): {
|
2015-01-21 21:52:39 +00:00
|
|
|
GVAR(keyDownTabCountDistance) = 0;
|
2015-01-15 06:18:57 +00:00
|
|
|
|
2015-01-21 20:15:51 +00:00
|
|
|
// handle input in option menu
|
|
|
|
if (GVAR(currentMode) == "settings") exitWith {
|
2015-01-21 21:52:39 +00:00
|
|
|
if (diag_tickTime < GVAR(keyDownTimeMenu) + 1) exitWith {};
|
2015-01-21 20:15:51 +00:00
|
|
|
|
|
|
|
if (diag_tickTime < GVAR(keyDownTimeAzimuth) + 0.5) then {
|
|
|
|
GVAR(keyDownTabCountAzimuth) = (GETGVAR(keyDownTabCountAzimuth,0)) + 1;
|
|
|
|
} else {
|
|
|
|
GVAR(keyDownTabCountAzimuth) = 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
GVAR(keyDownTimeAzimuth) = diag_tickTime;
|
|
|
|
};
|
|
|
|
|
|
|
|
if (GVAR(currentMode) == "config") exitWith {
|
|
|
|
if (diag_tickTime < GVAR(keyDownTimeMenu) + 0.5) exitWith {};
|
|
|
|
|
2015-01-21 21:52:39 +00:00
|
|
|
["config"] call FUNC(nextMode);
|
2015-01-21 20:15:51 +00:00
|
|
|
};
|
|
|
|
|
2015-01-17 18:25:12 +00:00
|
|
|
// prevent additinal modifier input if advanced mode it set, spaghetti
|
|
|
|
if (GETGVAR(isKeyDownDistance,false) && {GETGVAR(currentMode,"") in ["relative_distance", "relative_height+length"]}) exitWith {};
|
2015-01-16 00:48:43 +00:00
|
|
|
|
2015-01-15 15:40:06 +00:00
|
|
|
["azimuth"] call FUNC(clearDisplay);
|
|
|
|
|
2015-01-15 06:18:57 +00:00
|
|
|
GVAR(isKeyDownAzimuth) = true;
|
2015-01-16 00:48:43 +00:00
|
|
|
[false] call FUNC(showP1);
|
2015-01-15 15:40:06 +00:00
|
|
|
|
2015-01-20 17:26:31 +00:00
|
|
|
// handle 5 times clicking
|
|
|
|
if (diag_tickTime < GVAR(keyDownTimeAzimuth) + 0.5) then {
|
|
|
|
GVAR(keyDownTabCountAzimuth) = (GETGVAR(keyDownTabCountAzimuth,0)) + 1;
|
|
|
|
GVAR(keyDownTimeAzimuth) = diag_tickTime;
|
|
|
|
} else {
|
|
|
|
GVAR(keyDownTabCountAzimuth) = 1;
|
|
|
|
};
|
|
|
|
|
2015-01-21 20:15:51 +00:00
|
|
|
// open settings menu
|
2015-01-20 17:26:31 +00:00
|
|
|
if (GVAR(keyDownTabCountAzimuth) == 5) exitWith {
|
2015-01-21 20:15:51 +00:00
|
|
|
GVAR(keyDownTimeMenu) = diag_tickTime;
|
|
|
|
GVAR(keyDownTimeAzimuth) = diag_tickTime;
|
|
|
|
GVAR(keyDownTabCountAzimuth) = 0;
|
2015-01-21 21:52:39 +00:00
|
|
|
GVAR(configTemp) = [GVAR(useFeet), GVAR(useMil)];
|
2015-01-21 20:15:51 +00:00
|
|
|
["settings"] call FUNC(showText);
|
|
|
|
"settings" call _fnc_setPFH;
|
2015-01-20 17:26:31 +00:00
|
|
|
};
|
|
|
|
|
2015-01-15 15:40:06 +00:00
|
|
|
if (diag_tickTime < GVAR(keyDownTimeAzimuth) + 0.5) exitWith {
|
|
|
|
"azimuth+inclination" call _fnc_setPFH;
|
|
|
|
};
|
|
|
|
|
2015-01-15 06:18:57 +00:00
|
|
|
GVAR(keyDownTimeAzimuth) = diag_tickTime;
|
|
|
|
|
2015-01-15 15:21:47 +00:00
|
|
|
if (diag_tickTime > GVAR(keyDownTimeDistance) + 0.5) then {
|
2015-01-16 00:48:43 +00:00
|
|
|
if !(GETGVAR(isKeyDownDistance,false)) then {
|
|
|
|
["distance"] call FUNC(clearDisplay);
|
|
|
|
"azimuth" call _fnc_setPFH;
|
2015-01-15 18:01:27 +00:00
|
|
|
};
|
2015-01-15 15:21:47 +00:00
|
|
|
} else {
|
2015-01-17 21:49:06 +00:00
|
|
|
if (GETGVAR(isKeyDownDistance,false)) then {
|
|
|
|
"azimuth+distance" call _fnc_setPFH;
|
|
|
|
} else {
|
|
|
|
["distance"] call FUNC(clearDisplay);
|
|
|
|
"azimuth" call _fnc_setPFH;
|
|
|
|
};
|
2015-01-15 15:21:47 +00:00
|
|
|
};
|
|
|
|
|
2015-01-15 06:18:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
case ("distance"): {
|
2015-01-21 21:52:39 +00:00
|
|
|
GVAR(keyDownTabCountAzimuth) = 0;
|
2015-01-15 06:18:57 +00:00
|
|
|
|
2015-01-21 20:15:51 +00:00
|
|
|
// handle input in option menu
|
|
|
|
if (GVAR(currentMode) == "config") exitWith {
|
|
|
|
if (diag_tickTime < GVAR(keyDownTimeMenu) + 0.5) exitWith {};
|
|
|
|
|
|
|
|
if (diag_tickTime < GVAR(keyDownTimeDistance) + 0.5) then {
|
|
|
|
GVAR(keyDownTabCountDistance) = (GETGVAR(keyDownTabCountDistance,0)) + 1;
|
|
|
|
} else {
|
|
|
|
GVAR(keyDownTabCountDistance) = 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
GVAR(keyDownTimeDistance) = diag_tickTime;
|
|
|
|
};
|
|
|
|
|
|
|
|
if (GVAR(currentMode) == "settings") exitWith {
|
|
|
|
if (diag_tickTime < GVAR(keyDownTimeMenu) + 0.5) exitWith {};
|
|
|
|
|
2015-01-21 21:52:39 +00:00
|
|
|
["settings"] call FUNC(nextMode);
|
2015-01-21 20:15:51 +00:00
|
|
|
};
|
|
|
|
|
2015-01-17 18:25:12 +00:00
|
|
|
// prevent additinal modifier input if advanced mode it set, spaghetti
|
|
|
|
if (GETGVAR(isKeyDownAzimuth,false) && {GETGVAR(currentMode,"") in ["relative_azimuth+distance", "fall_of_short"]}) exitWith {};
|
2015-01-16 00:48:43 +00:00
|
|
|
|
2015-01-17 21:49:06 +00:00
|
|
|
// toggle fos values
|
|
|
|
if (GETGVAR(currentMode,"") == "fall_of_short") exitWith {
|
|
|
|
[!(GETGVAR(FOSState,true))] call FUNC(showFallOfShort);
|
|
|
|
};
|
|
|
|
|
2015-01-15 15:40:06 +00:00
|
|
|
["distance"] call FUNC(clearDisplay);
|
|
|
|
|
2015-01-15 06:18:57 +00:00
|
|
|
GVAR(isKeyDownDistance) = true;
|
2015-01-16 00:48:43 +00:00
|
|
|
[false] call FUNC(showP1);
|
2015-01-15 15:40:06 +00:00
|
|
|
|
2015-01-20 17:26:31 +00:00
|
|
|
// handle 5 times clicking
|
|
|
|
if (diag_tickTime < GVAR(keyDownTimeDistance) + 0.5) then {
|
|
|
|
GVAR(keyDownTabCountDistance) = (GETGVAR(keyDownTabCountDistance,0)) + 1;
|
|
|
|
GVAR(keyDownTimeDistance) = diag_tickTime;
|
|
|
|
} else {
|
|
|
|
GVAR(keyDownTabCountDistance) = 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
// open config menu
|
|
|
|
if (GVAR(keyDownTabCountDistance) == 5) exitWith {
|
2015-01-21 20:15:51 +00:00
|
|
|
GVAR(keyDownTimeMenu) = diag_tickTime;
|
|
|
|
GVAR(keyDownTimeDistance) = diag_tickTime;
|
|
|
|
GVAR(keyDownTabCountDistance) = 0;
|
2015-01-21 21:52:39 +00:00
|
|
|
GVAR(configTemp) = GVAR(modeReticle);
|
2015-01-21 20:15:51 +00:00
|
|
|
["config"] call FUNC(showText);
|
|
|
|
"config" call _fnc_setPFH;
|
2015-01-20 17:26:31 +00:00
|
|
|
};
|
|
|
|
|
2015-01-15 15:40:06 +00:00
|
|
|
if (diag_tickTime < GVAR(keyDownTimeDistance) + 0.5) exitWith {
|
2015-01-15 16:24:19 +00:00
|
|
|
"height+distance" call _fnc_setPFH;
|
2015-01-15 15:40:06 +00:00
|
|
|
};
|
|
|
|
|
2015-01-15 06:18:57 +00:00
|
|
|
GVAR(keyDownTimeDistance) = diag_tickTime;
|
|
|
|
|
2015-01-15 15:21:47 +00:00
|
|
|
if (diag_tickTime > GVAR(keyDownTimeAzimuth) + 0.5) then {
|
2015-01-16 00:48:43 +00:00
|
|
|
if !(GETGVAR(isKeyDownAzimuth,false)) then {
|
|
|
|
["azimuth"] call FUNC(clearDisplay);
|
2015-01-17 21:49:06 +00:00
|
|
|
"distance" call _fnc_setPFH;
|
2015-01-15 18:01:27 +00:00
|
|
|
};
|
2015-01-15 15:21:47 +00:00
|
|
|
} else {
|
2015-01-17 21:49:06 +00:00
|
|
|
if (GETGVAR(isKeyDownAzimuth,false)) then {
|
|
|
|
"azimuth+distance" call _fnc_setPFH;
|
|
|
|
} else {
|
|
|
|
["azimuth"] call FUNC(clearDisplay);
|
|
|
|
"distance" call _fnc_setPFH;
|
|
|
|
};
|
2015-01-15 15:21:47 +00:00
|
|
|
};
|
|
|
|
|
2015-01-15 06:18:57 +00:00
|
|
|
};
|
|
|
|
};
|