get the vector to work, wip

This commit is contained in:
commy2 2015-01-15 07:18:57 +01:00
parent d281caffbe
commit bc43ee5136
42 changed files with 417 additions and 374 deletions

View File

@ -189,14 +189,14 @@
#define SETVAR_SYS(var1,var2) setVariable [ARR_2(QUOTE(var1),var2)] #define SETVAR_SYS(var1,var2) setVariable [ARR_2(QUOTE(var1),var2)]
#define SETPVAR_SYS(var1,var2) setVariable [ARR_3(QUOTE(var1),var2,true)] #define SETPVAR_SYS(var1,var2) setVariable [ARR_3(QUOTE(var1),var2,true)]
#define GETVAR(var1,var2,var3) (var1 GETVAR_SYS(var2,var3)) #define GETVAR(var1,var2,var3) var1 GETVAR_SYS(var2,var3)
#define GETMVAR(var1,var2) (missionNamespace GETVAR_SYS(var1,var2)) #define GETMVAR(var1,var2) missionNamespace GETVAR_SYS(var1,var2)
#define GETUVAR(var1,var2) (uiNamespace GETVAR_SYS(var1,var2)) #define GETUVAR(var1,var2) uiNamespace GETVAR_SYS(var1,var2)
#define SETVAR(var1,var2,var3) (var1 SETVAR_SYS(var2,var3)) #define SETVAR(var1,var2,var3) var1 SETVAR_SYS(var2,var3)
#define SETPVAR(var1,var2,var3) (var1 SETPVAR_SYS(var2,var3)) #define SETPVAR(var1,var2,var3) var1 SETPVAR_SYS(var2,var3)
#define SETMVAR(var1,var2) (missionNamespace SETVAR_SYS(var1,var2)) #define SETMVAR(var1,var2) missionNamespace SETVAR_SYS(var1,var2)
#define SETUVAR(var1,var2) (uiNamespace SETVAR_SYS(var1,var2)) #define SETUVAR(var1,var2) uiNamespace SETVAR_SYS(var1,var2)
#ifdef DISABLE_COMPILE_CACHE #ifdef DISABLE_COMPILE_CACHE

View File

