diff --git a/addons/main/script_macros.hpp b/addons/main/script_macros.hpp index 8812c11507..2fee38a6b3 100644 --- a/addons/main/script_macros.hpp +++ b/addons/main/script_macros.hpp @@ -184,6 +184,21 @@ #define PATHTOEF(var1,var2) PATHTOF_SYS(PREFIX,var1,var2) + +#define GETVAR_SYS(var1,var2) getVariable [ARR_2(QUOTE(var1),var2)] +#define SETVAR_SYS(var1,var2) setVariable [ARR_2(QUOTE(var1),var2)] +#define SETGVAR_SYS(var1,var2) setVariable [ARR_3(QUOTE(var1),var2,true)] + +#define GETVAR(var1,var2,var3) (var1 GETVAR_SYS(var2,var3)) +#define GETMVAR(var1,var2) (missionNamespace GETVAR_SYS(var1,var2)) +#define GETUVAR(var1,var2) (uiNamespace GETVAR_SYS(var1,var2)) + +#define SETVAR(var1,var2,var3) (var1 SETVAR_SYS(var2,var3)) +#define SETGVAR(var1,var2,var3) (var1 SETGVAR_SYS(var2,var3)) +#define SETMVAR(var1,var2) (missionNamespace SETVAR_SYS(var1,var2)) +#define SETUVAR(var1,var2) (uiNamespace SETVAR_SYS(var1,var2)) + + #ifdef DISABLE_COMPILE_CACHE #define PREP(fncName) DFUNC(fncName) = compile preprocessFileLineNumbers QUOTE(PATHTOF(functions\DOUBLES(fnc,fncName).sqf)) #else diff --git a/addons/vector/functions/fnc_convertMeterToFeet.sqf b/addons/vector/functions/fnc_convertMeterToFeet.sqf new file mode 100644 index 0000000000..a0e6cb034c --- /dev/null +++ b/addons/vector/functions/fnc_convertMeterToFeet.sqf @@ -0,0 +1,3 @@ +// by commy2 + +3.28084 * (_this select 0) diff --git a/addons/vector/functions/fnc_getDirection.sqf b/addons/vector/functions/fnc_getDirection.sqf index 7d50bb411f..625e8fe34d 100644 --- a/addons/vector/functions/fnc_getDirection.sqf +++ b/addons/vector/functions/fnc_getDirection.sqf @@ -1,12 +1,12 @@ // by commy2 #include "script_component.hpp" -private "_dlgVectorOptics"; +private "_dlgVector"; disableSerialization; -_dlgVectorOptics = uiNamespace getVariable ['AGM_dlgVectorOptics', displayNull]; +_dlgVector = uiNamespace getVariable ["AGM_dlgVector", displayNull]; [ - round parseNumber ctrlText (_dlgVectorOptics displayCtrl 156), - round parseNumber ctrlText (_dlgVectorOptics displayCtrl 182) + round parseNumber ctrlText (_dlgVector displayCtrl 156), + round parseNumber ctrlText (_dlgVector displayCtrl 182) ] diff --git a/addons/vector/functions/fnc_getDistance.sqf b/addons/vector/functions/fnc_getDistance.sqf index 40a5a9a362..9658b16348 100644 --- a/addons/vector/functions/fnc_getDistance.sqf +++ b/addons/vector/functions/fnc_getDistance.sqf @@ -2,25 +2,24 @@ #include "script_component.hpp" #define MIN_DISTANCE 10 -#define MAX_DISTANCE ([6000, 9000] select (AGM_vectorSettings select 3)) -#define INTERVAL 2 +#define MAX_DISTANCE ([6000, 9000] select GVAR(useFeet)) -private ["_dlgVectorOptics", "_distance"]; +private ["_dlgVector", "_distance"]; disableSerialization; -_dlgVectorOptics = uiNamespace getVariable ['AGM_dlgVectorOptics', displayNull]; +_dlgVector = GETUVAR(AGM_dlgVector,displayNull); -_distance = ctrlText (_dlgVectorOptics displayCtrl 151); +_distance = ctrlText (_dlgVector displayCtrl 151); -if (_distance == "----") exitWith {-9999}; +if (_distance == "----") exitWith {-1}; _distance = round parseNumber _distance; -if (AGM_vectorSettings select 3) then { +if (GVAR(useFeet)) then { _distance = 3.28084 * _distance; }; -if (_distance > MAX_DISTANCE) exitWith {-9999}; -if (_distance < MIN_DISTANCE) exitWith {-9999}; +if (_distance > MAX_DISTANCE) exitWith {-1}; +if (_distance < MIN_DISTANCE) exitWith {-1}; _distance