diff --git a/addons/client/functions/fnc_convertClientLocation.sqf b/addons/client/functions/fnc_convertClientLocation.sqf index cbc3197..3f335d5 100644 --- a/addons/client/functions/fnc_convertClientLocation.sqf +++ b/addons/client/functions/fnc_convertClientLocation.sqf @@ -1,22 +1,22 @@ #include "..\script_component.hpp" /* - * Author: Valmo Trindade - * This function is used to convert the position of a unit to the world world location. - * - * Argument: - * 0: in game latitude is the latitude of the unit. - * 1: in game longitude is the longitude of the unit. - * 2: in game altitude is the altitude of the unit. - * 3: in game bearing is the bearing of the unit. - * - * Return Value: - * ARRAY -> [latitude, longitude, altitude, bearing] - * - * Example: - * [player] call armatak_client_fnc_convertClientLocation; - * - * Public: Yes + * Author: Valmo Trindade + * This function is used to convert the position of a unit to the world world location. + * + * Argument: + * 0: in game latitude is the latitude of the unit. + * 1: in game longitude is the longitude of the unit. + * 2: in game altitude is the altitude of the unit. + * 3: in game bearing is the bearing of the unit. + * + * Return Value: + * ARRAY -> [latitude, longitude, altitude, bearing] + * + * Example: + * [player] call armatak_client_fnc_convertClientLocation; + * + * Public: Yes */ params["_latitude", "_longitude", "_altitude"]; @@ -101,6 +101,9 @@ switch (toLower worldName) do { case "umb_colombia": { _realLocation = _position call armatak_fnc_convert_to_colombia; }; + case "clafghan": { + _realLocation = _position call armatak_fnc_convert_to_clafghan; + }; default { _warning = format ["ARMATAK
%1", "Unsupported Map"]; [[_warning, 1.5]] call CBA_fnc_notify; diff --git a/addons/main/CfgFunctions.hpp b/addons/main/CfgFunctions.hpp index 59631e7..4549bfd 100644 --- a/addons/main/CfgFunctions.hpp +++ b/addons/main/CfgFunctions.hpp @@ -116,6 +116,9 @@ class CfgFunctions { class convert_to_colombia { file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_colombia.sqf"; }; + class convert_to_clafghan { + file = "\armatak\armatak\addons\main\functions\map\fn_convert_to_clafghan.sqf"; + }; }; }; }; diff --git a/addons/main/functions/map/fn_convert_to_clafghan.sqf b/addons/main/functions/map/fn_convert_to_clafghan.sqf new file mode 100644 index 0000000..bfdeba4 --- /dev/null +++ b/addons/main/functions/map/fn_convert_to_clafghan.sqf @@ -0,0 +1,23 @@ +params["_latitude", "_longitude", "_altitude"]; + +_playerPosition = [_latitude, _longitude, _altitude]; + +_playerLatitude = _playerPosition select 0; +_playerLongitude = _playerPosition select 1; + +_playerMaxLatitude = 20480; +_playerMaxLongitude = 20480; + +_MapMaxLatitude = 33.728772; +_MapMinLatitude = 33.542815; + +_MapMaxLongitude = 63.169746; +_MapMinLongitude = 62.938820; + +_LongitudeDifference = _MapMaxLongitude - _MapMinLongitude; +_LatitudeDifference = _MapMaxLatitude - _MapMinLatitude; + +_RealLongitude = (_playerLongitude / _playerMaxLongitude) * _LongitudeDifference + _MapMinLongitude; +_RealLatitude = (_playerLatitude / _playerMaxLatitude) * _LatitudeDifference + _MapMinLatitude; + +[_RealLongitude, _RealLatitude, _playerPosition select 2]