2015-01-15 06:18:57 +00:00
|
|
|
/*
|
|
|
|
|
|
|
|
by commy2
|
|
|
|
|
|
|
|
Handles pressing the special vector keys.
|
|
|
|
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-01-21 22:05:19 +00:00
|
|
|
// set vector config settings
|
|
|
|
switch (GVAR(modeReticle)) do {
|
|
|
|
case (0): {
|
|
|
|
[false] call FUNC(adjustBrightness);
|
|
|
|
[false] call FUNC(showReticle);
|
|
|
|
};
|
|
|
|
case (1): {
|
|
|
|
[false] call FUNC(adjustBrightness);
|
|
|
|
[true] call FUNC(showReticle);
|
|
|
|
};
|
|
|
|
case (2): {
|
|
|
|
[true] call FUNC(adjustBrightness);
|
|
|
|
[true] call FUNC(showReticle);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
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-05-21 16:42:44 +00:00
|
|
|
if (ACE_diagTime < GVAR(keyDownTimeMenu) + 1) exitWith {};
|
2015-01-21 20:15:51 +00:00
|
|
|
|
2015-05-21 16:42:44 +00:00
|
|
|
if (ACE_diagTime < GVAR(keyDownTimeAzimuth) + 0.5) then {
|
2015-01-21 20:15:51 +00:00
|
|
|
GVAR(keyDownTabCountAzimuth) = (GETGVAR(keyDownTabCountAzimuth,0)) + 1;
|
|
|
|
} else {
|
|
|
|
GVAR(keyDownTabCountAzimuth) = 1;
|
|
|
|
};
|
|
|
|
|
2015-05-21 16:42:44 +00:00
|
|
|
GVAR(keyDownTimeAzimuth) = ACE_diagTime;
|
2015-01-21 20:15:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (GVAR(currentMode) == "config") exitWith {
|
2015-05-21 16:42:44 +00:00
|
|
|
if (ACE_diagTime < GVAR(keyDownTimeMenu) + 0.5) exitWith {};
|
2015-01-21 20:15:51 +00:00
|
|
|
|
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
|
2015-05-21 16:42:44 +00:00
|
|
|
if (ACE_diagTime < GVAR(keyDownTimeAzimuth) + 0.5) then {
|
2015-01-20 17:26:31 +00:00
|
|
|
GVAR(keyDownTabCountAzimuth) = (GETGVAR(keyDownTabCountAzimuth,0)) + 1;
|
2015-05-21 16:42:44 +00:00
|
|
|
GVAR(keyDownTimeAzimuth) = ACE_diagTime;
|
2015-01-20 17:26:31 +00:00
|
|
|
} 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-05-21 16:42:44 +00:00
|
|
|
GVAR(keyDownTimeMenu) = ACE_diagTime;
|
|
|
|
GVAR(keyDownTimeAzimuth) = ACE_diagTime;
|
2015-01-21 20:15:51 +00:00
|
|
|
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-05-21 16:42:44 +00:00
|
|
|
if (ACE_diagTime < GVAR(keyDownTimeAzimuth) + 0.5) exitWith {
|
2015-01-15 15:40:06 +00:00
|
|
|
"azimuth+inclination" call _fnc_setPFH;
|
|
|
|
};
|
|
|
|
|
2015-05-21 16:42:44 +00:00
|
|
|
GVAR(keyDownTimeAzimuth) = ACE_diagTime;
|
2015-01-15 06:18:57 +00:00
|
|
|
|
2015-05-21 16:42:44 +00:00
|
|
|
if (ACE_diagTime > 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 {
|
2015-05-21 16:42:44 +00:00
|
|
|
if (ACE_diagTime < GVAR(keyDownTimeMenu) + 0.5) exitWith {};
|
2015-01-21 20:15:51 +00:00
|
|
|
|
2015-05-21 16:42:44 +00:00
|
|
|
if (ACE_diagTime < GVAR(keyDownTimeDistance) + 0.5) then {
|
2015-01-21 20:15:51 +00:00
|
|
|
GVAR(keyDownTabCountDistance) = (GETGVAR(keyDownTabCountDistance,0)) + 1;
|
|
|
|
} else {
|
|
|
|
GVAR(keyDownTabCountDistance) = 1;
|
|
|
|
};
|
|
|
|
|
2015-05-21 16:42:44 +00:00
|
|
|
GVAR(keyDownTimeDistance) = ACE_diagTime;
|
2015-01-21 20:15:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (GVAR(currentMode) == "settings") exitWith {
|
2015-05-21 16:42:44 +00:00
|
|
|
if (ACE_diagTime < GVAR(keyDownTimeMenu) + 0.5) exitWith {};
|
2015-01-21 20:15:51 +00:00
|
|
|
|
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
|
2015-04-05 20:18:28 +00:00
|
|
|
if (GETGVAR(isKeyDownAzimuth,false) && {GETGVAR(currentMode,"") in ["relative_azimuth+distance", "fall_of_shot"]}) exitWith {};
|
2015-01-16 00:48:43 +00:00
|
|
|
|
2015-01-17 21:49:06 +00:00
|
|
|
// toggle fos values
|
2015-04-05 20:18:28 +00:00
|
|
|
if (GETGVAR(currentMode,"") == "fall_of_shot") exitWith {
|
|
|
|
[!(GETGVAR(FOSState,true))] call FUNC(showFallOfShot);
|
2015-01-17 21:49:06 +00:00
|
|
|
};
|
|
|
|
|
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
|
2015-05-21 16:42:44 +00:00
|
|
|
if (ACE_diagTime < GVAR(keyDownTimeDistance) + 0.5) then {
|
2015-01-20 17:26:31 +00:00
|
|
|
GVAR(keyDownTabCountDistance) = (GETGVAR(keyDownTabCountDistance,0)) + 1;
|
2015-05-21 16:42:44 +00:00
|
|
|
GVAR(keyDownTimeDistance) = ACE_diagTime;
|
2015-01-20 17:26:31 +00:00
|
|
|
} else {
|
|
|
|
GVAR(keyDownTabCountDistance) = 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
// open config menu
|
|
|
|
if (GVAR(keyDownTabCountDistance) == 5) exitWith {
|
2015-05-21 16:42:44 +00:00
|
|
|
GVAR(keyDownTimeMenu) = ACE_diagTime;
|
|
|
|
GVAR(keyDownTimeDistance) = ACE_diagTime;
|
2015-01-21 20:15:51 +00:00
|
|
|
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-05-21 16:42:44 +00:00
|
|
|
if (ACE_diagTime < 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-05-21 16:42:44 +00:00
|
|
|
GVAR(keyDownTimeDistance) = ACE_diagTime;
|
2015-01-15 06:18:57 +00:00
|
|
|
|
2015-05-21 16:42:44 +00:00
|
|
|
if (ACE_diagTime > 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
|
|
|
};
|
|
|
|
};
|