Implemented the dual wind speed feature

This commit is contained in:
ulteq 2015-04-18 15:08:54 +02:00
parent 4449c99eba
commit 422e175f09
14 changed files with 115 additions and 57 deletions

View File

@ -573,7 +573,7 @@ class ATragMX_Display {
x=0.550*safezoneW+safezoneX+0.11; x=0.550*safezoneW+safezoneX+0.11;
y=0.265*safezoneH+safezoneY+0.57; y=0.265*safezoneH+safezoneY+0.57;
text="Lead"; text="Lead";
action=""; action=QUOTE(GVAR(showWind2) = !GVAR(showWind2); call FUNC(update_result); call FUNC(update_target));
}; };
class TEXT_LEAD_OUTPUT: TEXT_ELEVATION_OUTPUT_ABSOLUTE { class TEXT_LEAD_OUTPUT: TEXT_ELEVATION_OUTPUT_ABSOLUTE {
idc=420; idc=420;

View File

@ -60,10 +60,11 @@ if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false])
}; };
}; };
private ["_latitude", "_directionOfFire", "_windSpeed", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange"]; private ["_latitude", "_directionOfFire", "_windSpeed1", "_windSpeed2", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange"];
_latitude = GVAR(latitude) select GVAR(currentTarget); _latitude = GVAR(latitude) select GVAR(currentTarget);
_directionOfFire = GVAR(directionOfFire) select GVAR(currentTarget); _directionOfFire = GVAR(directionOfFire) select GVAR(currentTarget);
_windSpeed = (GVAR(windSpeed1) select GVAR(currentTarget)); _windSpeed1 = (GVAR(windSpeed1) select GVAR(currentTarget));
_windSpeed2 = (GVAR(windSpeed2) select GVAR(currentTarget));
_windDirection = (GVAR(windDirection) select GVAR(currentTarget)); _windDirection = (GVAR(windDirection) select GVAR(currentTarget));
_inclinationAngle = (GVAR(inclinationAngle) select GVAR(currentTarget)); _inclinationAngle = (GVAR(inclinationAngle) select GVAR(currentTarget));
_targetSpeed = (GVAR(targetSpeed) select GVAR(currentTarget)); _targetSpeed = (GVAR(targetSpeed) select GVAR(currentTarget));
@ -76,4 +77,4 @@ GVAR(rangeCardData) = [];
private ["_result"]; private ["_result"];
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, _result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000,
_windSpeed, _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, true, _stabilityFactor, _twistDirection, _latitude] call FUNC(calculate_solution); [_windSpeed1, _windSpeed2], _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, true, _stabilityFactor, _twistDirection, _latitude] call FUNC(calculate_solution);

View File

@ -35,6 +35,6 @@ _barometricPressure = 1013.25;
_relativeHumidity = 0; _relativeHumidity = 0;
private ["_result"]; private ["_result"];
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, 0, 0, 0, 0, _zeroRange, _airFriction, 1, "ICAO", false, 1.5, 0, 0] call FUNC(calculate_solution); _result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, [0, 0], 0, 0, 0, _zeroRange, _airFriction, 1, "ICAO", false, 1.5, 0, 0] call FUNC(calculate_solution);
_scopeBaseAngle + (_result select 0) / 60 _scopeBaseAngle + (_result select 0) / 60

View File

