From eca7657ffacddc3c2fddc3b72019be5e08452781 Mon Sep 17 00:00:00 2001 From: ulteq Date: Sat, 25 Apr 2015 13:34:47 +0200 Subject: [PATCH] Removed a bunch of obsolete code: *Obsolete, as of: https://github.com/acemod/ACE3/commit/6fdaf4c400c9e66c944afe0d291f56cb96d72d71 --- addons/advanced_ballistics/XEH_postInit.sqf | 10 --- .../functions/fnc_handleFired.sqf | 28 ++++--- .../functions/fnc_calculate_range_card.sqf | 2 +- .../functions/fnc_calculate_solution.sqf | 78 +++++++++---------- .../fnc_calculate_target_solution.sqf | 2 +- addons/atragmx/functions/fnc_parse_input.sqf | 4 +- addons/atragmx/functions/fnc_update_gun.sqf | 2 +- .../functions/fnc_update_gun_ammo_data.sqf | 2 +- 8 files changed, 54 insertions(+), 74 deletions(-) diff --git a/addons/advanced_ballistics/XEH_postInit.sqf b/addons/advanced_ballistics/XEH_postInit.sqf index 8d9f47764c..3f0e101d3b 100644 --- a/addons/advanced_ballistics/XEH_postInit.sqf +++ b/addons/advanced_ballistics/XEH_postInit.sqf @@ -20,16 +20,6 @@ GVAR(WindInfoStart) = time; GVAR(Protractor) = false; GVAR(ProtractorStart) = time; -// Those are only used in the pure sqf version (extension free PFH) -GVAR(SimulationPrecision) = 2; -GVAR(WindEnabled) = true; -GVAR(SpinDriftEnabled) = true; -GVAR(CoriolisEnabled) = true; -GVAR(EoetvoesEnabled) = true; -GVAR(AdvancedAirDragEnabled) = true; -GVAR(TransonicRegionEnabled) = true; -GVAR(AtmosphericDensitySimulationEnabled) = true; - GVAR(currentGrid) = 0; GVAR(INIT_MESSAGE_ENABLED) = false; diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf index 8d8d77a812..c21ac6af1f 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf @@ -120,23 +120,21 @@ _dragModel = 1; _ballisticCoefficients = []; _velocityBoundaries = []; _atmosphereModel = "ICAO"; -if (GVAR(AdvancedAirDragEnabled)) then { - if (isNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_dragModel")) then { - _dragModel = getNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_dragModel"); - if (!(_dragModel in [1, 2, 5, 6, 7, 8])) then { - _dragModel = 1; - }; - }; - if (isArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_ballisticCoefficients")) then { - _ballisticCoefficients = getArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_ballisticCoefficients"); - }; - if (isArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_velocityBoundaries")) then { - _velocityBoundaries = getArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_velocityBoundaries"); - }; - if (isText(configFile >> "cfgAmmo" >> _ammo >> "ACE_standardAtmosphere")) then { - _atmosphereModel = getText(configFile >> "cfgAmmo" >> _ammo >> "ACE_standardAtmosphere"); +if (isNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_dragModel")) then { + _dragModel = getNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_dragModel"); + if (!(_dragModel in [1, 2, 5, 6, 7, 8])) then { + _dragModel = 1; }; }; +if (isArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_ballisticCoefficients")) then { + _ballisticCoefficients = getArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_ballisticCoefficients"); +}; +if (isArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_velocityBoundaries")) then { + _velocityBoundaries = getArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_velocityBoundaries"); +}; +if (isText(configFile >> "cfgAmmo" >> _ammo >> "ACE_standardAtmosphere")) then { + _atmosphereModel = getText(configFile >> "cfgAmmo" >> _ammo >> "ACE_standardAtmosphere"); +}; GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000; diff --git a/addons/atragmx/functions/fnc_calculate_range_card.sqf b/addons/atragmx/functions/fnc_calculate_range_card.sqf index f3f27f7d3e..cfaf7441f8 100644 --- a/addons/atragmx/functions/fnc_calculate_range_card.sqf +++ b/addons/atragmx/functions/fnc_calculate_range_card.sqf @@ -54,7 +54,7 @@ if (!GVAR(atmosphereModeTBH)) then { private ["_bulletLength", "_stabilityFactor"]; _bulletLength = 1.8; _stabilityFactor = 1.5; -if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false])) then { +if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { if (_bulletDiameter > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then { _stabilityFactor = [_bulletDiameter / 10 / 2.54, _bulletLength, _bulletMass * 15.4323584, _barrelTwist / 2.54, _muzzleVelocity, _temperature, _barometricPressure] call EFUNC(advanced_ballistics,calculateStabilityFactor); }; diff --git a/addons/atragmx/functions/fnc_calculate_solution.sqf b/addons/atragmx/functions/fnc_calculate_solution.sqf index f90b299ce9..2049398a9c 100644 --- a/addons/atragmx/functions/fnc_calculate_solution.sqf +++ b/addons/atragmx/functions/fnc_calculate_solution.sqf @@ -106,7 +106,7 @@ 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 { +if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { _bc = [_bc, _temperature, _barometricPressure, _relativeHumidity, _atmosphereModel] call EFUNC(advanced_ballistics,calculateAtmosphericCorrection); }; @@ -117,7 +117,7 @@ _speedAverage = 0; private ["_eoetvoesMultiplier"]; _eoetvoesMultiplier = 0; -if (missionNamespace getVariable [QEGVAR(advanced_ballistics,EoetvoesEnabled), false]) then { +if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { _eoetvoesMultiplier = 2 * (0.0000729 * _muzzleVelocity / -9.80665) * cos(_latitude) * sin(_directionOfFire); }; @@ -142,14 +142,12 @@ while {_TOF < 15 && (_bulletPos select 1) < _targetRange} do { _trueSpeed = vectorMagnitude _trueVelocity; if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { - if (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false]) then { - _drag = if (missionNamespace getVariable [QEGVAR(advanced_ballistics,extensionAvailable), false]) then { - parseNumber(("ace_advanced_ballistics" callExtension format["retard:%1:%2:%3", _dragModel, _bc, _trueSpeed])) - } else { - ([_dragModel, _bc, _trueSpeed] call EFUNC(advanced_ballistics,calculateRetardation)) - }; - _bulletAccel = (vectorNormalized _trueVelocity) vectorMultiply (-1 * _drag); + _drag = if (missionNamespace getVariable [QEGVAR(advanced_ballistics,extensionAvailable), false]) then { + parseNumber(("ace_advanced_ballistics" callExtension format["retard:%1:%2:%3", _dragModel, _bc, _trueSpeed])) + } else { + ([_dragModel, _bc, _trueSpeed] call EFUNC(advanced_ballistics,calculateRetardation)) }; + _bulletAccel = (vectorNormalized _trueVelocity) vectorMultiply (-1 * _drag); } else { _bulletAccel = _trueVelocity vectorMultiply (_trueSpeed * _airFriction); }; @@ -177,23 +175,20 @@ while {_TOF < 15 && (_bulletPos select 1) < _targetRange} do { _kineticEnergy = _kineticEnergy * 0.737562149; if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (_bulletPos select 1) > 0) then { - if (missionNamespace getVariable [QEGVAR(advanced_ballistics,CoriolisEnabled), false]) then { - _horizontalDeflection = 0.0000729 * ((_bulletPos select 1) ^ 2) * sin(_latitude) / _speedAverage; - _horizontalCoriolis = - atan(_horizontalDeflection / (_bulletPos select 1)); - _windage1 = _windage1 + _horizontalCoriolis; - _windage2 = _windage2 + _horizontalCoriolis; - }; - if (missionNamespace getVariable [QEGVAR(advanced_ballistics,EoetvoesEnabled), false]) then { - _verticalDeflection = (_bulletPos select 2) * _eoetvoesMultiplier; - _verticalCoriolis = - atan(_verticalDeflection / (_bulletPos select 1)); - _elevation = _elevation + _verticalCoriolis; - }; - if (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false]) then { - _spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83; - _spinDrift = - atan(_spinDeflection / (_bulletPos select 1)); - _windage1 = _windage1 + _spinDrift; - _windage2 = _windage2 + _spinDrift; - }; + // Coriolis + _horizontalDeflection = 0.0000729 * ((_bulletPos select 1) ^ 2) * sin(_latitude) / _speedAverage; + _horizontalCoriolis = - atan(_horizontalDeflection / (_bulletPos select 1)); + _windage1 = _windage1 + _horizontalCoriolis; + _windage2 = _windage2 + _horizontalCoriolis; + // Eoetvoes + _verticalDeflection = (_bulletPos select 2) * _eoetvoesMultiplier; + _verticalCoriolis = - atan(_verticalDeflection / (_bulletPos select 1)); + _elevation = _elevation + _verticalCoriolis; + // Spin drift + _spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83; + _spinDrift = - atan(_spinDeflection / (_bulletPos select 1)); + _windage1 = _windage1 + _spinDrift; + _windage2 = _windage2 + _spinDrift; }; GVAR(rangeCardData) set [_n, [_range, _elevation * 60, [_windage1 * 60, _windage2 * 60], _lead, _TOF, _bulletSpeed, _kineticEnergy]]; @@ -217,23 +212,20 @@ _kineticEnergy = 0.5 * (_bulletMass / 1000 * (_bulletSpeed ^ 2)); _kineticEnergy = _kineticEnergy * 0.737562149; if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (_bulletPos select 1) > 0) then { - if (missionNamespace getVariable [QEGVAR(advanced_ballistics,CoriolisEnabled), false]) then { - _horizontalDeflection = 0.0000729 * ((_bulletPos select 1) ^ 2) * sin(_latitude) / _speedAverage; - _horizontalCoriolis = - atan(_horizontalDeflection / (_bulletPos select 1)); - _windage1 = _windage1 + _horizontalCoriolis; - _windage2 = _windage2 + _horizontalCoriolis; - }; - if (missionNamespace getVariable [QEGVAR(advanced_ballistics,EoetvoesEnabled), false]) then { - _verticalDeflection = (_bulletPos select 2) * _eoetvoesMultiplier; - _verticalCoriolis = - atan(_verticalDeflection / (_bulletPos select 1)); - _elevation = _elevation + _verticalCoriolis; - }; - if (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false]) then { - _spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83; - _spinDrift = - atan(_spinDeflection / (_bulletPos select 1)); - _windage1 = _windage1 + _spinDrift; - _windage2 = _windage2 + _spinDrift; - }; + // Coriolis + _horizontalDeflection = 0.0000729 * ((_bulletPos select 1) ^ 2) * sin(_latitude) / _speedAverage; + _horizontalCoriolis = - atan(_horizontalDeflection / (_bulletPos select 1)); + _windage1 = _windage1 + _horizontalCoriolis; + _windage2 = _windage2 + _horizontalCoriolis; + // Eoetvoes + _verticalDeflection = (_bulletPos select 2) * _eoetvoesMultiplier; + _verticalCoriolis = - atan(_verticalDeflection / (_bulletPos select 1)); + _elevation = _elevation + _verticalCoriolis; + // Spin drift + _spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83; + _spinDrift = - atan(_spinDeflection / (_bulletPos select 1)); + _windage1 = _windage1 + _spinDrift; + _windage2 = _windage2 + _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 641551fca1..677c4bb793 100644 --- a/addons/atragmx/functions/fnc_calculate_target_solution.sqf +++ b/addons/atragmx/functions/fnc_calculate_target_solution.sqf @@ -54,7 +54,7 @@ if (!GVAR(atmosphereModeTBH)) then { private ["_bulletLength", "_stabilityFactor"]; _bulletLength = 1.8; _stabilityFactor = 1.5; -if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false])) then { +if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { if (_bulletDiameter > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then { _stabilityFactor = [_bulletDiameter / 10 / 2.54, _bulletLength, _bulletMass * 15.4323584, _barrelTwist / 2.54, _muzzleVelocity, _temperature, _barometricPressure] call EFUNC(advanced_ballistics,calculateStabilityFactor); }; diff --git a/addons/atragmx/functions/fnc_parse_input.sqf b/addons/atragmx/functions/fnc_parse_input.sqf index 504c45fb28..2534c2a319 100644 --- a/addons/atragmx/functions/fnc_parse_input.sqf +++ b/addons/atragmx/functions/fnc_parse_input.sqf @@ -60,7 +60,7 @@ private ["_boreHeight", "_bulletMass", "_bulletDiameter", "_airFriction", "_rifl _boreHeight = parseNumber(ctrlText 120000); _bulletMass = parseNumber(ctrlText 120010); _bulletDiameter = parseNumber(ctrlText 120020); -if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then { +if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { _airFriction = 0.1 max parseNumber(ctrlText 120030) min 2; } else { _airFriction = parseNumber(ctrlText 120030) / -1000; @@ -87,7 +87,7 @@ GVAR(workingMemory) set [5, _boreHeight]; GVAR(workingMemory) set [12, _bulletMass]; GVAR(workingMemory) set [13, _bulletDiameter]; GVAR(workingMemory) set [14, _rifleTwist]; -if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then { +if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { GVAR(workingMemory) set [15, _airFriction]; } else { GVAR(workingMemory) set [4, _airFriction]; diff --git a/addons/atragmx/functions/fnc_update_gun.sqf b/addons/atragmx/functions/fnc_update_gun.sqf index 4ca7338e57..aa1f8c44bf 100644 --- a/addons/atragmx/functions/fnc_update_gun.sqf +++ b/addons/atragmx/functions/fnc_update_gun.sqf @@ -26,7 +26,7 @@ if (GVAR(currentUnit) != 2) then { } else { ctrlSetText [110, Str(Round(GVAR(workingMemory) select 12))]; }; -if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then { +if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { ctrlSetText [120, Str(Round((GVAR(workingMemory) select 15) * 1000) / 1000)]; } else { ctrlSetText [120, Str(Round((GVAR(workingMemory) select 4) * -1000 * 1000) / 1000)]; diff --git a/addons/atragmx/functions/fnc_update_gun_ammo_data.sqf b/addons/atragmx/functions/fnc_update_gun_ammo_data.sqf index 4ccae287e7..b11b214500 100644 --- a/addons/atragmx/functions/fnc_update_gun_ammo_data.sqf +++ b/addons/atragmx/functions/fnc_update_gun_ammo_data.sqf @@ -32,7 +32,7 @@ if (GVAR(currentUnit) != 2) then { } else { ctrlSetText [120020, Str(Round((GVAR(workingMemory) select 13) * 1000) / 1000)]; }; -if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then { +if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { ctrlSetText [120030, Str(Round((GVAR(workingMemory) select 15) * 1000) / 1000)]; } else { ctrlSetText [120030, Str(Round((GVAR(workingMemory) select 4) * -1000 * 1000) / 1000)];