Common - Add setting for compass magnetic declination

This commit is contained in:
PabstMirror 2024-02-01 03:09:00 -06:00
parent c150d923f7
commit 953d832ab2
5 changed files with 156 additions and 1 deletions

View File

@ -76,6 +76,8 @@ PREP(getFirstTerrainIntersection);
PREP(getGunner);
PREP(getInPosition);
PREP(getLocalUnits);
PREP(getMagneticBearing);
PREP(getMagneticBearingOffset);
PREP(getMapData);
PREP(getMapGridData);
PREP(getMapGridFromPos);

View File

@ -0,0 +1,21 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
*
*
* Arguments:
* 0: Object or Bearing <OBJECT><NUMBER>
*
* Return Value:
* Compass Bearing <NUMBER>
*
* Example:
* [player] call ace_common_fnc_getMagneticBearing
*
* Public: Yes
*/
params [["_source", ace_player, [objNull, 0]]];
(missionNamespace getVariable [QGVAR(magneticDeclinationOffset), 0]) +
(if (_source isEqualType 0) then { _source } else { getDir _source })

View File

@ -0,0 +1,122 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
*
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ace_common_fnc_getMagneticBearingOffset
*
* Public: No
*/
TRACE_1("",GVAR(magneticDeclination));
if (!GVAR(magneticDeclination)) exitWith {
if (!isNil QGVAR(magneticDeclinationOffset)) then { // was previously set
GVAR(magneticDeclinationOffset) = nil;
setCompassDeclination 0; // reset
};
};
private _long = GVAR(mapLongitude);
private _lat = GVAR(mapLatitude);
private _size = 5;
private _data = [
[148.674,141.141,128.977,110.077,85.874,63.858,48.477,38.438,31.607,26.630,22.789,19.712,17.205,15.163,13.522,12.238,11.268,10.559,10.042,9.634,9.240,8.764,8.133,7.315,6.332,5.258,4.195,3.237,2.431,1.763,1.158,0.483,-0.467,-2.062,-5.424,-22.252,-167.584],
[143.674,135.505,122.743,104.017,81.615,61.843,47.796,38.360,31.791,26.930,23.129,20.049,17.508,15.409,13.698,12.339,11.300,10.544,10.016,9.651,9.365,9.069,8.683,8.157,7.487,6.720,5.933,5.206,4.587,4.070,3.593,3.037,2.196,0.674,-2.771,-20.731,-162.584],
[138.674,129.953,116.793,98.520,77.849,59.954,47.022,38.115,31.794,27.054,23.312,20.249,17.693,15.552,13.778,12.342,11.226,10.404,9.841,9.487,9.278,9.134,8.981,8.755,8.427,8.009,7.546,7.094,6.692,6.346,6.011,5.579,4.848,3.392,-0.166,-19.498,-157.584],
[133.674,124.487,111.118,93.497,74.463,58.177,46.202,37.760,31.664,27.044,23.371,20.345,17.798,15.637,13.818,12.319,11.131,10.243,9.636,9.276,9.117,9.097,9.148,9.203,9.211,9.152,9.030,8.874,8.712,8.555,8.372,8.073,7.455,6.055,2.341,-18.671,-152.584],
[128.674,119.110,105.700,88.869,71.374,56.501,45.368,37.340,31.444,26.933,23.331,20.355,17.836,15.681,13.842,12.303,11.063,10.125,9.483,9.119,9.002,9.084,9.306,9.602,9.910,10.179,10.382,10.519,10.604,10.649,10.635,10.480,9.978,8.622,4.694,-18.384,-147.584],
[123.674,113.822,100.519,84.567,68.516,54.915,44.547,36.896,31.175,26.753,23.213,20.287,17.810,15.680,13.846,12.293,11.028,10.064,9.409,9.057,8.987,9.162,9.527,10.019,10.568,11.109,11.594,11.998,12.324,12.579,12.748,12.751,12.371,11.044,6.827,-18.785,-142.584],
[118.674,108.624,95.551,80.532,65.838,53.405,43.754,36.461,30.896,26.542,23.041,20.153,17.715,15.619,13.808,12.263,10.997,10.033,9.388,9.068,9.058,9.322,9.809,10.454,11.185,11.933,12.640,13.273,13.823,14.290,14.655,14.832,14.579,13.260,8.654,-20.030,-137.584],
[113.674,103.513,90.774,76.709,63.292,51.952,42.995,36.059,30.643,26.336,22.848,19.972,17.556,15.490,13.706,12.183,10.933,9.985,9.367,9.091,9.146,9.498,10.090,10.853,11.715,12.609,13.481,14.299,15.050,15.725,16.295,16.657,16.534,15.193,10.067,-22.266,-132.584],
[108.674,98.486,86.163,73.055,60.838,50.531,42.263,35.700,30.440,26.169,22.666,19.769,17.347,15.291,13.528,12.028,10.800,9.875,9.287,9.056,9.172,9.600,10.279,11.134,12.089,13.083,14.072,15.031,15.953,16.823,17.598,18.152,18.153,16.746,10.922,-25.575,-127.584],
[103.674,93.539,81.698,69.530,58.437,49.112,41.535,35.375,30.297,26.064,22.526,19.575,17.110,15.034,13.273,11.787,10.579,9.677,9.115,8.917,9.078,9.562,10.303,11.223,12.242,13.300,14.364,15.425,16.481,17.521,18.488,19.223,19.330,17.787,11.028,-29.906,-122.584],
[98.674,88.668,77.357,66.099,56.054,47.660,40.776,35.057,30.200,26.026,22.448,19.416,16.872,14.742,12.958,11.473,10.279,9.395,8.851,8.670,8.850,9.357,10.128,11.079,12.129,13.217,14.319,15.437,16.584,17.752,18.876,19.761,19.927,18.145,10.137,-35.000,-117.584],
[93.674,83.868,73.122,62.734,53.656,46.137,39.942,34.699,30.113,26.036,22.432,19.309,16.662,14.451,12.621,11.124,9.937,9.067,8.531,8.346,8.512,9.001,9.754,10.691,11.728,12.806,13.902,15.028,16.208,17.442,18.659,19.630,19.772,17.593,7.938,-40.381,-112.584],
[88.674,79.135,68.976,59.410,51.215,44.506,38.981,34.239,29.976,26.048,22.456,19.259,16.506,14.202,12.313,10.793,9.609,8.744,8.201,7.986,8.099,8.517,9.194,10.056,11.025,12.040,13.076,14.150,15.290,16.505,17.719,18.666,18.647,15.840,4.096,-45.476,-107.584],
[83.674,74.462,64.905,56.107,48.708,42.733,37.841,33.608,29.709,25.991,22.466,19.236,16.403,14.016,12.068,10.521,9.328,8.453,7.879,7.599,7.611,7.901,8.435,9.156,9.991,10.882,11.798,12.749,13.764,14.852,15.928,16.687,16.298,12.555,-1.624,-49.794,-102.584],
[78.674,69.845,60.895,52.809,46.118,40.792,36.475,32.733,29.222,25.766,22.374,19.170,16.301,13.858,11.862,10.283,9.063,8.152,7.511,7.124,6.987,7.094,7.425,7.940,8.579,9.283,10.015,10.771,11.567,12.400,13.170,13.522,12.479,7.448,-9.100,-53.054,-97.584],
[73.674,65.279,56.936,49.507,43.434,38.663,34.845,31.551,28.422,25.259,22.053,18.936,16.081,13.614,11.581,9.958,8.689,7.706,6.962,6.431,6.106,5.989,6.075,6.337,6.729,7.194,7.685,8.176,8.661,9.109,9.388,9.078,7.061,0.484,-17.596,-55.186,-92.584],
[68.674,60.759,53.020,46.193,40.651,36.337,32.927,30.009,27.223,24.348,21.354,18.362,15.559,13.090,11.022,9.343,7.997,6.916,6.045,5.350,4.825,4.473,4.298,4.289,4.407,4.598,4.806,4.980,5.080,5.033,4.656,3.458,0.227,-7.828,-25.877,-56.261,-87.584],
[63.674,56.279,49.140,42.864,37.772,33.818,30.712,28.076,25.558,22.926,20.126,17.263,14.520,12.054,9.945,8.196,6.761,5.575,4.580,3.738,3.034,2.472,2.059,1.790,1.637,1.549,1.458,1.291,0.969,0.369,-0.752,-2.939,-7.383,-16.376,-32.810,-56.414,-82.584],
[58.674,51.836,45.289,39.521,34.807,31.118,28.210,25.743,23.388,20.912,18.245,15.474,12.770,10.293,8.135,6.316,4.804,3.540,2.464,1.528,0.707,-0.004,-0.598,-1.078,-1.465,-1.806,-2.177,-2.668,-3.397,-4.531,-6.360,-9.440,-14.792,-23.918,-37.856,-55.796,-77.584],
[53.674,47.425,41.464,36.167,31.768,28.260,25.445,23.027,20.710,18.273,15.642,12.891,10.183,7.676,5.473,3.610,2.066,0.788,-0.290,-1.232,-2.078,-2.846,-3.536,-4.148,-4.699,-5.233,-5.826,-6.585,-7.651,-9.222,-11.610,-15.321,-21.103,-29.691,-41.034,-54.542,-72.584],
[48.674,43.041,37.662,32.807,28.676,25.279,22.461,19.976,17.564,15.033,12.322,9.508,6.749,4.204,1.984,0.132,-1.364,-2.562,-3.544,-4.388,-5.154,-5.873,-6.554,-7.197,-7.816,-8.453,-9.185,-10.124,-11.423,-13.294,-16.035,-20.063,-25.845,-33.551,-42.628,-52.771,-67.584],
[43.674,38.681,33.878,29.448,25.552,22.215,19.320,16.665,14.037,11.285,8.385,5.433,2.594,0.029,-2.153,-3.908,-5.259,-6.279,-7.066,-7.717,-8.304,-8.870,-9.430,-9.990,-10.568,-11.207,-11.984,-13.011,-14.440,-16.474,-19.377,-23.464,-28.970,-35.722,-42.972,-50.578,-62.584],
[38.674,34.339,30.110,26.094,22.419,19.114,16.093,13.194,10.256,7.187,4.018,0.887,-2.025,-4.560,-6.622,-8.188,-9.303,-10.063,-10.583,-10.968,-11.296,-11.616,-11.952,-12.323,-12.758,-13.308,-14.050,-15.089,-16.565,-18.658,-21.587,-25.570,-30.673,-36.536,-42.356,-48.040,-57.584],
[33.674,30.013,26.356,22.753,19.299,16.023,12.858,9.681,6.383,2.948,-0.517,-3.816,-6.753,-9.184,-11.045,-12.345,-13.162,-13.614,-13.824,-13.898,-13.910,-13.912,-13.943,-14.044,-14.263,-14.661,-15.315,-16.319,-17.791,-19.880,-22.754,-26.550,-31.218,-36.305,-41.010,-45.219,-52.584],
[28.674,25.697,22.611,19.428,16.212,12.986,9.695,6.248,2.594,-1.198,-4.925,-8.335,-11.221,-13.473,-15.068,-16.057,-16.547,-16.670,-16.550,-16.285,-15.947,-15.591,-15.277,-15.070,-15.040,-15.262,-15.807,-16.755,-18.199,-20.250,-23.030,-26.607,-30.856,-35.280,-39.105,-42.165,-47.584],
[23.674,21.389,18.873,16.119,13.171,10.039,6.674,3.010,-0.944,-5.028,-8.940,-12.372,-15.128,-17.141,-18.437,-19.099,-19.253,-19.036,-18.572,-17.955,-17.256,-16.542,-15.890,-15.387,-15.124,-15.180,-15.622,-16.512,-17.916,-19.913,-22.580,-25.933,-29.794,-33.651,-36.770,-38.917,-42.584],
[18.674,17.084,15.135,12.824,10.182,7.205,3.846,0.058,-4.099,-8.371,-12.366,-15.733,-18.298,-20.042,-21.027,-21.355,-21.161,-20.589,-19.769,-18.799,-17.760,-16.728,-15.793,-15.054,-14.607,-14.532,-14.889,-15.724,-17.081,-19.012,-21.558,-24.690,-28.195,-31.564,-34.099,-35.507,-37.584],
[13.674,12.779,11.393,9.538,7.241,4.492,1.239,-2.555,-6.787,-11.129,-15.112,-18.352,-20.696,-22.162,-22.829,-22.807,-22.237,-21.284,-20.096,-18.792,-17.464,-16.192,-15.065,-14.176,-13.615,-13.454,-13.746,-14.527,-15.828,-17.680,-20.095,-23.010,-26.186,-29.123,-31.165,-31.962,-32.584],
[8.674,8.469,7.640,6.251,4.338,1.888,-1.153,-4.818,-8.986,-13.283,-17.182,-20.271,-22.399,-23.590,-23.923,-23.510,-22.516,-21.148,-19.594,-17.998,-16.456,-15.042,-13.826,-12.879,-12.274,-12.069,-12.313,-13.037,-14.268,-16.026,-18.299,-20.999,-23.865,-26.412,-28.024,-28.303,-27.584],
[3.674,4.151,3.870,2.951,1.451,-0.635,-3.363,-6.768,-10.735,-14.881,-18.654,-21.603,-23.542,-24.465,-24.429,-23.562,-22.086,-20.276,-18.375,-16.546,-14.878,-13.420,-12.207,-11.281,-10.688,-10.473,-10.679,-11.343,-12.491,-14.139,-16.260,-18.741,-21.308,-23.491,-24.718,-24.548,-22.584],
[-1.326,-0.178,0.075,-0.377,-1.447,-3.123,-5.454,-8.483,-12.121,-16.023,-19.640,-22.474,-24.256,-24.905,-24.452,-23.065,-21.060,-18.808,-16.603,-14.612,-12.899,-11.472,-10.330,-9.477,-8.933,-8.731,-8.910,-9.510,-10.567,-12.091,-14.048,-16.302,-18.573,-20.409,-21.282,-20.712,-17.584],
[-6.326,-4.523,-3.753,-3.749,-4.386,-5.630,-7.510,-10.073,-13.272,-16.834,-20.252,-22.975,-24.609,-24.961,-24.038,-22.088,-19.554,-16.905,-14.467,-12.389,-10.693,-9.346,-8.306,-7.549,-7.071,-6.894,-7.053,-7.593,-8.552,-9.943,-11.722,-13.739,-15.707,-17.204,-17.742,-16.807,-12.584],
[-11.326,-8.887,-7.619,-7.179,-7.399,-8.213,-9.624,-11.669,-14.340,-17.455,-20.588,-23.148,-24.592,-24.595,-23.163,-20.660,-17.670,-14.729,-12.161,-10.071,-8.436,-7.187,-6.253,-5.589,-5.175,-5.023,-5.164,-5.643,-6.501,-7.749,-9.333,-11.094,-12.750,-13.907,-14.121,-12.845,-7.584],
[-16.326,-13.273,-11.530,-10.682,-10.516,-10.927,-11.885,-13.404,-15.491,-18.048,-20.750,-23.008,-24.147,-23.721,-21.767,-18.795,-15.500,-12.432,-9.860,-7.835,-6.293,-5.142,-4.298,-3.705,-3.336,-3.195,-3.310,-3.723,-4.471,-5.559,-6.925,-8.407,-9.733,-10.544,-10.438,-8.835,-2.584],
[-21.326,-17.683,-15.492,-14.270,-13.758,-13.816,-14.371,-15.396,-16.886,-18.791,-20.882,-22.616,-23.253,-22.286,-19.830,-16.537,-13.144,-10.138,-7.698,-5.813,-4.393,-3.337,-2.561,-2.009,-1.655,-1.501,-1.570,-1.899,-2.517,-3.419,-4.537,-5.709,-6.681,-7.135,-6.709,-4.785,2.416],
[-26.326,-22.122,-19.509,-17.949,-17.142,-16.909,-17.132,-17.733,-18.665,-19.877,-21.193,-22.142,-22.019,-20.370,-17.445,-13.995,-10.709,-7.937,-5.746,-4.069,-2.800,-1.841,-1.117,-0.582,-0.214,-0.017,-0.013,-0.230,-0.686,-1.367,-2.198,-3.023,-3.615,-3.699,-2.948,-0.702,7.416],
[-31.326,-26.590,-23.585,-21.725,-20.674,-20.217,-20.190,-20.460,-20.921,-21.474,-21.936,-21.887,-20.740,-18.240,-14.846,-11.354,-8.307,-5.873,-4.002,-2.579,-1.488,-0.638,0.033,0.561,0.960,1.220,1.324,1.250,0.990,0.570,0.070,-0.370,-0.554,-0.252,0.833,3.406,12.416],
[-36.326,-31.092,-27.722,-25.597,-24.351,-23.733,-23.535,-23.573,-23.676,-23.675,-23.323,-22.194,-19.840,-16.317,-12.380,-8.843,-6.049,-3.963,-2.422,-1.265,-0.366,0.358,0.963,1.475,1.900,2.229,2.444,2.534,2.502,2.383,2.254,2.237,2.487,3.191,4.621,7.535,17.416],
[-41.326,-35.629,-31.920,-29.563,-28.162,-27.433,-27.130,-27.020,-26.878,-26.460,-25.427,-23.293,-19.702,-15.043,-10.426,-6.713,-4.059,-2.235,-0.968,-0.048,0.665,1.256,1.777,2.251,2.682,3.064,3.386,3.647,3.863,4.076,4.353,4.788,5.494,6.615,8.404,11.678,22.416],
[-46.326,-40.203,-36.180,-33.616,-32.089,-31.283,-30.916,-30.716,-30.413,-29.699,-28.145,-25.184,-20.489,-14.706,-9.284,-5.200,-2.491,-0.774,0.330,1.082,1.644,2.113,2.543,2.959,3.373,3.785,4.198,4.627,5.100,5.661,6.366,7.274,8.452,10.004,12.171,15.830,27.416],
[-51.326,-44.816,-40.501,-37.747,-36.110,-35.240,-34.823,-34.556,-34.131,-33.191,-31.241,-27.650,-22.092,-15.347,-9.104,-4.490,-1.524,0.269,1.349,2.032,2.509,2.892,3.246,3.605,3.990,4.419,4.912,5.503,6.235,7.153,8.296,9.686,11.346,13.343,15.909,19.986,32.416],
[-56.326,-49.471,-44.882,-41.947,-40.199,-39.259,-38.781,-38.432,-37.877,-36.725,-34.439,-30.372,-24.213,-16.783,-9.851,-4.664,-1.302,0.722,1.917,2.639,3.113,3.470,3.789,4.117,4.491,4.947,5.527,6.286,7.281,8.559,10.140,12.011,14.156,16.612,19.605,24.141,37.416],
[-61.326,-54.168,-49.322,-46.206,-44.334,-43.297,-42.719,-42.246,-41.517,-40.116,-37.498,-33.045,-26.506,-18.694,-11.316,-5.648,-1.861,0.484,1.895,2.752,3.304,3.704,4.045,4.392,4.798,5.318,6.016,6.966,8.237,9.874,11.883,14.226,16.858,19.788,23.243,28.289,42.416],
[-66.326,-58.909,-53.820,-50.514,-48.492,-47.313,-46.579,-45.915,-44.942,-43.228,-40.241,-35.437,-28.666,-20.726,-13.173,-7.207,-3.066,-0.396,1.274,2.324,3.014,3.514,3.934,4.356,4.850,5.487,6.350,7.524,9.085,11.079,13.502,16.303,19.420,22.846,26.806,32.426,47.416],
[-71.326,-63.698,-58.376,-54.865,-52.653,-51.275,-50.312,-49.374,-48.070,-45.961,-42.549,-37.389,-30.460,-22.558,-15.054,-8.994,-4.635,-1.704,0.210,1.461,2.312,2.942,3.478,4.016,4.644,5.447,6.516,7.943,9.804,12.144,14.959,18.201,21.802,25.751,30.272,36.546,52.416],
[-76.326,-68.534,-62.991,-59.253,-56.803,-55.156,-53.880,-52.574,-50.841,-48.248,-44.341,-38.793,-31.723,-23.938,-16.624,-10.643,-6.216,-3.128,-1.033,0.388,1.386,2.144,2.801,3.470,4.251,5.240,6.533,8.218,10.369,13.029,16.206,19.866,23.955,28.463,33.614,40.642,57.416],
[-81.326,-73.421,-67.667,-63.676,-60.932,-58.938,-57.254,-55.477,-53.210,-50.035,-45.556,-39.571,-32.346,-24.700,-17.650,-11.869,-7.505,-4.373,-2.180,-0.646,0.459,1.318,2.077,2.860,3.780,4.940,6.436,8.350,10.751,13.687,17.183,21.234,25.814,30.926,36.800,44.708,62.416],
[-86.326,-78.361,-72.407,-68.135,-65.036,-62.609,-60.413,-58.051,-55.135,-51.274,-46.142,-39.673,-32.271,-24.768,-18.022,-12.520,-8.326,-5.255,-3.051,-1.470,-0.306,0.616,1.443,2.308,3.329,4.614,6.257,8.336,10.919,14.064,17.821,22.227,27.300,33.075,39.788,48.735,67.416],
[-91.326,-83.355,-77.217,-72.635,-69.117,-66.165,-63.344,-60.273,-56.582,-51.922,-46.059,-39.071,-31.494,-24.151,-17.745,-12.587,-8.648,-5.728,-3.594,-2.031,-0.856,0.092,0.954,1.862,2.936,4.285,6.000,8.159,10.834,14.099,18.040,22.750,28.314,34.818,42.521,52.714,72.416],
[-96.326,-88.407,-82.103,-77.185,-73.181,-69.604,-66.036,-62.116,-57.512,-51.937,-45.275,-37.765,-30.051,-22.918,-16.902,-12.148,-8.536,-5.845,-3.853,-2.367,-1.225,-0.286,0.581,1.499,2.581,3.931,5.639,7.785,10.448,13.727,17.755,22.695,28.728,36.036,44.923,56.633,77.416],
[-101.326,-93.518,-87.075,-81.799,-77.242,-72.934,-68.479,-63.552,-57.880,-51.274,-43.770,-35.776,-28.010,-21.166,-15.597,-11.299,-8.073,-5.675,-3.887,-2.534,-1.472,-0.576,0.266,1.161,2.209,3.504,5.131,7.170,9.715,12.890,16.880,21.941,28.390,36.571,46.889,60.477,82.416],
[-106.326,-98.692,-92.142,-86.496,-81.320,-76.164,-70.661,-64.543,-57.630,-49.884,-41.533,-33.144,-25.447,-18.983,-13.916,-10.111,-7.308,-5.249,-3.719,-2.551,-1.616,-0.807,-0.030,0.803,1.773,2.958,4.433,6.279,8.596,11.537,15.339,20.365,27.118,36.210,48.268,64.226,87.416],
[-111.326,-103.929,-97.319,-91.301,-85.443,-79.307,-72.564,-65.032,-56.686,-47.710,-38.563,-29.926,-22.441,-16.444,-11.915,-8.616,-6.253,-4.559,-3.323,-2.388,-1.633,-0.964,-0.304,0.414,1.253,2.269,3.525,5.092,7.075,9.645,13.085,17.863,24.716,34.677,48.842,67.855,92.416],
[-116.326,-109.234,-102.620,-96.243,-89.647,-82.381,-74.158,-64.934,-54.943,-44.695,-34.888,-26.207,-19.092,-13.636,-9.658,-6.858,-4.926,-3.602,-2.683,-2.017,-1.490,-1.018,-0.536,0.006,0.651,1.435,2.402,3.612,5.163,7.229,10.121,14.393,21.027,31.647,48.290,71.327,97.416],
[-121.326,-114.606,-108.061,-101.363,-93.981,-85.408,-75.392,-64.119,-52.269,-40.803,-30.585,-22.125,-15.547,-10.694,-7.269,-4.944,-3.418,-2.450,-1.848,-1.469,-1.206,-0.977,-0.728,-0.420,-0.030,0.462,1.079,1.865,2.903,4.357,6.535,10.032,16.018,26.808,46.143,74.590,102.416],
[-126.326,-120.048,-113.660,-106.707,-98.511,-88.416,-76.179,-62.397,-48.518,-36.054,-25.813,-17.887,-12.011,-7.819,-4.945,-3.066,-1.912,-1.268,-0.964,-0.867,-0.875,-0.913,-0.930,-0.898,-0.806,-0.650,-0.424,-0.103,0.377,1.156,2.514,5.022,9.908,20.050,41.762,77.564,107.416],
[-131.326,-125.560,-119.436,-112.333,-103.326,-91.445,-76.376,-59.492,-43.558,-30.566,-20.808,-13.734,-8.711,-5.230,-2.908,-1.453,-0.636,-0.277,-0.233,-0.388,-0.648,-0.944,-1.229,-1.484,-1.705,-1.901,-2.077,-2.225,-2.300,-2.190,-1.662,-0.227,3.238,11.757,34.442,80.124,112.416],
[-136.326,-131.141,-125.406,-118.308,-108.551,-94.551,-75.735,-55.025,-37.339,-24.566,-15.834,-9.880,-5.815,-3.080,-1.315,-0.271,0.237,0.347,0.174,-0.187,-0.657,-1.175,-1.703,-2.224,-2.742,-3.272,-3.826,-4.405,-4.976,-5.457,-5.668,-5.229,-3.243,2.952,23.932,82.056,117.416],
[-141.326,-136.791,-131.588,-124.712,-114.365,-97.831,-73.809,-48.521,-29.971,-18.356,-11.111,-6.442,-3.380,-1.399,-0.187,0.457,0.673,0.565,0.215,-0.306,-0.937,-1.630,-2.357,-3.106,-3.883,-4.703,-5.580,-6.514,-7.483,-8.422,-9.203,-9.560,-8.856,-5.086,11.382,82.966,122.416],
[-146.326,-142.505,-137.993,-131.634,-121.030,-101.462,-69.727,-39.525,-21.784,-12.237,-6.756,-3.417,-1.339,-0.082,0.602,0.865,0.809,0.506,0.010,-0.633,-1.385,-2.213,-3.098,-4.034,-5.024,-6.080,-7.208,-8.404,-9.647,-10.891,-12.049,-12.956,-13.205,-11.459,-0.625,82.048,127.416],
[-151.326,-148.279,-144.630,-139.168,-128.933,-105.822,-61.689,-27.973,-13.292,-6.431,-2.787,-0.719,0.454,1.056,1.264,1.186,0.890,0.418,-0.200,-0.943,-1.793,-2.733,-3.753,-4.846,-6.012,-7.250,-8.558,-9.924,-11.327,-12.733,-14.095,-15.328,-16.205,-15.915,-9.946,77.445,132.416],
[-156.326,-154.108,-151.498,-147.397,-138.636,-111.905,-46.098,-14.726,-5.060,-1.066,0.844,1.773,2.156,2.199,2.011,1.654,1.164,0.557,-0.162,-0.994,-1.936,-2.984,-4.132,-5.368,-6.683,-8.064,-9.494,-10.956,-12.427,-13.888,-15.326,-16.718,-17.969,-18.633,-16.100,64.386,137.416],
[-161.326,-159.985,-158.584,-156.375,-150.876,-123.342,-19.367,-1.580,2.464,3.807,4.197,4.153,3.879,3.471,2.975,2.410,1.780,1.075,0.278,-0.632,-1.665,-2.824,-4.099,-5.472,-6.919,-8.413,-9.926,-11.432,-12.912,-14.362,-15.795,-17.239,-18.690,-19.944,-19.623,34.104,142.416],
[-166.326,-165.899,-165.863,-166.089,-166.325,-163.622,9.960,9.772,9.028,8.177,7.311,6.467,5.662,4.900,4.173,3.463,2.743,1.977,1.127,0.157,-0.956,-2.218,-3.613,-5.111,-6.673,-8.258,-9.826,-11.346,-12.804,-14.207,-15.594,-17.029,-18.568,-20.171,-21.227,-1.725,147.416],
[-171.326,-171.841,-173.297,-176.424,175.211,112.878,28.983,18.645,14.558,12.047,10.193,8.710,7.479,6.436,5.533,4.720,3.944,3.149,2.276,1.272,0.106,-1.232,-2.719,-4.316,-5.969,-7.621,-9.224,-10.742,-12.163,-13.508,-14.831,-16.223,-17.785,-19.581,-21.489,-20.030,152.416],
[-176.326,-177.799,179.169,172.852,155.709,90.781,39.071,25.195,19.094,15.421,12.828,10.845,9.272,7.999,6.949,6.054,5.243,4.440,3.571,2.570,1.392,0.024,-1.513,-3.168,-4.877,-6.570,-8.191,-9.697,-11.078,-12.360,-13.613,-14.945,-16.488,-18.379,-20.815,-27.106,157.416],
[178.674,176.241,171.597,162.068,138.008,82.503,44.397,29.886,22.729,18.305,15.186,12.826,10.980,9.513,8.335,7.367,6.528,5.733,4.894,3.931,2.787,1.440,-0.093,-1.760,-3.486,-5.194,-6.815,-8.301,-9.639,-10.858,-12.038,-13.301,-14.798,-16.720,-19.483,-29.458,162.416],
[173.674,170.291,164.059,151.579,123.616,77.580,47.231,33.176,25.573,20.710,17.241,14.609,12.551,10.925,9.636,8.602,7.742,6.965,6.175,5.282,4.214,2.935,1.455,-0.178,-1.885,-3.582,-5.188,-6.644,-7.934,-9.089,-10.192,-11.376,-12.808,-14.720,-17.687,-29.662,167.416],
[168.674,164.365,156.623,141.679,112.399,73.953,48.664,35.427,27.739,22.657,18.974,16.155,13.942,12.191,10.811,9.724,8.850,8.099,7.373,6.572,5.612,4.443,3.058,1.499,-0.157,-1.817,-3.389,-4.805,-6.039,-7.122,-8.143,-9.239,-10.592,-12.464,-15.560,-28.797,172.416],
[163.674,158.475,149.352,132.552,103.621,70.972,49.252,36.906,29.332,24.176,20.376,17.439,15.116,13.272,11.820,10.689,9.806,9.086,8.430,7.735,6.908,5.880,4.630,3.185,1.616,0.024,-1.491,-2.847,-4.012,-5.015,-5.945,-6.946,-8.207,-10.022,-13.202,-27.382,177.416],
[158.674,152.634,142.298,124.264,96.587,68.371,49.305,37.809,30.451,25.309,21.458,18.448,16.047,14.130,12.617,11.446,10.551,9.855,9.266,8.682,8.001,7.144,6.066,4.780,3.345,1.863,0.442,-0.825,-1.901,-2.809,-3.641,-4.538,-5.701,-7.446,-10.688,-25.704,-177.584],
[153.674,146.853,135.498,116.796,90.787,66.022,49.007,38.283,31.182,26.108,22.248,19.194,16.734,14.753,13.180,11.960,11.038,10.349,9.810,9.326,8.795,8.126,7.259,6.182,4.941,3.627,2.354,1.215,0.258,-0.540,-1.263,-2.052,-3.110,-4.780,-8.078,-23.949,-172.584]
];
private _x = (_long + 180) / _size;
private _x1 = floor _x;
private _x2 = (_x1 + 1) % (360 / _size);
_x = _x % 1;
private _y = (_lat + 90) / _size;
private _y1 = floor _y;
private _y2 = (_y1 + 1) % (180 / _size);
_y = _y % 1;
private _q11 = (1-_x) * (1-_y) * (_data # _x1 # _y1);
private _q12 = (1-_x) * _y * (_data # _x1 # _y2);
private _q21 = _x * (1-_y) * (_data # _x2 # _y1);
private _q22 = _x * _y * (_data # _x2 # _y2);
GVAR(magneticDeclinationOffset) = _q11 + _q12 + _q21 + _q22;
setCompassDeclination rad GVAR(magneticDeclinationOffset);

View File

@ -100,3 +100,13 @@ private _categoryColors = [_category, format ["| %1 |", LLSTRING(subcategory_col
[[0, 1, 2], [LSTRING(None), LSTRING(progressBarInfoPercentage), LSTRING(progressBarInfoTime)], 2],
0
] call CBA_fnc_addSetting;
[
QGVAR(magneticDeclination),
"CHECKBOX",
["mag test"], // [LSTRING(magneticDeclination), LSTRING(magneticDeclinationooltip)],
format ["ACE %1", localize LSTRING(DisplayName)],
false,
true,
{call FUNC(getMagneticBearingOffset)}
] call CBA_fnc_addSetting;

View File

@ -27,7 +27,7 @@ if (CBA_missionTime < GVAR(mapGpsNextUpdate)) exitWith {};
GVAR(mapGpsNextUpdate) = CBA_missionTime + 0.5;
private _ctrl = _mapDisplay displayCtrl 913590;
_ctrl ctrlSetText str (round (getDir ACE_player)); // Set Heading
_ctrl ctrlSetText str (round ([ACE_player] call EFUNC(common,getMagneticBearing))); // Set Heading
_ctrl = _mapDisplay displayCtrl 913591;
_ctrl ctrlSetText str (round ((getPosASL ACE_player) select 2) + EGVAR(common,mapAltitude)); // Set Altitude
_ctrl = _mapDisplay displayCtrl 913592;