@ -12,7 +12,7 @@
* 6: barometric pressure <NUMBER> * 6: barometric pressure <NUMBER>
* 7: relative humidity <NUMBER> * 7: relative humidity <NUMBER>
* 8: simulation steps <NUMBER> * 8: simulation steps <NUMBER>
* 9: wind speed <NUMBER> * 9: wind speed <ARRAY>
* 10: wind direction <NUMBER> * 10: wind direction <NUMBER>
* 11: inclination angle <NUMBER> * 11: inclination angle <NUMBER>
* 12: target speed <NUMBER> * 12: target speed <NUMBER>
@ -26,15 +26,15 @@
* 20: Latitude <NUMBER> * 20: Latitude <NUMBER>
* *
* Return Value: * Return Value:
* 0: Elevation <NUMBER> * 0: Elevation (MOA) <NUMBER>
* 1: Windage <NUMBER> * 1: Windage (MOA) <ARRAY>
* 2: Lead <NUMBER> * 2: Lead (MOA) <NUMBER>
* 3: Time of fligth <NUMBER> * 3: Time of fligth (SECONDS) <NUMBER>
* 4: Remaining velocity <NUMBER> * 4: Remaining velocity (m/s) <NUMBER>
* 5: Remaining kinetic energy <NUMBER> * 5: Remaining kinetic energy (ft·lb) <NUMBER>
* 6: Vertical coriolis drift <NUMBER> * 6: Vertical coriolis drift (MOA) <NUMBER>
* 7: Horizontal coriolis drift <NUMBER> * 7: Horizontal coriolis drift (MOA) <NUMBER>
* 8: Spin drift <NUMBER> * 8: Spin drift (MOA) <NUMBER>
* *
* Example: * Example:
* call ace_atragmx_calculate_target_range_assist * call ace_atragmx_calculate_target_range_assist
@ -43,7 +43,7 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_scopeBaseAngle", "_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_temperature", "_barometricPressure", "_relativeHumidity", "_simSteps", "_windSpeed", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange", "_bc", "_dragModel", "_atmosphereModel", "_storeRangeCardData", "_stabilityFactor", "_twistDirection", "_latitude"]; private ["_scopeBaseAngle", "_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_temperature", "_barometricPressure", "_relativeHumidity", "_simSteps", "_windSpeed1", "_windSpeed2", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange", "_bc", "_dragModel", "_atmosphereModel", "_storeRangeCardData", "_stabilityFactor", "_twistDirection", "_latitude"];
_scopeBaseAngle = _this select 0; _scopeBaseAngle = _this select 0;
_bulletMass = _this select 1; _bulletMass = _this select 1;
_boreHeight = _this select 2; _boreHeight = _this select 2;
@ -53,7 +53,8 @@ _temperature = _this select 5;
_barometricPressure = _this select 6; _barometricPressure = _this select 6;
_relativeHumidity = _this select 7; _relativeHumidity = _this select 7;
_simSteps = _this select 8; _simSteps = _this select 8;
_windSpeed = _this select 9; _windSpeed1 = (_this select 9) select 0;
_windSpeed2 = (_this select 9) select 1;
_windDirection = _this select 10; _windDirection = _this select 10;
_inclinationAngle = _this select 11; _inclinationAngle = _this select 11;
_targetSpeed = _this select 12; _targetSpeed = _this select 12;
@ -74,9 +75,10 @@ _bulletSpeed = 0;
_gravity = [0, sin(_scopeBaseAngle + _inclinationAngle) * -9.80665, cos(_scopeBaseAngle + _inclinationAngle) * -9.80665]; _gravity = [0, sin(_scopeBaseAngle + _inclinationAngle) * -9.80665, cos(_scopeBaseAngle + _inclinationAngle) * -9.80665];
_deltaT = 1 / _simSteps; _deltaT = 1 / _simSteps;
private ["_elevation", "_windage", "_lead", "_TOF", "_trueVelocity", "_trueSpeed", "_kineticEnergy", "_verticalCoriolis", "_verticalDeflection", "_horizontalCoriolis", "_horizontalDeflection", "_spinDrift", "_spinDeflection"]; private ["_elevation", "_windage1", "_windage2", "_lead", "_TOF", "_trueVelocity", "_trueSpeed", "_kineticEnergy", "_verticalCoriolis", "_verticalDeflection", "_horizontalCoriolis", "_horizontalDeflection", "_spinDrift", "_spinDeflection"];
_elevation = 0; _elevation = 0;
_windage = 0; _windage1 = 0;
_windage2 = 0;
_lead = 0; _lead = 0;
_TOF = 0; _TOF = 0;
_trueVelocity = [0, 0, 0]; _trueVelocity = [0, 0, 0];
@ -99,8 +101,10 @@ if (_storeRangeCardData) then {
GVAR(rangeCardData) = []; GVAR(rangeCardData) = [];
}; };
private ["_wind"]; private ["_wind1", "_wind2", "_windDrift"];
_wind = [cos(270 - _windDirection * 30) * _windSpeed, sin(270 - _windDirection * 30) * _windSpeed, 0]; _wind1 = [cos(270 - _windDirection * 30) * _windSpeed1, sin(270 - _windDirection * 30) * _windSpeed1, 0];
_wind2 = [cos(270 - _windDirection * 30) * _windSpeed2, sin(270 - _windDirection * 30) * _windSpeed2, 0];
_windDrift = 0;
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then { if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then {
_bc = [_bc, _temperature, _barometricPressure, _relativeHumidity, _atmosphereModel] call EFUNC(advanced_ballistics,calculateAtmosphericCorrection); _bc = [_bc, _temperature, _barometricPressure, _relativeHumidity, _atmosphereModel] call EFUNC(advanced_ballistics,calculateAtmosphericCorrection);
}; };
@ -127,7 +131,7 @@ while {_TOF < 15 && (_bulletPos select 1) < _targetRange} do {
_stepsTotal = _stepsTotal + 1; _stepsTotal = _stepsTotal + 1;
_speedAverage = (_speedTotal / _stepsTotal); _speedAverage = (_speedTotal / _stepsTotal);
_trueVelocity = _bulletVelocity vectorDiff _wind; _trueVelocity = _bulletVelocity vectorDiff _wind1;
_trueSpeed = vectorMagnitude _trueVelocity; _trueSpeed = vectorMagnitude _trueVelocity;
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
@ -156,7 +160,9 @@ while {_TOF < 15 && (_bulletPos select 1) < _targetRange} do {
if ((_bulletPos select 1) * _rangeFactor >= _range && _range <= GVAR(rangeCardEndRange)) then { if ((_bulletPos select 1) * _rangeFactor >= _range && _range <= GVAR(rangeCardEndRange)) then {
if ((_bulletPos select 1) > 0) then { if ((_bulletPos select 1) > 0) then {
_elevation = - atan((_bulletPos select 2) / (_bulletPos select 1)); _elevation = - atan((_bulletPos select 2) / (_bulletPos select 1));
_windage = - atan((_bulletPos select 0) / (_bulletPos select 1)); _windage1 = - atan((_bulletPos select 0) / (_bulletPos select 1));
_windDrift = (_wind2 select 0) * (_TOF - (_range / _rangeFactor) / _muzzleVelocity);
_windage2 = - atan(_windDrift / (_bulletPos select 1));
}; };
if (_range != 0) then { if (_range != 0) then {
_lead = (_targetSpeed * _TOF) / (Tan(3.38 / 60) * _range); _lead = (_targetSpeed * _TOF) / (Tan(3.38 / 60) * _range);
@ -166,20 +172,22 @@ while {_TOF < 15 && (_bulletPos select 1) < _targetRange} do {
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,CoriolisEnabled), false])) then { if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,CoriolisEnabled), false])) then {
if ((_bulletPos select 1) > 0) then { if ((_bulletPos select 1) > 0) then {
_horizontalDeflection = 0.0000729 * ((_bulletPos select 0) ^ 2) * sin(_latitude) / _speedAverage; _horizontalDeflection = 0.0000729 * ((_bulletPos select 1) ^ 2) * sin(_latitude) / _speedAverage;
_horizontalCoriolis = - atan(_horizontalDeflection / (_bulletPos select 1)); _horizontalCoriolis = - atan(_horizontalDeflection / (_bulletPos select 1));
_windage = _windage + _horizontalCoriolis; _windage1 = _windage1 + _horizontalCoriolis;
_windage2 = _windage2 + _horizontalCoriolis;
}; };
}; };
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false])) then { if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false])) then {
if ((_bulletPos select 1) > 0) then { if ((_bulletPos select 1) > 0) then {
_spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83; _spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83;
_spinDrift = - atan(_spinDeflection / (_bulletPos select 1)); _spinDrift = - atan(_spinDeflection / (_bulletPos select 1));
_windage = _windage + _spinDrift; _windage1 = _windage1 + _spinDrift;
_windage2 = _windage2 + _spinDrift;
}; };
}; };
GVAR(rangeCardData) set [_n, [_range, _elevation * 60, _windage * 60, _lead, _TOF, _bulletSpeed, _kineticEnergy]]; GVAR(rangeCardData) set [_n, [_range, _elevation * 60, [_windage1 * 60, _windage2 * 60], _lead, _TOF, _bulletSpeed, _kineticEnergy]];
_n = _n + 1; _n = _n + 1;
}; };
}; };
@ -187,7 +195,9 @@ while {_TOF < 15 && (_bulletPos select 1) < _targetRange} do {
if ((_bulletPos select 1) > 0) then { if ((_bulletPos select 1) > 0) then {
_elevation = - atan((_bulletPos select 2) / (_bulletPos select 1)); _elevation = - atan((_bulletPos select 2) / (_bulletPos select 1));
_windage = - atan((_bulletPos select 0) / (_bulletPos select 1)); _windage1 = - atan((_bulletPos select 0) / (_bulletPos select 1));
_windDrift = (_wind2 select 0) * (_TOF - _targetRange / _muzzleVelocity);
_windage2 = - atan(_windDrift / (_bulletPos select 1));
}; };
if (_targetRange != 0) then { if (_targetRange != 0) then {
@ -199,17 +209,19 @@ _kineticEnergy = _kineticEnergy * 0.737562149;
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,CoriolisEnabled), false])) then { if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,CoriolisEnabled), false])) then {
if ((_bulletPos select 1) > 0) then { if ((_bulletPos select 1) > 0) then {
_horizontalDeflection = 0.0000729 * ((_bulletPos select 0) ^ 2) * sin(_latitude) / _speedAverage; _horizontalDeflection = 0.0000729 * ((_bulletPos select 1) ^ 2) * sin(_latitude) / _speedAverage;
_horizontalCoriolis = - atan(_horizontalDeflection / (_bulletPos select 1)); _horizontalCoriolis = - atan(_horizontalDeflection / (_bulletPos select 1));
_windage = _windage + _horizontalCoriolis; _windage1 = _windage1 + _horizontalCoriolis;
_windage2 = _windage2 + _horizontalCoriolis;
}; };
}; };
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false])) then { if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false])) then {
if ((_bulletPos select 1) > 0) then { if ((_bulletPos select 1) > 0) then {
_spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83; _spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83;
_spinDrift = - atan(_spinDeflection / (_bulletPos select 1)); _spinDrift = - atan(_spinDeflection / (_bulletPos select 1));
_windage = _windage + _spinDrift; _windage1 = _windage1 + _spinDrift;
_windage2 = _windage2 + _spinDrift;
}; };
}; };
[_elevation * 60, _windage * 60, _lead, _TOF, _bulletSpeed, _kineticEnergy, _verticalCoriolis, _horizontalCoriolis, _spinDrift] [_elevation * 60, [_windage1 * 60, _windage2 * 60], _lead, _TOF, _bulletSpeed, _kineticEnergy, _verticalCoriolis * 60, _horizontalCoriolis * 60, _spinDrift * 60]

