From 422e175f09229fc7c80b8a1ff5903eae33cea1b9 Mon Sep 17 00:00:00 2001 From: ulteq Date: Sat, 18 Apr 2015 15:08:54 +0200 Subject: [PATCH] Implemented the dual wind speed feature --- addons/atragmx/RscTitles.hpp | 2 +- .../functions/fnc_calculate_range_card.sqf | 7 +- .../fnc_calculate_scope_base_angle.sqf | 2 +- .../functions/fnc_calculate_solution.sqf | 66 +++++++++++-------- .../fnc_calculate_target_solution.sqf | 10 +-- addons/atragmx/functions/fnc_change_gun.sqf | 3 +- addons/atragmx/functions/fnc_init.sqf | 4 +- .../functions/fnc_restore_user_data.sqf | 1 + .../atragmx/functions/fnc_store_user_data.sqf | 1 + .../functions/fnc_update_range_card.sqf | 30 ++++++--- .../fnc_update_relative_click_memory.sqf | 2 +- .../atragmx/functions/fnc_update_result.sqf | 28 ++++++-- .../atragmx/functions/fnc_update_target.sqf | 14 +++- .../functions/fnc_update_zero_range.sqf | 2 +- 14 files changed, 115 insertions(+), 57 deletions(-) diff --git a/addons/atragmx/RscTitles.hpp b/addons/atragmx/RscTitles.hpp index 592374ddad..0752f8beb7 100644 --- a/addons/atragmx/RscTitles.hpp +++ b/addons/atragmx/RscTitles.hpp @@ -573,7 +573,7 @@ class ATragMX_Display { x=0.550*safezoneW+safezoneX+0.11; y=0.265*safezoneH+safezoneY+0.57; 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 { idc=420; diff --git a/addons/atragmx/functions/fnc_calculate_range_card.sqf b/addons/atragmx/functions/fnc_calculate_range_card.sqf index 359f7ab4ee..c11cf90550 100644 --- a/addons/atragmx/functions/fnc_calculate_range_card.sqf +++ b/addons/atragmx/functions/fnc_calculate_range_card.sqf @@ -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); _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)); _inclinationAngle = (GVAR(inclinationAngle) select GVAR(currentTarget)); _targetSpeed = (GVAR(targetSpeed) select GVAR(currentTarget)); @@ -76,4 +77,4 @@ GVAR(rangeCardData) = []; private ["_result"]; _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); diff --git a/addons/atragmx/functions/fnc_calculate_scope_base_angle.sqf b/addons/atragmx/functions/fnc_calculate_scope_base_angle.sqf index 4995c31a61..76c54f63a9 100644 --- a/addons/atragmx/functions/fnc_calculate_scope_base_angle.sqf +++ b/addons/atragmx/functions/fnc_calculate_scope_base_angle.sqf @@ -35,6 +35,6 @@ _barometricPressure = 1013.25; _relativeHumidity = 0; 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 diff --git a/addons/atragmx/functions/fnc_calculate_solution.sqf b/addons/atragmx/functions/fnc_calculate_solution.sqf index f7f23044e3..242e2e9c48 100644 --- a/addons/atragmx/functions/fnc_calculate_solution.sqf +++ b/addons/atragmx/functions/fnc_calculate_solution.sqf @@ -12,7 +12,7 @@ * 6: barometric pressure * 7: relative humidity * 8: simulation steps - * 9: wind speed + * 9: wind speed * 10: wind direction * 11: inclination angle * 12: target speed @@ -26,15 +26,15 @@ * 20: Latitude * * Return Value: - * 0: Elevation - * 1: Windage - * 2: Lead - * 3: Time of fligth - * 4: Remaining velocity - * 5: Remaining kinetic energy - * 6: Vertical coriolis drift - * 7: Horizontal coriolis drift - * 8: Spin drift + * 0: Elevation (MOA) + * 1: Windage (MOA) + * 2: Lead (MOA) + * 3: Time of fligth (SECONDS) + * 4: Remaining velocity (m/s) + * 5: Remaining kinetic energy (ft·lb) + * 6: Vertical coriolis drift (MOA) + * 7: Horizontal coriolis drift (MOA) + * 8: Spin drift (MOA) * * Example: * call ace_atragmx_calculate_target_range_assist @@ -43,7 +43,7 @@ */ #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; _bulletMass = _this select 1; _boreHeight = _this select 2; @@ -53,7 +53,8 @@ _temperature = _this select 5; _barometricPressure = _this select 6; _relativeHumidity = _this select 7; _simSteps = _this select 8; -_windSpeed = _this select 9; +_windSpeed1 = (_this select 9) select 0; +_windSpeed2 = (_this select 9) select 1; _windDirection = _this select 10; _inclinationAngle = _this select 11; _targetSpeed = _this select 12; @@ -74,9 +75,10 @@ _bulletSpeed = 0; _gravity = [0, sin(_scopeBaseAngle + _inclinationAngle) * -9.80665, cos(_scopeBaseAngle + _inclinationAngle) * -9.80665]; _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; -_windage = 0; +_windage1 = 0; +_windage2 = 0; _lead = 0; _TOF = 0; _trueVelocity = [0, 0, 0]; @@ -99,8 +101,10 @@ if (_storeRangeCardData) then { GVAR(rangeCardData) = []; }; -private ["_wind"]; -_wind = [cos(270 - _windDirection * 30) * _windSpeed, sin(270 - _windDirection * 30) * _windSpeed, 0]; +private ["_wind1", "_wind2", "_windDrift"]; +_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 { _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; _speedAverage = (_speedTotal / _stepsTotal); - _trueVelocity = _bulletVelocity vectorDiff _wind; + _trueVelocity = _bulletVelocity vectorDiff _wind1; _trueSpeed = vectorMagnitude _trueVelocity; 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) > 0) then { _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 { _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 ((_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)); - _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 ((_bulletPos select 1) > 0) then { _spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83; _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; }; }; @@ -187,7 +195,9 @@ while {_TOF < 15 && (_bulletPos select 1) < _targetRange} do { if ((_bulletPos select 1) > 0) then { _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 { @@ -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 ((_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)); - _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 ((_bulletPos select 1) > 0) then { _spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83; _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] diff --git a/addons/atragmx/functions/fnc_calculate_target_solution.sqf b/addons/atragmx/functions/fnc_calculate_target_solution.sqf index 764f21cfc9..c8a3683498 100644 --- a/addons/atragmx/functions/fnc_calculate_target_solution.sqf +++ b/addons/atragmx/functions/fnc_calculate_target_solution.sqf @@ -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); _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); _inclinationAngle = GVAR(inclinationAngle) select GVAR(currentTarget); _targetSpeed = GVAR(targetSpeed) select GVAR(currentTarget); @@ -71,10 +72,11 @@ _targetRange = GVAR(targetRange) select GVAR(currentTarget); private ["_result"]; _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(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(tofOutput) set [GVAR(currentTarget), _result select 3]; GVAR(velocityOutput) set [GVAR(currentTarget), _result select 4]; diff --git a/addons/atragmx/functions/fnc_change_gun.sqf b/addons/atragmx/functions/fnc_change_gun.sqf index 9b0f18c185..c753f644a4 100644 --- a/addons/atragmx/functions/fnc_change_gun.sqf +++ b/addons/atragmx/functions/fnc_change_gun.sqf @@ -35,7 +35,8 @@ if ((GVAR(scopeUnits) select GVAR(currentScopeUnit)) != "Clicks") then { [] call FUNC(update_gun_ammo_data); 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(tofOutput) set [GVAR(currentTarget), 0]; GVAR(velocityOutput) set [GVAR(currentTarget), 0]; diff --git a/addons/atragmx/functions/fnc_init.sqf b/addons/atragmx/functions/fnc_init.sqf index efbd39ef81..881f65a6b0 100644 --- a/addons/atragmx/functions/fnc_init.sqf +++ b/addons/atragmx/functions/fnc_init.sqf @@ -56,8 +56,10 @@ GVAR(inclinationAngle) = [0, 0, 0, 0]; GVAR(targetSpeed) = [0, 0, 0, 0]; GVAR(targetRange) = [0, 0, 0, 0]; +GVAR(showWind2) = false; 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(tofOutput) = [0, 0, 0, 0]; GVAR(velocityOutput) = [0, 0, 0, 0]; diff --git a/addons/atragmx/functions/fnc_restore_user_data.sqf b/addons/atragmx/functions/fnc_restore_user_data.sqf index 7c011198d6..6fddc4bed5 100644 --- a/addons/atragmx/functions/fnc_restore_user_data.sqf +++ b/addons/atragmx/functions/fnc_restore_user_data.sqf @@ -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(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(directionOfFire) = profileNamespace getVariable ["ACE_ATragMX_directionOfFire", [0, 0, 0, 0]]; GVAR(windSpeed1) = profileNamespace getVariable ["ACE_ATragMX_windSpeed1", [0, 0, 0, 0]]; diff --git a/addons/atragmx/functions/fnc_store_user_data.sqf b/addons/atragmx/functions/fnc_store_user_data.sqf index 81a4476d75..6a66b96ea3 100644 --- a/addons/atragmx/functions/fnc_store_user_data.sqf +++ b/addons/atragmx/functions/fnc_store_user_data.sqf @@ -26,6 +26,7 @@ profileNamespace setVariable ["ACE_ATragMX_temperature", GVAR(temperature)]; profileNamespace setVariable ["ACE_ATragMX_barometricPressure", GVAR(barometricPressure)]; profileNamespace setVariable ["ACE_ATragMX_relativeHumidity", GVAR(relativeHumidity)]; +profileNamespace setVariable ["ACE_ATragMX_showWind2", GVAR(showWind2)]; profileNamespace setVariable ["latitude", GVAR(latitude)]; profileNamespace setVariable ["directionOfFire", GVAR(directionOfFire)]; profileNamespace setVariable ["ACE_ATragMX_windSpeed1", GVAR(windSpeed1)]; diff --git a/addons/atragmx/functions/fnc_update_range_card.sqf b/addons/atragmx/functions/fnc_update_range_card.sqf index 871e5fa268..0c49b6f794 100644 --- a/addons/atragmx/functions/fnc_update_range_card.sqf +++ b/addons/atragmx/functions/fnc_update_range_card.sqf @@ -15,10 +15,14 @@ */ #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 = ""; -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 { ctrlSetText [5003, "Yards"]; @@ -31,7 +35,8 @@ lnbClear 5007; { _range = _x select 0; _elevation = _x select 1; - _windage = _x select 2; + _windage1 = (_x select 2) select 0; + _windage2 = (_x select 2) select 1; _lead = _x select 3; _TOF = _x select 4; _velocity = _x select 5; @@ -40,23 +45,26 @@ lnbClear 5007; switch (GVAR(currentScopeUnit)) do { case 0: { _elevation = _elevation / 3.38; - _windage = _windage / 3.38; - }; + _windage1 = _windage1 / 3.38; + _windage2 = _windage2 / 3.38; + }; case 2: { _elevation = _elevation * 1.047; - _windage = _windage * 1.047; + _windage1 = _windage1 * 1.047; + _windage2 = _windage2 * 1.047; }; case 3: { _elevationScopeStep = (GVAR(workingMemory) select 7); _windageScopeStep = (GVAR(workingMemory) select 8); _elevation = Round(_elevation / _elevationScopeStep); - _windage = Round(_windage / _windageScopeStep); + _windage1 = Round(_windage1 / _windageScopeStep); + _windage2 = Round(_windage2 / _windageScopeStep); }; }; _elevationOutput = Str(Round(_elevation * 100) / 100); - _windageOutput = Str(Round(_windage * 100) / 100); + _windageOutput = Str(Round(_windage1 * 100) / 100); _rangeOutput = Str(_range); if (_velocity < 340.29) then { @@ -69,7 +77,11 @@ lnbClear 5007; switch (GVAR(rangeCardCurrentColumn)) do { case 0: { - _lastColumnOutput = Str(Round(_lead * 100) / 100); + if (GVAR(showWind2)) then { + _lastColumnOutput = Str(Round(_windage2 * 100) / 100); + } else { + _lastColumnOutput = Str(Round(_lead * 100) / 100); + }; }; case 1: { _lastColumnOutput = Str(Round(_velocity)); diff --git a/addons/atragmx/functions/fnc_update_relative_click_memory.sqf b/addons/atragmx/functions/fnc_update_relative_click_memory.sqf index 1d5add83db..1dc534ce4b 100644 --- a/addons/atragmx/functions/fnc_update_relative_click_memory.sqf +++ b/addons/atragmx/functions/fnc_update_relative_click_memory.sqf @@ -16,6 +16,6 @@ #include "script_component.hpp" 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); diff --git a/addons/atragmx/functions/fnc_update_result.sqf b/addons/atragmx/functions/fnc_update_result.sqf index 6898920eac..a86170fd45 100644 --- a/addons/atragmx/functions/fnc_update_result.sqf +++ b/addons/atragmx/functions/fnc_update_result.sqf @@ -15,9 +15,11 @@ */ #include "script_component.hpp" -private ["_elevationAbs", "_elevationRel", "_elevationCur", "_windageAbs", "_windageRel", "_windageCur", "_lead", "_elevationScopeStep", "_windageScopeStep"]; -_elevationAbs = (GVAR(elevationOutput) select GVAR(currentTarget)); -_windageAbs = (GVAR(windageOutput) select GVAR(currentTarget)); +private ["_elevationAbs", "_elevationRel", "_elevationCur", "_windageAbs", "_wind2", "_windageRel", "_windageCur", "_lead", "_elevationScopeStep", "_windageScopeStep"]; +_elevationAbs = GVAR(elevationOutput) select GVAR(currentTarget); +_windageAbs = GVAR(windage1Output) select GVAR(currentTarget); + +_wind2 = GVAR(windage2Output) select GVAR(currentTarget); _elevationCur = GVAR(workingMemory) select 10; _windageCur = GVAR(workingMemory) select 11; @@ -25,13 +27,15 @@ _windageCur = GVAR(workingMemory) select 11; _elevationRel = _elevationAbs - _elevationCur; _windageRel = _windageAbs - _windageCur; -_lead = (GVAR(leadOutput) select GVAR(currentTarget)); +_lead = GVAR(leadOutput) select GVAR(currentTarget); switch (GVAR(currentScopeUnit)) do { case 0: { _elevationAbs = _elevationAbs / 3.38; _windageAbs = _windageAbs / 3.38; + _wind2 = _wind2 / 3.38; + _elevationRel = _elevationRel / 3.38; _windageRel = _windageRel / 3.38; @@ -42,6 +46,8 @@ switch (GVAR(currentScopeUnit)) do { _elevationAbs = _elevationAbs * 1.047; _windageAbs = _windageAbs * 1.047; + _wind2 = _wind2 / 1.047; + _elevationRel = _elevationRel * 1.047; _windageRel = _windageRel * 1.047; @@ -55,6 +61,8 @@ switch (GVAR(currentScopeUnit)) do { _elevationAbs = Round(_elevationAbs / _elevationScopeStep); _windageAbs = Round(_windageAbs / _windageScopeStep); + _wind2 = Round(_wind2 / _windageScopeStep); + _elevationRel = Round(_elevationRel / _elevationScopeStep); _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 [401, Str(Round(_elevationRel * 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 [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)]; +}; \ No newline at end of file diff --git a/addons/atragmx/functions/fnc_update_target.sqf b/addons/atragmx/functions/fnc_update_target.sqf index c5a02c0164..dab62e099d 100644 --- a/addons/atragmx/functions/fnc_update_target.sqf +++ b/addons/atragmx/functions/fnc_update_target.sqf @@ -15,10 +15,18 @@ */ #include "script_component.hpp" -if (GVAR(currentUnit) != 2) then { - ctrlSetText [300, Str(Round((GVAR(windSpeed1) select GVAR(currentTarget)) * 2.23693629 * 100) / 100)]; +if (GVAR(showWind2)) then { + 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 { - ctrlSetText [300, Str(Round((GVAR(windSpeed1) select GVAR(currentTarget)) * 100) / 100)]; + 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 [310, Str(Round((GVAR(windDirection) select GVAR(currentTarget))))]; ctrlSetText [320, Str(Round((GVAR(inclinationAngle) select GVAR(currentTarget))))]; diff --git a/addons/atragmx/functions/fnc_update_zero_range.sqf b/addons/atragmx/functions/fnc_update_zero_range.sqf index 6e2a9c566c..a5cab3755e 100644 --- a/addons/atragmx/functions/fnc_update_zero_range.sqf +++ b/addons/atragmx/functions/fnc_update_zero_range.sqf @@ -44,7 +44,7 @@ _barometricPressure = GVAR(barometricPressure); _relativeHumidity = GVAR(relativeHumidity); 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 [3, _scopeBaseAngle + (_result select 0) / 60];