@ -11,7 +11,7 @@ class RscControlsGroup {
class RscInGameUI { class RscInGameUI {
class RscUnitInfo; class RscUnitInfo;
class ACE_RscOptics_vector: RscUnitInfo { class ACE_RscOptics_vector: RscUnitInfo {
onLoad = "[""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable ['ACE_dlgVectorOptics', _this select 0];"; onLoad = "[""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; uiNamespace setVariable ['ACE_dlgVector', _this select 0];";
onUnload = "[""onUnload"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; onUnload = "[""onUnload"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""";
idd = 300; idd = 300;
controls[] = {"CA_Distance","CA_Heading","CA_OpticsPitch","CA_Elev","CA_OpticsZoom","CA_VisionMode","ACE_ScriptedDisplayControlsGroup"}; controls[] = {"CA_Distance","CA_Heading","CA_OpticsPitch","CA_Elev","CA_OpticsZoom","CA_VisionMode","ACE_ScriptedDisplayControlsGroup"};

View File

@ -2,14 +2,7 @@
PREP(abort); PREP(abort);
PREP(config); PREP(config);
PREP(convertDegree);
PREP(convertDistance);
PREP(convertFOS); PREP(convertFOS);
PREP(getDirection);
PREP(getDistance);
PREP(modeAzimuth);
PREP(modeAzimuthInclination);
PREP(modeDistance);
PREP(modeDistanceAzimuth); PREP(modeDistanceAzimuth);
PREP(modeDistanceHeight); PREP(modeDistanceHeight);
PREP(modeFallOfShort); PREP(modeFallOfShort);
@ -19,3 +12,22 @@ PREP(modeRelativeDistanceHeight);
PREP(settings); PREP(settings);
PREP(tabAzimuthKey); PREP(tabAzimuthKey);
PREP(tabDistanceKey); PREP(tabDistanceKey);
PREP(clearDisplay);
PREP(convertToTexturesDegree);
PREP(convertToTexturesDistance);
PREP(getDirection);
PREP(getDistance);
PREP(onKeyDown);
PREP(onKeyHold);
PREP(onKeyUp);
PREP(showAzimuth);
PREP(showCenter);
PREP(showDistance);
GVAR(isKeyDownAzimuth) = false;
GVAR(isKeyDownDistance) = false;
GVAR(keyDownTimeAzimuth) = -1;
GVAR(keyDownTimeDistance) = -1;
GVAR(useMil) = false;
GVAR(useFeet) = false;

View File

@ -16,29 +16,30 @@ class CfgPatches {
#include "CfgVehicles.hpp" #include "CfgVehicles.hpp"
#include "CfgWeapons.hpp" #include "CfgWeapons.hpp"
/*class AGM_Default_Keys { class ACE_Default_Keys {
class vectorAzimuth { class vectorAzimuth {
displayName = "$STR_AGM_Vector_AzimuthKey"; displayName = "$STR_ACE_Vector_AzimuthKey";
condition = "currentWeapon player == 'AGM_Vector' && {_vehicle == player} && {cameraView == 'Gunner'}"; condition = QUOTE(currentWeapon player == 'ACE_Vector' && {_vehicle == player} && {cameraView == 'GUNNER'});
statement = "AGM_vectorKey set [0, true]; if (AGM_isVectorReady) then {AGM_isVectorReady = false; AGM_Vector_scriptHandle = 0 spawn AGM_Vector_fnc_tabAzimuthKey; 0 spawn AGM_Vector_fnc_abort;};"; statement = QUOTE(['azimuth'] call FUNC(onKeyDown));
conditionUp = "true"; conditionUp = QUOTE(true);
statementUp = "AGM_vectorKey set [0, false];"; statementUp = QUOTE(['azimuth'] call FUNC(onKeyUp));
key = 15; key = 15;
shift = 0; shift = 0;
control = 0; control = 0;
alt = 0; alt = 0;
}; };
class vectorDistance { class vectorDistance {
displayName = "$STR_AGM_Vector_DistanceKey"; displayName = "$STR_ACE_Vector_DistanceKey";
condition = "currentWeapon player == 'AGM_Vector' && {_vehicle == player} && {cameraView == 'Gunner'}"; condition = QUOTE(currentWeapon player == 'ACE_Vector' && {_vehicle == player} && {cameraView == 'GUNNER'});
statement = "AGM_vectorKey set [1, true]; if (AGM_isVectorReady) then {AGM_isVectorReady = false; AGM_Vector_scriptHandle = 0 spawn AGM_Vector_fnc_tabDistanceKey; 0 spawn AGM_Vector_fnc_abort;};"; statement = QUOTE(['distance'] call FUNC(onKeyDown));
conditionUp = "true"; conditionUp = QUOTE(true);
statementUp = "AGM_vectorKey set [1, false];"; statementUp = QUOTE(['distance'] call FUNC(onKeyUp));
key = 19; key = 19;
shift = 0; shift = 0;
control = 0; control = 0;
alt = 0; alt = 0;
}; };
};*/ };
#include "RscInGameUI.hpp" #include "RscInGameUI.hpp"

View File

@ -0,0 +1,43 @@
/*
by commy2
Clears the vectors control items.
*/
#include "script_component.hpp"
private "_dlgVector";
disableSerialization;
_dlgVector = GETUVAR(ACE_dlgVector,displayNull);
switch (_this select 0) do {
case ("azimuth"): {
private ["_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8"];
_ctrlDigit5 = _dlgVector displayCtrl 1315;
_ctrlDigit6 = _dlgVector displayCtrl 1316;
_ctrlDigit7 = _dlgVector displayCtrl 1317;
_ctrlDigit8 = _dlgVector displayCtrl 1318;
_ctrlDigit5 ctrlSetText "";
_ctrlDigit6 ctrlSetText "";
_ctrlDigit7 ctrlSetText "";
_ctrlDigit8 ctrlSetText "";
};
case ("distance"): {
private ["_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4"];
_ctrlDigit1 = _dlgVector displayCtrl 1311;
_ctrlDigit2 = _dlgVector displayCtrl 1312;
_ctrlDigit3 = _dlgVector displayCtrl 1313;
_ctrlDigit4 = _dlgVector displayCtrl 1314;
_ctrlDigit1 ctrlSetText "";
_ctrlDigit2 ctrlSetText "";
_ctrlDigit3 ctrlSetText "";
_ctrlDigit4 ctrlSetText "";
};
};

View File

@ -1,67 +0,0 @@
/*
BWA3 script, by commy2
this code is property of the ArmA 3 Bundeswehr modification
ask us nicely at http://www.bwmod.de/ if you want to re-use any of this script
we don't support changed code based on this work
*/
#include "script_component.hpp"
private["_number", "_return", "_isNegative", "_digit1", "_digit2", "_digit3", "_digit4"];
_number = _this;
_return = [];
if (AGM_vectorSettings select 2) then {
_number = round (6400 / 360 * _number);
if (_number == 6400) then {_number = 0};
_return = _number call AGM_Vector_fnc_convertDistance;
} else {
_number = round _number;
_isNegative = if (_number < 0) then {true} else {false};
_number = abs _number;
if (_number == 360) then {_number = 0};
_digit1 = floor (_number / 100);
_digit2 = floor (_number / 10) - _digit1 * 10;
_digit3 = _number mod 10;
_digit4 = "\AGM_Vector\rsc\do.paa";
if (_isNegative) then {
if (_digit1 == 0) then {
if (_digit2 == 0) then {
_digit1 = "";
_digit2 = "\AGM_Vector\rsc\d-.paa";
_digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit3];
} else {
_digit1 = "\AGM_Vector\rsc\d-.paa";
_digit2 = format["\AGM_Vector\rsc\d%1.paa", _digit2];
_digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit3];
};
} else {
_digit1 = "\AGM_Vector\rsc\d-.paa";
_digit2 = "\AGM_Vector\rsc\d-.paa";
_digit3 = "\AGM_Vector\rsc\d-.paa";
_digit4 = "\AGM_Vector\rsc\d-.paa";
};
} else {
if (_digit1 == 0) then {
if (_digit2 == 0) then {
_digit1 = "";
_digit2 = "";
_digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit3];
} else {
_digit1 = "";
_digit2 = format["\AGM_Vector\rsc\d%1.paa", _digit2];
_digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit3];
};
} else {
_digit1 = format["\AGM_Vector\rsc\d%1.paa", _digit1];
_digit2 = format["\AGM_Vector\rsc\d%1.paa", _digit2];
_digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit3];
};
};
_return = [_digit1, _digit2, _digit3, _digit4];
};
_return

View File

@ -1,85 +0,0 @@
/*
BWA3 script, by commy2
this code is property of the ArmA 3 Bundeswehr modification
ask us nicely at http://www.bwmod.de/ if you want to re-use any of this script
we don't support changed code based on this work
*/
#include "script_component.hpp"
private["_number", "_isNegative", "_digit1", "_digit2", "_digit3", "_digit4"];
_number = _this;
_number = round _number;
_isNegative = if (_number < 0) then {true} else {false};
_number = abs _number;
if (_number >= 10000) exitWith {
[
"\AGM_Vector\rsc\d-.paa",
"\AGM_Vector\rsc\d-.paa",
"\AGM_Vector\rsc\d-.paa",
"\AGM_Vector\rsc\d-.paa"
]
};
_digit1 = floor (_number / 1000);
_digit2 = floor (_number / 100) - _digit1 * 10;
_digit3 = floor (_number / 10) - _digit1 * 100 - _digit2 * 10;
_digit4 = _number mod 10;
if (_isNegative) then {
if (_digit1 == 0) then {
if (_digit2 == 0) then {
if (_digit3 == 0) then {
_digit1 = "";
_digit2 = "";
_digit3 = "\AGM_Vector\rsc\d-.paa";
_digit4 = format["\AGM_Vector\rsc\d%1.paa", _digit4];
} else {
_digit1 = "";
_digit2 = "\AGM_Vector\rsc\d-.paa";
_digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit3];
_digit4 = format["\AGM_Vector\rsc\d%1.paa", _digit4];
};
} else {
_digit1 = "\AGM_Vector\rsc\d-.paa";
_digit2 = format["\AGM_Vector\rsc\d%1.paa", _digit2];
_digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit3];
_digit4 = format["\AGM_Vector\rsc\d%1.paa", _digit4];
};
} else {
_digit1 = "\AGM_Vector\rsc\d-.paa";
_digit2 = "\AGM_Vector\rsc\d-.paa";
_digit3 = "\AGM_Vector\rsc\d-.paa";
_digit4 = "\AGM_Vector\rsc\d-.paa";
};
} else {
if (_digit1 == 0) then {
if (_digit2 == 0) then {
if (_digit3 == 0) then {
_digit1 = "";
_digit2 = "";
_digit3 = "";
_digit4 = format["\AGM_Vector\rsc\d%1.paa", _digit4];
} else {
_digit1 = "";
_digit2 = "";
_digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit3];
_digit4 = format["\AGM_Vector\rsc\d%1.paa", _digit4];
};
} else {
_digit1 = "";
_digit2 = format["\AGM_Vector\rsc\d%1.paa", _digit2];
_digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit3];
_digit4 = format["\AGM_Vector\rsc\d%1.paa", _digit4];
};
} else {
_digit1 = format["\AGM_Vector\rsc\d%1.paa", _digit1];
_digit2 = format["\AGM_Vector\rsc\d%1.paa", _digit2];
_digit3 = format["\AGM_Vector\rsc\d%1.paa", _digit3];
_digit4 = format["\AGM_Vector\rsc\d%1.paa", _digit4];
};
};
[_digit1, _digit2, _digit3, _digit4]

View File

@ -1,3 +0,0 @@
// by commy2
3.28084 * (_this select 0)

View File

@ -0,0 +1,77 @@
/* by commy2
converts azimuth into array of textures for the vectors scripted info control
*/
#include "script_component.hpp"
private "_number";
_number = _this select 0;
if (GVAR(useMil)) then {
_number = round (6400 / 360 * _number);
if (_number == 6400) then {_number = 0};
[_number] call FUNC(convertToTexturesDistance) // return
} else {
_number = round _number;
private "_isNegative";
_isNegative = _number < 0;
_number = abs _number;
if (_number == 360) then {_number = 0};
private ["_digit1", "_digit2", "_digit3", "_digit4"];
_digit1 = floor (_number / 100);
_digit2 = floor (_number / 10) - _digit1 * 10;
_digit3 = _number mod 10;
_digit4 = QUOTE(PATHTOF(rsc\vector_degree.paa));
if (_isNegative) then {
if (_digit1 == 0) then {
if (_digit2 == 0) then {
_digit1 = "";
_digit2 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
} else {
_digit1 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2];
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
};
} else {
_digit1 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit2 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit3 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit4 = QUOTE(PATHTOF(rsc\vector_minus.paa));
};
} else {
if (_digit1 == 0) then {
if (_digit2 == 0) then {
_digit1 = "";
_digit2 = "";
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
} else {
_digit1 = "";
_digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2];
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
};
} else {
_digit1 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit1];
_digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2];
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
};
};
[_digit1, _digit2, _digit3, _digit4] // return
}

View File

@ -0,0 +1,86 @@
/* by commy2
converts rangefinder distance into array of textures for the vectors scripted info control
*/
#include "script_component.hpp"
private ["_number", "_isNegative"];
_number = _this select 0;
_number = round _number;
_isNegative = _number < 0;
_number = abs _number;
if (_number >= 10000) exitWith {
[QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa))] // return
};
private ["_digit1", "_digit2", "_digit3", "_digit4"];
_digit1 = floor (_number / 1000);
_digit2 = floor (_number / 100) - _digit1 * 10;
_digit3 = floor (_number / 10) - _digit1 * 100 - _digit2 * 10;
_digit4 = _number mod 10;
if (_isNegative) then {
if (_digit1 == 0) then {
if (_digit2 == 0) then {
if (_digit3 == 0) then {
_digit1 = "";
_digit2 = "";
_digit3 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
} else {
_digit1 = "";
_digit2 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
_digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
};
} else {
_digit1 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2];
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
_digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
};
} else {
_digit1 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit2 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit3 = QUOTE(PATHTOF(rsc\vector_minus.paa));
_digit4 = QUOTE(PATHTOF(rsc\vector_minus.paa));
};
} else {
if (_digit1 == 0) then {
if (_digit2 == 0) then {
if (_digit3 == 0) then {
_digit1 = "";
_digit2 = "";
_digit3 = "";
_digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
} else {
_digit1 = "";
_digit2 = "";
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
_digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
};
} else {
_digit1 = "";
_digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2];
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
_digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
};
} else {
_digit1 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit1];
_digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2];
_digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3];
_digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4];
};
};
[_digit1, _digit2, _digit3, _digit4]

View File

@ -1,12 +1,26 @@
// by commy2 // by commy2
#include "script_component.hpp" #include "script_component.hpp"
/*
private "_dlgVector"; private "_dlgVector";
disableSerialization; disableSerialization;
_dlgVector = uiNamespace getVariable ["AGM_dlgVector", displayNull]; _dlgVector = GETUVAR(ACE_dlgVector, displayNull);
[ [
round parseNumber ctrlText (_dlgVector displayCtrl 156), round parseNumber ctrlText (_dlgVector displayCtrl 156),
round parseNumber ctrlText (_dlgVector displayCtrl 182) round parseNumber ctrlText (_dlgVector displayCtrl 182)
] ]
*/
private ["_position", "_direction", "_azimuth", "_inclination"];
_position = ATLToASL positionCameraToWorld [0,0,0];
_direction = ATLToASL positionCameraToWorld [0,0,1];
_azimuth = ((_direction select 0) - (_position select 0)) atan2 ((_direction select 1) - (_position select 1));
_inclination = asin ((_direction select 2) - (_position select 2));
if (_azimuth < 0) then {_azimuth = _azimuth + 360};
[_azimuth, _inclination]

View File

@ -2,12 +2,12 @@
#include "script_component.hpp" #include "script_component.hpp"
#define MIN_DISTANCE 10 #define MIN_DISTANCE 10
#define MAX_DISTANCE ([6000, 9000] select GVAR(useFeet)) #define MAX_DISTANCE [6000, 9000] select GVAR(useFeet)
private ["_dlgVector", "_distance"]; private ["_dlgVector", "_distance"];
disableSerialization; disableSerialization;
_dlgVector = GETUVAR(AGM_dlgVector,displayNull); _dlgVector = GETUVAR(ACE_dlgVector,displayNull);
_distance = ctrlText (_dlgVector displayCtrl 151); _distance = ctrlText (_dlgVector displayCtrl 151);

View File

@ -1,62 +0,0 @@
// by commy2
#include "script_component.hpp"
private["_dlgVector", "_ctrlVectorCenter", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8", "_exit", "_time"];
disableSerialization;
_dlgVector = uiNamespace getVariable "AGM_dlgVector";
_ctrlVectorCenter = _dlgVector displayCtrl 1;
_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;
_ctrlVectorCenter ctrlSetText "\AGM_Vector\rsc\Vector_Center.paa";
_time = -1;
_exit = false;
waitUntil {
if (time > _time + 0.5) then {
_direction = call AGM_Vector_fnc_getDirection;
_azimuth = _direction select 0;
_digits = _azimuth call AGM_Vector_fnc_convertDegree;
_ctrlDigit5 ctrlSetText (_digits select 0);
_ctrlDigit6 ctrlSetText (_digits select 1);
_ctrlDigit7 ctrlSetText (_digits select 2);
_ctrlDigit8 ctrlSetText (_digits select 3);
_time = time;
};
if (AGM_vectorKey select 1) then {_exit = true};
!(AGM_vectorKey select 0) || {_exit}
};
if (_exit) exitWith {
waitUntil {
if (time > _time + 0.5) then {
_direction = call AGM_Vector_fnc_getDirection;
_azimuth = _direction select 0;
_digits = _azimuth call AGM_Vector_fnc_convertDegree;
_ctrlDigit5 ctrlSetText (_digits select 0);
_ctrlDigit6 ctrlSetText (_digits select 1);
_ctrlDigit7 ctrlSetText (_digits select 2);
_ctrlDigit8 ctrlSetText (_digits select 3);
_time = time;
};
!(AGM_vectorKey select 1)
};
_ctrlDigit5 ctrlSetText "";
_ctrlDigit6 ctrlSetText "";
_ctrlDigit7 ctrlSetText "";
_ctrlDigit8 ctrlSetText "";
AGM_Vector_scriptHandle = 0 spawn AGM_Vector_fnc_modeRelativeAzimuthDistance;
};
_ctrlVectorCenter ctrlShow false;
AGM_isVectorReady = true;

View File

@ -1,84 +0,0 @@
// by commy2
#include "script_component.hpp"
private["_dlgVector", "_ctrlVectorCenter", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8", "_exit", "_time", "_direction", "_azimuth", "_inclination", "_digits"];
disableSerialization;
_dlgVector = uiNamespace getVariable "AGM_dlgVector";
_ctrlVectorCenter = _dlgVector displayCtrl 1;
_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;
_ctrlVectorCenter ctrlSetText "\AGM_Vector\rsc\Vector_Center.paa";
_time = -1;
_exit = false;
waitUntil {
if (time > _time + 0.5) then {
_direction = call AGM_Vector_fnc_getDirection;
_azimuth = _direction select 0;
_inclination = _direction select 1;
_digits = _azimuth call AGM_Vector_fnc_convertDegree;
_ctrlDigit5 ctrlSetText (_digits select 0);
_ctrlDigit6 ctrlSetText (_digits select 1);
_ctrlDigit7 ctrlSetText (_digits select 2);
_ctrlDigit8 ctrlSetText (_digits select 3);
if (_inclination > 45 || {_inclination < -45}) then {_inclination = -9999};
_digits = _inclination call AGM_Vector_fnc_convertDegree;
_ctrlDigit1 ctrlSetText (_digits select 0);
_ctrlDigit2 ctrlSetText (_digits select 1);
_ctrlDigit3 ctrlSetText (_digits select 2);
_ctrlDigit4 ctrlSetText (_digits select 3);
_time = time;
};
if (AGM_vectorKey select 1) then {_exit = true};
!(AGM_vectorKey select 0) || {_exit}
};
if (_exit) exitWith {
waitUntil {
if (time > _time + 0.5) then {
_direction = call AGM_Vector_fnc_getDirection;
_azimuth = _direction select 0;
_inclination = _direction select 1;
_digits = _azimuth call AGM_Vector_fnc_convertDegree;
_ctrlDigit5 ctrlSetText (_digits select 0);
_ctrlDigit6 ctrlSetText (_digits select 1);
_ctrlDigit7 ctrlSetText (_digits select 2);
_ctrlDigit8 ctrlSetText (_digits select 3);
if (_inclination > 45 || {_inclination < -45}) then {_inclination = -9999};
_digits = _inclination call AGM_Vector_fnc_convertDegree;
_ctrlDigit1 ctrlSetText (_digits select 0);
_ctrlDigit2 ctrlSetText (_digits select 1);
_ctrlDigit3 ctrlSetText (_digits select 2);
_ctrlDigit4 ctrlSetText (_digits select 3);
_time = time;
};
!(AGM_vectorKey select 1)
};
_ctrlDigit1 ctrlSetText "";
_ctrlDigit2 ctrlSetText "";
_ctrlDigit3 ctrlSetText "";
_ctrlDigit4 ctrlSetText "";
_ctrlDigit5 ctrlSetText "";
_ctrlDigit6 ctrlSetText "";
_ctrlDigit7 ctrlSetText "";
_ctrlDigit8 ctrlSetText "";
AGM_Vector_scriptHandle = 0 spawn AGM_Vector_fnc_modeFallOfShort;
};
_ctrlVectorCenter ctrlShow false;
AGM_isVectorReady = true;

View File

@ -1,40 +0,0 @@
// by commy2
#include "script_component.hpp"
private["_dlgVector", "_ctrlVectorCenter", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8", "_exit", "_distance", "_digits"];
disableSerialization;
_dlgVector = uiNamespace getVariable "AGM_dlgVector";
_ctrlVectorCenter = _dlgVector displayCtrl 1;
_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;
_ctrlVectorCenter ctrlSetText "\AGM_Vector\rsc\Vector_Center.paa";
_exit = false;
waitUntil {
if (AGM_vectorKey select 0) then {_exit = true};
!(AGM_vectorKey select 1) || {_exit}
};
if (_exit) exitWith {
waitUntil {!(AGM_vectorKey select 0)};
AGM_Vector_scriptHandle = 0 spawn AGM_Vector_fnc_modeRelativeDistance;
};
_distance = call AGM_Vector_fnc_getDistance;
_digits = _distance call AGM_Vector_fnc_convertDistance;
_ctrlDigit1 ctrlSetText (_digits select 0);
_ctrlDigit2 ctrlSetText (_digits select 1);
_ctrlDigit3 ctrlSetText (_digits select 2);
_ctrlDigit4 ctrlSetText (_digits select 3);
_ctrlVectorCenter ctrlShow false;
AGM_isVectorReady = true;

View File

@ -0,0 +1,34 @@
/*
by commy2
Handles pressing the special vector keys.
*/
#include "script_component.hpp"
switch (_this select 0) do {
case ("azimuth"): {
if (diag_tickTime > GVAR(keyDownTimeDistance) + 0.5) then {
GVAR(isKeyDownDistance) = false; // emulate key release
["distance"] call FUNC(clearDisplay);
};
GVAR(isKeyDownAzimuth) = true;
GVAR(keyDownTimeAzimuth) = diag_tickTime;
[FUNC(onKeyHold), 0, "azimuth"] call CBA_fnc_addPerFrameHandler;
};
case ("distance"): {
if (diag_tickTime > GVAR(keyDownTimeAzimuth) + 0.5) then {
GVAR(isKeyDownAzimuth) = false; // emulate key release
["azimuth"] call FUNC(clearDisplay);
};
GVAR(isKeyDownDistance) = true;
GVAR(keyDownTimeDistance) = diag_tickTime;
[FUNC(onKeyHold), 0, "distance"] call CBA_fnc_addPerFrameHandler;
};
};

View File

@ -0,0 +1,39 @@
/*
by commy2
PFH executed while holding a vector key down.
*/
#include "script_component.hpp"
switch (_this select 0) do {
case ("azimuth"): {
if (diag_tickTime > GVAR(keyDownTimeAzimuth) + 0.5) then {
call FUNC(showAzimuth);
};
if (!GVAR(isKeyDownAzimuth)) then {
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
};
case ("distance"): {
private "_isReady";
_isReady = diag_tickTime > GVAR(keyDownTimeDistance) + 0.5;
[_isReady] call FUNC(showCenter);
if (!GVAR(isKeyDownDistance)) then {
if (_isReady) then {
call FUNC(showDistance);
};
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
};
};

View File

@ -0,0 +1,22 @@
/*
by commy2
Handles releasing the special vector keys.
*/
#include "script_component.hpp"
switch (_this select 0) do {
case ("azimuth"): {
GVAR(isKeyDownAzimuth) = false;
};
case ("distance"): {
GVAR(isKeyDownDistance) = false;
};
};

View File

@ -0,0 +1,23 @@
// by commy2
#include "script_component.hpp"
private ["_dlgVector", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8"];
disableSerialization;
_dlgVector = GETUVAR(ACE_dlgVector,displayNull);
_ctrlDigit5 = _dlgVector displayCtrl 1315;
_ctrlDigit6 = _dlgVector displayCtrl 1316;
_ctrlDigit7 = _dlgVector displayCtrl 1317;
_ctrlDigit8 = _dlgVector displayCtrl 1318;
private ["_direction", "_digits"];
_direction = call FUNC(getDirection);
_digits = _direction call FUNC(convertToTexturesDegree);
_ctrlDigit5 ctrlSetText (_digits select 0);
_ctrlDigit6 ctrlSetText (_digits select 1);
_ctrlDigit7 ctrlSetText (_digits select 2);
_ctrlDigit8 ctrlSetText (_digits select 3);

View File

@ -0,0 +1,10 @@
/*
by commy2
Shows or hides the vectors center square thingy.
*/
#include "script_component.hpp"
((GETUVAR(ACE_dlgVector,displayNull)) displayCtrl 1301) ctrlSetText (["", QUOTE(PATHTOF(rsc\vector_center.paa))] select (_this select 0));

View File

@ -0,0 +1,23 @@
// by commy2
#include "script_component.hpp"
private ["_dlgVector", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4"];
disableSerialization;
_dlgVector = GETUVAR(ACE_dlgVector,displayNull);
_ctrlDigit1 = _dlgVector displayCtrl 1311;
_ctrlDigit2 = _dlgVector displayCtrl 1312;
_ctrlDigit3 = _dlgVector displayCtrl 1313;
_ctrlDigit4 = _dlgVector displayCtrl 1314;
private ["_distance", "_digits"];
_distance = call FUNC(getDistance);
_digits = [_distance] call FUNC(convertToTexturesDistance);
_ctrlDigit1 ctrlSetText (_digits select 0);
_ctrlDigit2 ctrlSetText (_digits select 1);
_ctrlDigit3 ctrlSetText (_digits select 2);
_ctrlDigit4 ctrlSetText (_digits select 3);