View File

@ -60,10 +60,11 @@ if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false])
}; };
}; };
private ["_latitude", "_directionOfFire", "_windSpeed", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange"]; private ["_latitude", "_directionOfFire", "_windSpeed1", "_windSpeed2", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange"];
_latitude = GVAR(latitude) select GVAR(currentTarget); _latitude = GVAR(latitude) select GVAR(currentTarget);
_directionOfFire = GVAR(directionOfFire) select GVAR(currentTarget); _directionOfFire = GVAR(directionOfFire) select GVAR(currentTarget);
_windSpeed = GVAR(windSpeed1) select GVAR(currentTarget); _windSpeed1 = GVAR(windSpeed1) select GVAR(currentTarget);
_windSpeed2 = GVAR(windSpeed2) select GVAR(currentTarget);
_windDirection = GVAR(windDirection) select GVAR(currentTarget); _windDirection = GVAR(windDirection) select GVAR(currentTarget);
_inclinationAngle = GVAR(inclinationAngle) select GVAR(currentTarget); _inclinationAngle = GVAR(inclinationAngle) select GVAR(currentTarget);
_targetSpeed = GVAR(targetSpeed) select GVAR(currentTarget); _targetSpeed = GVAR(targetSpeed) select GVAR(currentTarget);
@ -71,10 +72,11 @@ _targetRange = GVAR(targetRange) select GVAR(currentTarget);
private ["_result"]; private ["_result"];
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, _result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000,
_windSpeed, _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, false, _stabilityFactor, _twistDirection, _latitude] call FUNC(calculate_solution); [_windSpeed1, _windSpeed2], _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, false, _stabilityFactor, _twistDirection, _latitude] call FUNC(calculate_solution);
GVAR(elevationOutput) set [GVAR(currentTarget), _result select 0]; GVAR(elevationOutput) set [GVAR(currentTarget), _result select 0];
GVAR(windageOutput) set [GVAR(currentTarget), _result select 1]; GVAR(windage1Output) set [GVAR(currentTarget), (_result select 1) select 0];
GVAR(windage2Output) set [GVAR(currentTarget), (_result select 1) select 1];
GVAR(leadOutput) set [GVAR(currentTarget), _result select 2]; GVAR(leadOutput) set [GVAR(currentTarget), _result select 2];
GVAR(tofOutput) set [GVAR(currentTarget), _result select 3]; GVAR(tofOutput) set [GVAR(currentTarget), _result select 3];
GVAR(velocityOutput) set [GVAR(currentTarget), _result select 4]; GVAR(velocityOutput) set [GVAR(currentTarget), _result select 4];

View File

@ -35,7 +35,8 @@ if ((GVAR(scopeUnits) select GVAR(currentScopeUnit)) != "Clicks") then {
[] call FUNC(update_gun_ammo_data); [] call FUNC(update_gun_ammo_data);
GVAR(elevationOutput) set [GVAR(currentTarget), 0]; GVAR(elevationOutput) set [GVAR(currentTarget), 0];
GVAR(windageOutput) set [GVAR(currentTarget), 0]; GVAR(windage1Output) set [GVAR(currentTarget), 0];
GVAR(windage2Output) set [GVAR(currentTarget), 0];
GVAR(leadOutput) set [GVAR(currentTarget), 0]; GVAR(leadOutput) set [GVAR(currentTarget), 0];
GVAR(tofOutput) set [GVAR(currentTarget), 0]; GVAR(tofOutput) set [GVAR(currentTarget), 0];
GVAR(velocityOutput) set [GVAR(currentTarget), 0]; GVAR(velocityOutput) set [GVAR(currentTarget), 0];

View File

@ -56,8 +56,10 @@ GVAR(inclinationAngle) = [0, 0, 0, 0];
GVAR(targetSpeed) = [0, 0, 0, 0]; GVAR(targetSpeed) = [0, 0, 0, 0];
GVAR(targetRange) = [0, 0, 0, 0]; GVAR(targetRange) = [0, 0, 0, 0];
GVAR(showWind2) = false;
GVAR(elevationOutput) = [0, 0, 0, 0]; GVAR(elevationOutput) = [0, 0, 0, 0];
GVAR(windageOutput) = [0, 0, 0, 0]; GVAR(windage1Output) = [0, 0, 0, 0];
GVAR(windage2Output) = [0, 0, 0, 0];
GVAR(leadOutput) = [0, 0, 0, 0]; GVAR(leadOutput) = [0, 0, 0, 0];
GVAR(tofOutput) = [0, 0, 0, 0]; GVAR(tofOutput) = [0, 0, 0, 0];
GVAR(velocityOutput) = [0, 0, 0, 0]; GVAR(velocityOutput) = [0, 0, 0, 0];

View File

@ -26,6 +26,7 @@ GVAR(temperature) = -50 max (profileNamespace getVariable ["ACE_ATragMX_temperat
GVAR(barometricPressure) = 340 max (profileNamespace getVariable ["ACE_ATragMX_barometricPressure", 1013.25]) min 1350; GVAR(barometricPressure) = 340 max (profileNamespace getVariable ["ACE_ATragMX_barometricPressure", 1013.25]) min 1350;
GVAR(relativeHumidity) = 0 max (profileNamespace getVariable ["ACE_ATragMX_relativeHumidity", 0.5]) min 1; GVAR(relativeHumidity) = 0 max (profileNamespace getVariable ["ACE_ATragMX_relativeHumidity", 0.5]) min 1;
GVAR(showWind2) = profileNamespace getVariable ["ACE_ATragMX_showWind2", false];
GVAR(latitude) = profileNamespace getVariable ["ACE_ATragMX_latitude", [38, 38, 38, 38]]; GVAR(latitude) = profileNamespace getVariable ["ACE_ATragMX_latitude", [38, 38, 38, 38]];
GVAR(directionOfFire) = profileNamespace getVariable ["ACE_ATragMX_directionOfFire", [0, 0, 0, 0]]; GVAR(directionOfFire) = profileNamespace getVariable ["ACE_ATragMX_directionOfFire", [0, 0, 0, 0]];
GVAR(windSpeed1) = profileNamespace getVariable ["ACE_ATragMX_windSpeed1", [0, 0, 0, 0]]; GVAR(windSpeed1) = profileNamespace getVariable ["ACE_ATragMX_windSpeed1", [0, 0, 0, 0]];

View File

@ -26,6 +26,7 @@ profileNamespace setVariable ["ACE_ATragMX_temperature", GVAR(temperature)];
profileNamespace setVariable ["ACE_ATragMX_barometricPressure", GVAR(barometricPressure)]; profileNamespace setVariable ["ACE_ATragMX_barometricPressure", GVAR(barometricPressure)];
profileNamespace setVariable ["ACE_ATragMX_relativeHumidity", GVAR(relativeHumidity)]; profileNamespace setVariable ["ACE_ATragMX_relativeHumidity", GVAR(relativeHumidity)];
profileNamespace setVariable ["ACE_ATragMX_showWind2", GVAR(showWind2)];
profileNamespace setVariable ["latitude", GVAR(latitude)]; profileNamespace setVariable ["latitude", GVAR(latitude)];
profileNamespace setVariable ["directionOfFire", GVAR(directionOfFire)]; profileNamespace setVariable ["directionOfFire", GVAR(directionOfFire)];
profileNamespace setVariable ["ACE_ATragMX_windSpeed1", GVAR(windSpeed1)]; profileNamespace setVariable ["ACE_ATragMX_windSpeed1", GVAR(windSpeed1)];

View File

@ -15,10 +15,14 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_range", "_elevation", "_windage", "_elevationScopeStep", "_windageScopeStep", "_lead", "_TOF", "_velocity", "_kineticEnergy", "_rangeOutput", "_elevationOutput", "_windageOutput", "_lastColumnOutput"]; private ["_range", "_elevation", "_windage1", "_windage2", "_elevationScopeStep", "_windageScopeStep", "_lead", "_TOF", "_velocity", "_kineticEnergy", "_rangeOutput", "_elevationOutput", "_windageOutput", "_lastColumnOutput"];
_lastColumnOutput = ""; _lastColumnOutput = "";
ctrlSetText [5006, (GVAR(rangeCardLastColumns) select GVAR(rangeCardCurrentColumn))]; if (GVAR(showWind2) && GVAR(rangeCardCurrentColumn) == 0) then {
ctrlSetText [5006, "Wind2"];
} else {
ctrlSetText [5006, (GVAR(rangeCardLastColumns) select GVAR(rangeCardCurrentColumn))];
};
if (GVAR(currentUnit) == 1) then { if (GVAR(currentUnit) == 1) then {
ctrlSetText [5003, "Yards"]; ctrlSetText [5003, "Yards"];
@ -31,7 +35,8 @@ lnbClear 5007;
{ {
_range = _x select 0; _range = _x select 0;
_elevation = _x select 1; _elevation = _x select 1;
_windage = _x select 2; _windage1 = (_x select 2) select 0;
_windage2 = (_x select 2) select 1;
_lead = _x select 3; _lead = _x select 3;
_TOF = _x select 4; _TOF = _x select 4;
_velocity = _x select 5; _velocity = _x select 5;
@ -40,23 +45,26 @@ lnbClear 5007;
switch (GVAR(currentScopeUnit)) do { switch (GVAR(currentScopeUnit)) do {
case 0: { case 0: {
_elevation = _elevation / 3.38; _elevation = _elevation / 3.38;
_windage = _windage / 3.38; _windage1 = _windage1 / 3.38;
_windage2 = _windage2 / 3.38;
}; };
case 2: { case 2: {
_elevation = _elevation * 1.047; _elevation = _elevation * 1.047;
_windage = _windage * 1.047; _windage1 = _windage1 * 1.047;
_windage2 = _windage2 * 1.047;
}; };
case 3: { case 3: {
_elevationScopeStep = (GVAR(workingMemory) select 7); _elevationScopeStep = (GVAR(workingMemory) select 7);
_windageScopeStep = (GVAR(workingMemory) select 8); _windageScopeStep = (GVAR(workingMemory) select 8);
_elevation = Round(_elevation / _elevationScopeStep); _elevation = Round(_elevation / _elevationScopeStep);
_windage = Round(_windage / _windageScopeStep); _windage1 = Round(_windage1 / _windageScopeStep);
_windage2 = Round(_windage2 / _windageScopeStep);
}; };
}; };
_elevationOutput = Str(Round(_elevation * 100) / 100); _elevationOutput = Str(Round(_elevation * 100) / 100);
_windageOutput = Str(Round(_windage * 100) / 100); _windageOutput = Str(Round(_windage1 * 100) / 100);
_rangeOutput = Str(_range); _rangeOutput = Str(_range);
if (_velocity < 340.29) then { if (_velocity < 340.29) then {
@ -69,8 +77,12 @@ lnbClear 5007;
switch (GVAR(rangeCardCurrentColumn)) do { switch (GVAR(rangeCardCurrentColumn)) do {
case 0: { case 0: {
if (GVAR(showWind2)) then {
_lastColumnOutput = Str(Round(_windage2 * 100) / 100);
} else {
_lastColumnOutput = Str(Round(_lead * 100) / 100); _lastColumnOutput = Str(Round(_lead * 100) / 100);
}; };
};
case 1: { case 1: {
_lastColumnOutput = Str(Round(_velocity)); _lastColumnOutput = Str(Round(_velocity));
}; };

View File

@ -16,6 +16,6 @@
#include "script_component.hpp" #include "script_component.hpp"
GVAR(workingMemory) set [10, (GVAR(elevationOutput) select GVAR(currentTarget))]; GVAR(workingMemory) set [10, (GVAR(elevationOutput) select GVAR(currentTarget))];
GVAR(workingMemory) set [11, (GVAR(windageOutput) select GVAR(currentTarget))]; GVAR(workingMemory) set [11, (GVAR(windage1Output) select GVAR(currentTarget))];
[] call FUNC(update_result); [] call FUNC(update_result);

View File

@ -15,9 +15,11 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_elevationAbs", "_elevationRel", "_elevationCur", "_windageAbs", "_windageRel", "_windageCur", "_lead", "_elevationScopeStep", "_windageScopeStep"]; private ["_elevationAbs", "_elevationRel", "_elevationCur", "_windageAbs", "_wind2", "_windageRel", "_windageCur", "_lead", "_elevationScopeStep", "_windageScopeStep"];
_elevationAbs = (GVAR(elevationOutput) select GVAR(currentTarget)); _elevationAbs = GVAR(elevationOutput) select GVAR(currentTarget);
_windageAbs = (GVAR(windageOutput) select GVAR(currentTarget)); _windageAbs = GVAR(windage1Output) select GVAR(currentTarget);
_wind2 = GVAR(windage2Output) select GVAR(currentTarget);
_elevationCur = GVAR(workingMemory) select 10; _elevationCur = GVAR(workingMemory) select 10;
_windageCur = GVAR(workingMemory) select 11; _windageCur = GVAR(workingMemory) select 11;
@ -25,13 +27,15 @@ _windageCur = GVAR(workingMemory) select 11;
_elevationRel = _elevationAbs - _elevationCur; _elevationRel = _elevationAbs - _elevationCur;
_windageRel = _windageAbs - _windageCur; _windageRel = _windageAbs - _windageCur;
_lead = (GVAR(leadOutput) select GVAR(currentTarget)); _lead = GVAR(leadOutput) select GVAR(currentTarget);
switch (GVAR(currentScopeUnit)) do { switch (GVAR(currentScopeUnit)) do {
case 0: { case 0: {
_elevationAbs = _elevationAbs / 3.38; _elevationAbs = _elevationAbs / 3.38;
_windageAbs = _windageAbs / 3.38; _windageAbs = _windageAbs / 3.38;
_wind2 = _wind2 / 3.38;
_elevationRel = _elevationRel / 3.38; _elevationRel = _elevationRel / 3.38;
_windageRel = _windageRel / 3.38; _windageRel = _windageRel / 3.38;
@ -42,6 +46,8 @@ switch (GVAR(currentScopeUnit)) do {
_elevationAbs = _elevationAbs * 1.047; _elevationAbs = _elevationAbs * 1.047;
_windageAbs = _windageAbs * 1.047; _windageAbs = _windageAbs * 1.047;
_wind2 = _wind2 / 1.047;
_elevationRel = _elevationRel * 1.047; _elevationRel = _elevationRel * 1.047;
_windageRel = _windageRel * 1.047; _windageRel = _windageRel * 1.047;
@ -55,6 +61,8 @@ switch (GVAR(currentScopeUnit)) do {
_elevationAbs = Round(_elevationAbs / _elevationScopeStep); _elevationAbs = Round(_elevationAbs / _elevationScopeStep);
_windageAbs = Round(_windageAbs / _windageScopeStep); _windageAbs = Round(_windageAbs / _windageScopeStep);
_wind2 = Round(_wind2 / _windageScopeStep);
_elevationRel = Round(_elevationRel / _elevationScopeStep); _elevationRel = Round(_elevationRel / _elevationScopeStep);
_windageRel = Round(_windageRel / _windageScopeStep); _windageRel = Round(_windageRel / _windageScopeStep);
@ -63,6 +71,12 @@ switch (GVAR(currentScopeUnit)) do {
}; };
}; };
if (GVAR(showWind2)) then {
ctrlSetText [42, "Wind2"];
} else {
ctrlSetText [42, "Lead"];
};
ctrlSetText [400, Str(Round(_elevationAbs * 100) / 100)]; ctrlSetText [400, Str(Round(_elevationAbs * 100) / 100)];
ctrlSetText [401, Str(Round(_elevationRel * 100) / 100)]; ctrlSetText [401, Str(Round(_elevationRel * 100) / 100)];
ctrlSetText [402, Str(Round(_elevationCur * 100) / 100)]; ctrlSetText [402, Str(Round(_elevationCur * 100) / 100)];
@ -71,4 +85,8 @@ ctrlSetText [410, Str(Round(_windageAbs * 100) / 100)];
ctrlSetText [411, Str(Round(_windageRel * 100) / 100)]; ctrlSetText [411, Str(Round(_windageRel * 100) / 100)];
ctrlSetText [412, Str(Round(_windageCur * 100) / 100)]; ctrlSetText [412, Str(Round(_windageCur * 100) / 100)];
ctrlSetText [420, Str(Round(_lead * 100) / 100)]; if (GVAR(showWind2)) then {
ctrlSetText [420, Str(Round(_wind2 * 100) / 100)];
} else {
ctrlSetText [420, Str(Round(_lead * 100) / 100)];
};

View File

@ -15,10 +15,18 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
if (GVAR(currentUnit) != 2) then { if (GVAR(showWind2)) then {
ctrlSetText [300, Str(Round((GVAR(windSpeed1) select GVAR(currentTarget)) * 2.23693629 * 100) / 100)]; if (GVAR(currentUnit) != 2) then {
ctrlSetText [300, format["%1/%2", Round((GVAR(windSpeed1) select GVAR(currentTarget)) * 2.23693629), Round((GVAR(windSpeed2) select GVAR(currentTarget)) * 2.23693629)]];
} else {
ctrlSetText [300, format["%1/%2", Round(GVAR(windSpeed1) select GVAR(currentTarget)), Round(GVAR(windSpeed2) select GVAR(currentTarget))]];
};
} else { } else {
if (GVAR(currentUnit) != 2) then {
ctrlSetText [300, Str(Round((GVAR(windSpeed1) select GVAR(currentTarget)) * 2.23693629 * 100) / 100)];
} else {
ctrlSetText [300, Str(Round((GVAR(windSpeed1) select GVAR(currentTarget)) * 100) / 100)]; ctrlSetText [300, Str(Round((GVAR(windSpeed1) select GVAR(currentTarget)) * 100) / 100)];
};
}; };
ctrlSetText [310, Str(Round((GVAR(windDirection) select GVAR(currentTarget))))]; ctrlSetText [310, Str(Round((GVAR(windDirection) select GVAR(currentTarget))))];
ctrlSetText [320, Str(Round((GVAR(inclinationAngle) select GVAR(currentTarget))))]; ctrlSetText [320, Str(Round((GVAR(inclinationAngle) select GVAR(currentTarget))))];

View File

@ -44,7 +44,7 @@ _barometricPressure = GVAR(barometricPressure);
_relativeHumidity = GVAR(relativeHumidity); _relativeHumidity = GVAR(relativeHumidity);
private ["_result"]; private ["_result"];
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, 0, 0, 0, 0, _zeroRange, _bc, _dragModel, _atmosphereModel, false, 1.5, 0, 0] call FUNC(calculate_solution); _result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, [0, 0], 0, 0, 0, _zeroRange, _bc, _dragModel, _atmosphereModel, false, 1.5, 0, 0] call FUNC(calculate_solution);
GVAR(workingMemory) set [2, _zeroRange]; GVAR(workingMemory) set [2, _zeroRange];
GVAR(workingMemory) set [3, _scopeBaseAngle + (_result select 0) / 60]; GVAR(workingMemory) set [3, _scopeBaseAngle + (_result select 0) / 60];