diff --git a/addons/advanced_ballistics/CfgWeapons.hpp b/addons/advanced_ballistics/CfgWeapons.hpp index 7d02dc25d4..2de6a9b5a9 100644 --- a/addons/advanced_ballistics/CfgWeapons.hpp +++ b/addons/advanced_ballistics/CfgWeapons.hpp @@ -1,174 +1,174 @@ class CfgWeapons { - class arifle_katiba_Base_F; - class arifle_MX_Base_F; - class DMR_01_base_F; - class EBR_base_F; - class GM6_base_F; - class LMG_RCWS; - class LRR_base_F; - class MGun; - class MGunCore; - class mk20_base_F; - class pdw2000_base_F; - class Pistol_Base_F; - class Rifle_Base_F; - class Rifle_Long_Base_F; - class SDAR_base_F; - class SMG_01_Base; - class SMG_02_base_F; - class Tavor_base_F; - - class hgun_P07_F: Pistol_Base_F - { - ACE_barrelTwist=10; - ACE_barrelLength=4; - }; - class hgun_Rook40_F: Pistol_Base_F - { - ACE_barrelTwist=10; - ACE_barrelLength=4.4; - }; - class hgun_Pistol_heavy_01_F: Pistol_Base_F - { - ACE_barrelTwist=16; - ACE_barrelLength=4.5; - }; - class hgun_Pistol_heavy_02_F: Pistol_Base_F - { - ACE_barrelTwist=16; - ACE_barrelLength=3; - }; - class hgun_ACPC2_F: Pistol_Base_F - { - ACE_barrelTwist=16; - ACE_barrelLength=5; - }; - class hgun_PDW2000_F: pdw2000_base_F - { - ACE_barrelTwist=9; - ACE_barrelLength=7; - }; - class arifle_Katiba_F: arifle_katiba_Base_F - { - ACE_barrelTwist=8; - ACE_barrelLength=228.7; - }; - class arifle_Katiba_C_F: arifle_katiba_Base_F - { - ACE_barrelTwist=8; - ACE_barrelLength=26.8; - }; - class arifle_Katiba_GL_F: arifle_katiba_Base_F - { - ACE_barrelTwist=8; - ACE_barrelLength=28.7; - }; - class arifle_MX_F: arifle_MX_Base_F - { - ACE_barrelTwist=9; - ACE_barrelLength=14.5; - }; - class arifle_MX_GL_F: arifle_MX_Base_F - { - ACE_barrelTwist=9; - ACE_barrelLength=14.5; - }; - class arifle_MX_SW_F: arifle_MX_Base_F - { - ACE_barrelTwist=9; - ACE_barrelLength=16.0; - }; - class arifle_MXC_F: arifle_MX_Base_F - { - ACE_barrelTwist=8; - ACE_barrelLength=10.5; - }; - class arifle_MXM_F: arifle_MX_Base_F - { - ACE_barrelTwist=9; - ACE_barrelLength=18; - }; - class arifle_SDAR_F: SDAR_base_F - { - ACE_barrelTwist=11.25; - ACE_barrelLength=18; - }; - class SMG_02_F: SMG_02_base_F - { - ACE_barrelTwist=10; - ACE_barrelLength=7.7; - }; - class arifle_TRG20_F: Tavor_base_F - { - ACE_barrelTwist=7; - ACE_barrelLength=15; - }; - class arifle_TRG21_F: Tavor_base_F - { - ACE_barrelTwist=7; - ACE_barrelLength=18.1; - }; - class LMG_Zafir_F: Rifle_Long_Base_F - { - ACE_barrelTwist=12; - ACE_barrelLength=18.1; - }; - class arifle_Mk20_F: mk20_base_F - { - ACE_barrelTwist=7; - ACE_barrelLength=17.4; - }; - class arifle_Mk20C_F: mk20_base_F - { - ACE_barrelTwist=7; - ACE_barrelLength=16; - }; - class arifle_Mk20_GL_F: mk20_base_F - { - ACE_barrelTwist=7; - ACE_barrelLength=16; - }; - class SMG_01_F: SMG_01_Base - { - ACE_barrelTwist=16; - ACE_barrelLength=5.5; - }; - class srifle_DMR_01_F: DMR_01_base_F - { - ACE_barrelTwist=9.5; - ACE_barrelLength=24; - }; - class srifle_EBR_F: EBR_base_F - { - ACE_barrelTwist=12; - ACE_barrelLength=24; - }; - class LMG_Mk200_F: Rifle_Long_Base_F - { - ACE_barrelTwist=7; - ACE_barrelLength=12.5; - }; - class srifle_LRR_F: LRR_base_F - { - ACE_barrelTwist=13; - ACE_barrelLength=29; - }; - class srifle_GM6_F: GM6_base_F - { - ACE_barrelTwist=15; - ACE_barrelLength=43.3; - }; - - class HMG_127 : LMG_RCWS - { - }; - class HMG_01: HMG_127 - { - }; - class HMG_M2: HMG_01 - { - ACE_barrelTwist=12; - ACE_barrelLength=45; - }; + class arifle_katiba_Base_F; + class arifle_MX_Base_F; + class DMR_01_base_F; + class EBR_base_F; + class GM6_base_F; + class LMG_RCWS; + class LRR_base_F; + class MGun; + class MGunCore; + class mk20_base_F; + class pdw2000_base_F; + class Pistol_Base_F; + class Rifle_Base_F; + class Rifle_Long_Base_F; + class SDAR_base_F; + class SMG_01_Base; + class SMG_02_base_F; + class Tavor_base_F; + + class hgun_P07_F: Pistol_Base_F + { + ACE_barrelTwist=10; + ACE_barrelLength=4; + }; + class hgun_Rook40_F: Pistol_Base_F + { + ACE_barrelTwist=10; + ACE_barrelLength=4.4; + }; + class hgun_Pistol_heavy_01_F: Pistol_Base_F + { + ACE_barrelTwist=16; + ACE_barrelLength=4.5; + }; + class hgun_Pistol_heavy_02_F: Pistol_Base_F + { + ACE_barrelTwist=16; + ACE_barrelLength=3; + }; + class hgun_ACPC2_F: Pistol_Base_F + { + ACE_barrelTwist=16; + ACE_barrelLength=5; + }; + class hgun_PDW2000_F: pdw2000_base_F + { + ACE_barrelTwist=9; + ACE_barrelLength=7; + }; + class arifle_Katiba_F: arifle_katiba_Base_F + { + ACE_barrelTwist=8; + ACE_barrelLength=228.7; + }; + class arifle_Katiba_C_F: arifle_katiba_Base_F + { + ACE_barrelTwist=8; + ACE_barrelLength=26.8; + }; + class arifle_Katiba_GL_F: arifle_katiba_Base_F + { + ACE_barrelTwist=8; + ACE_barrelLength=28.7; + }; + class arifle_MX_F: arifle_MX_Base_F + { + ACE_barrelTwist=9; + ACE_barrelLength=14.5; + }; + class arifle_MX_GL_F: arifle_MX_Base_F + { + ACE_barrelTwist=9; + ACE_barrelLength=14.5; + }; + class arifle_MX_SW_F: arifle_MX_Base_F + { + ACE_barrelTwist=9; + ACE_barrelLength=16.0; + }; + class arifle_MXC_F: arifle_MX_Base_F + { + ACE_barrelTwist=8; + ACE_barrelLength=10.5; + }; + class arifle_MXM_F: arifle_MX_Base_F + { + ACE_barrelTwist=9; + ACE_barrelLength=18; + }; + class arifle_SDAR_F: SDAR_base_F + { + ACE_barrelTwist=11.25; + ACE_barrelLength=18; + }; + class SMG_02_F: SMG_02_base_F + { + ACE_barrelTwist=10; + ACE_barrelLength=7.7; + }; + class arifle_TRG20_F: Tavor_base_F + { + ACE_barrelTwist=7; + ACE_barrelLength=15; + }; + class arifle_TRG21_F: Tavor_base_F + { + ACE_barrelTwist=7; + ACE_barrelLength=18.1; + }; + class LMG_Zafir_F: Rifle_Long_Base_F + { + ACE_barrelTwist=12; + ACE_barrelLength=18.1; + }; + class arifle_Mk20_F: mk20_base_F + { + ACE_barrelTwist=7; + ACE_barrelLength=17.4; + }; + class arifle_Mk20C_F: mk20_base_F + { + ACE_barrelTwist=7; + ACE_barrelLength=16; + }; + class arifle_Mk20_GL_F: mk20_base_F + { + ACE_barrelTwist=7; + ACE_barrelLength=16; + }; + class SMG_01_F: SMG_01_Base + { + ACE_barrelTwist=16; + ACE_barrelLength=5.5; + }; + class srifle_DMR_01_F: DMR_01_base_F + { + ACE_barrelTwist=9.5; + ACE_barrelLength=24; + }; + class srifle_EBR_F: EBR_base_F + { + ACE_barrelTwist=12; + ACE_barrelLength=24; + }; + class LMG_Mk200_F: Rifle_Long_Base_F + { + ACE_barrelTwist=7; + ACE_barrelLength=12.5; + }; + class srifle_LRR_F: LRR_base_F + { + ACE_barrelTwist=13; + ACE_barrelLength=29; + }; + class srifle_GM6_F: GM6_base_F + { + ACE_barrelTwist=15; + ACE_barrelLength=43.3; + }; + + class HMG_127 : LMG_RCWS + { + }; + class HMG_01: HMG_127 + { + }; + class HMG_M2: HMG_01 + { + ACE_barrelTwist=12; + ACE_barrelLength=45; + }; }; \ No newline at end of file diff --git a/addons/advanced_ballistics/RscTitles.hpp b/addons/advanced_ballistics/RscTitles.hpp index f169650381..b62af875d2 100644 --- a/addons/advanced_ballistics/RscTitles.hpp +++ b/addons/advanced_ballistics/RscTitles.hpp @@ -1,63 +1,63 @@ class RscTitles { - class RscTurretDial - { - idd=-1; - onLoad="with uiNameSpace do { RscTurretDial = _this select 0 };"; - movingEnable=0; - duration=5; - fadeIn="false"; - fadeOut="false"; - class controls - { - class RscTurretDial - { - idc=132949; - type=0; - style=128; - font="TahomaB"; - colorBackground[]={0,0,0,0.8}; - colorText[]={1,1,1,1}; - x="SafeZoneX + 0.0025"; - y="SafeZoneY + 0.0025"; - w=0.10; - h=0.05; - sizeEx=0.03; - text=""; - }; - }; - }; + class RscTurretDial + { + idd=-1; + onLoad="with uiNameSpace do { RscTurretDial = _this select 0 };"; + movingEnable=0; + duration=5; + fadeIn="false"; + fadeOut="false"; + class controls + { + class RscTurretDial + { + idc=132949; + type=0; + style=128; + font="TahomaB"; + colorBackground[]={0,0,0,0.8}; + colorText[]={1,1,1,1}; + x="SafeZoneX + 0.0025"; + y="SafeZoneY + 0.0025"; + w=0.10; + h=0.05; + sizeEx=0.03; + text=""; + }; + }; + }; - class RscProtractor - { - idd=-1; - onLoad="with uiNameSpace do { RscProtractor = _this select 0 };"; - movingEnable=0; - duration=60; - fadeIn="false"; - fadeOut="false"; - class controls - { - class RscProtractorBase - { - idc=132950; - type=0; - style=48; - font="TahomaB"; - colorBackground[]={0,0,0,0}; - colorText[]={1,1,1,1}; - x="SafeZoneX + 0.001"; - y="SafeZoneY + 0.001"; - w=0.2; - h=0.2*4/3; - size=0.034; - sizeEx=0.027; - text=""; - }; - class RscProtractorMarker : RscProtractorBase - { - idc=132951; - }; - }; - }; + class RscProtractor + { + idd=-1; + onLoad="with uiNameSpace do { RscProtractor = _this select 0 };"; + movingEnable=0; + duration=60; + fadeIn="false"; + fadeOut="false"; + class controls + { + class RscProtractorBase + { + idc=132950; + type=0; + style=48; + font="TahomaB"; + colorBackground[]={0,0,0,0}; + colorText[]={1,1,1,1}; + x="SafeZoneX + 0.001"; + y="SafeZoneY + 0.001"; + w=0.2; + h=0.2*4/3; + size=0.034; + sizeEx=0.027; + text=""; + }; + class RscProtractorMarker : RscProtractorBase + { + idc=132951; + }; + }; + }; }; \ No newline at end of file diff --git a/addons/advanced_ballistics/functions/fnc_calculateAirDensity.sqf b/addons/advanced_ballistics/functions/fnc_calculateAirDensity.sqf index 2fb7be5ce0..723d7a0e52 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateAirDensity.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateAirDensity.sqf @@ -9,13 +9,13 @@ _relativeHumidity = _this select 2; // as ratio 0-1 _pressure = _pressure * 100; if (_relativeHumidity > 0) then { - private ["_pSat", "_vaporPressure", "_partialPressure"]; - // Saturation vapor pressure calculated according to: http://wahiduddin.net/calc/density_algorithms.htm - _pSat = 6.1078 * 10 ^ ((7.5 * _temperature) / (_temperature + 237.3)); - _vaporPressure = _relativeHumidity * _pSat; - _partialPressure = _pressure - _vaporPressure; - - (_partialPressure * DRY_AIR_MOLAR_MASS + _vaporPressure * WATER_VAPOR_MOLAR_MASS) / (UNIVERSAL_GAS_CONSTANT * KELVIN(_temperature)) + private ["_pSat", "_vaporPressure", "_partialPressure"]; + // Saturation vapor pressure calculated according to: http://wahiduddin.net/calc/density_algorithms.htm + _pSat = 6.1078 * 10 ^ ((7.5 * _temperature) / (_temperature + 237.3)); + _vaporPressure = _relativeHumidity * _pSat; + _partialPressure = _pressure - _vaporPressure; + + (_partialPressure * DRY_AIR_MOLAR_MASS + _vaporPressure * WATER_VAPOR_MOLAR_MASS) / (UNIVERSAL_GAS_CONSTANT * KELVIN(_temperature)) } else { - _pressure / (SPECIFIC_GAS_CONSTANT_DRY_AIR * KELVIN(_temperature)) + _pressure / (SPECIFIC_GAS_CONSTANT_DRY_AIR * KELVIN(_temperature)) }; diff --git a/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf b/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf index 529fe844a8..8a586760cd 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf @@ -7,7 +7,7 @@ _temperature = _this select 1; _muzzleVelocityTable = []; if (isArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_ammoTempMuzzleVelocityShifts")) then { - _muzzleVelocityTable = getArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_ammoTempMuzzleVelocityShifts"); + _muzzleVelocityTable = getArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_ammoTempMuzzleVelocityShifts"); }; if (count _muzzleVelocityTable != 11) exitWith { 0 }; diff --git a/addons/advanced_ballistics/functions/fnc_calculateAtmosphericCorrection.sqf b/addons/advanced_ballistics/functions/fnc_calculateAtmosphericCorrection.sqf index 199edbc9da..800fa2cd81 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateAtmosphericCorrection.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateAtmosphericCorrection.sqf @@ -11,7 +11,7 @@ _atmosphereModel = _this select 4; // "ICAO" or "ASM" _airDensity = [_temperature, _pressure, _relativeHumidity] call FUNC(calculateAirDensity); if (_atmosphereModel == "ICAO") then { - (STD_AIR_DENSITY_ICAO / _airDensity) * _ballisticCoefficient + (STD_AIR_DENSITY_ICAO / _airDensity) * _ballisticCoefficient } else { - (STD_AIR_DENSITY_ASM / _airDensity) * _ballisticCoefficient + (STD_AIR_DENSITY_ASM / _airDensity) * _ballisticCoefficient }; diff --git a/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf b/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf index 7523711964..a24dd3d3cc 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf @@ -13,10 +13,10 @@ _muzzleVelocityTable = []; _barrelLengthTable = []; if (isArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_muzzleVelocities")) then { - _muzzleVelocityTable = getArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_muzzleVelocities"); + _muzzleVelocityTable = getArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_muzzleVelocities"); }; if (isArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_barrelLengths")) then { - _barrelLengthTable = getArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_barrelLengths"); + _barrelLengthTable = getArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_barrelLengths"); }; if (count _muzzleVelocityTable != count _barrelLengthTable) exitWith { 0 }; @@ -30,19 +30,19 @@ if (_barrelLength <= (_barrelLengthTable select _lowerIndex)) exitWith { (_muzzl if (_barrelLength >= (_barrelLengthTable select _upperIndex)) exitWith { (_muzzleVelocityTable select _upperIndex) - _muzzleVelocity }; for "_i" from 0 to (count _barrelLengthTable) - 1 do { - if (_barrelLength >= _barrelLengthTable select _i) then { - _lowerIndex = _i; - }; + if (_barrelLength >= _barrelLengthTable select _i) then { + _lowerIndex = _i; + }; }; for "_i" from (count _barrelLengthTable) - 1 to 0 step -1 do { - if (_barrelLength <= _barrelLengthTable select _i) then { - _upperIndex = _i; - }; + if (_barrelLength <= _barrelLengthTable select _i) then { + _upperIndex = _i; + }; }; _barrelLengthRatio = 0; if ((_barrelLengthTable select _upperIndex) - (_barrelLengthTable select _lowerIndex) > 0) then { - _barrelLengthRatio = ((_barrelLengthTable select _upperIndex) - _barrelLength) / ((_barrelLengthTable select _upperIndex) - (_barrelLengthTable select _lowerIndex)); + _barrelLengthRatio = ((_barrelLengthTable select _upperIndex) - _barrelLength) / ((_barrelLengthTable select _upperIndex) - (_barrelLengthTable select _lowerIndex)); }; _muzzleVelocityNew = (_muzzleVelocityTable select _lowerIndex) + ((_muzzleVelocityTable select _upperIndex) - (_muzzleVelocityTable select _lowerIndex)) * (1 - _barrelLengthRatio); diff --git a/addons/advanced_ballistics/functions/fnc_calculateHellmannExponent.sqf b/addons/advanced_ballistics/functions/fnc_calculateHellmannExponent.sqf index 605b36dfb5..e319272a0e 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateHellmannExponent.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateHellmannExponent.sqf @@ -16,13 +16,13 @@ _isWater = surfaceIsWater _this; _hellmann_index = 0 max floor(overcast * 3) min 2; if (_nearObjects >= 5) then { - _hellmann_exponent = _hellmann_exponents select (_hellmann_index + 6); + _hellmann_exponent = _hellmann_exponents select (_hellmann_index + 6); }; if (_nearObjects < 5) then { - _hellmann_exponent = _hellmann_exponents select (_hellmann_index + 3); + _hellmann_exponent = _hellmann_exponents select (_hellmann_index + 3); }; if (_nearObjects == 0 && _isWater) then { - _hellmann_exponent = _hellmann_exponents select (_hellmann_index + 0); + _hellmann_exponent = _hellmann_exponents select (_hellmann_index + 0); }; _hellmann_exponent diff --git a/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf b/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf index 58c15e380a..338ec89cd2 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf @@ -12,118 +12,118 @@ _M = -1; _result = 0; switch _dragModel do { - case 1: - { - switch true do { - case (_velocity > 4230) : { _A = 0.0001477404177730177; _M = 1.9565; }; - case (_velocity > 3680) : { _A = 0.0001920339268755614; _M = 1.925 ; }; - case (_velocity > 3450) : { _A = 0.0002894751026819746; _M = 1.875 ; }; - case (_velocity > 3295) : { _A = 0.0004349905111115636; _M = 1.825 ; }; - case (_velocity > 3130) : { _A = 0.0006520421871892662; _M = 1.775 ; }; - case (_velocity > 2960) : { _A = 0.0009748073694078696; _M = 1.725 ; }; - case (_velocity > 2830) : { _A = 0.001453721560187286; _M = 1.675 ; }; - case (_velocity > 2680) : { _A = 0.002162887202930376; _M = 1.625 ; }; - case (_velocity > 2460) : { _A = 0.003209559783129881; _M = 1.575 ; }; - case (_velocity > 2225) : { _A = 0.003904368218691249; _M = 1.55 ; }; - case (_velocity > 2015) : { _A = 0.003222942271262336; _M = 1.575 ; }; - case (_velocity > 1890) : { _A = 0.002203329542297809; _M = 1.625 ; }; - case (_velocity > 1810) : { _A = 0.001511001028891904; _M = 1.675 ; }; - case (_velocity > 1730) : { _A = 0.0008609957592468259; _M = 1.75 ; }; - case (_velocity > 1595) : { _A = 0.0004086146797305117; _M = 1.85 ; }; - case (_velocity > 1520) : { _A = 0.0001954473210037398; _M = 1.95 ; }; - case (_velocity > 1420) : { _A = 0.00005431896266462351; _M = 2.125 ; }; - case (_velocity > 1360) : { _A = 0.000008847742581674416; _M = 2.375 ; }; - case (_velocity > 1315) : { _A = 0.000001456922328720298; _M = 2.625 ; }; - case (_velocity > 1280) : { _A = 0.0000002419485191895565; _M = 2.875 ; }; - case (_velocity > 1220) : { _A = 0.00000001657956321067612; _M = 3.25 ; }; - case (_velocity > 1185) : { _A = 0.0000000004745469537157371; _M = 3.75 ; }; - case (_velocity > 1150) : { _A = 0.00000000001379746590025088; _M = 4.25 ; }; - case (_velocity > 1100) : { _A = 0.0000000000004070157961147882; _M = 4.75 ; }; - case (_velocity > 1060) : { _A = 0.00000000000002938236954847331; _M = 5.125 ; }; - case (_velocity > 1025) : { _A = 0.00000000000001228597370774746; _M = 5.25 ; }; - case (_velocity > 980) : { _A = 0.00000000000002916938264100495; _M = 5.125 ; }; - case (_velocity > 945) : { _A = 0.0000000000003855099424807451; _M = 4.75 ; }; - case (_velocity > 905) : { _A = 0.00000000001185097045689854; _M = 4.25 ; }; - case (_velocity > 860) : { _A = 0.0000000003566129470974951; _M = 3.75 ; }; - case (_velocity > 810) : { _A = 0.00000001045513263966272; _M = 3.25 ; }; - case (_velocity > 780) : { _A = 0.0000001291159200846216; _M = 2.875 ; }; - case (_velocity > 750) : { _A = 0.0000006824429329105383; _M = 2.625 ; }; - case (_velocity > 700) : { _A = 0.000003569169672385163; _M = 2.375 ; }; - case (_velocity > 640) : { _A = 0.00001839015095899579; _M = 2.125 ; }; - case (_velocity > 600) : { _A = 0.00005711174688734240; _M = 1.950 ; }; - case (_velocity > 550) : { _A = 0.00009226557091973427; _M = 1.875 ; }; - case (_velocity > 250) : { _A = 0.00009337991957131389; _M = 1.875 ; }; - case (_velocity > 100) : { _A = 0.00007225247327590413; _M = 1.925 ; }; - case (_velocity > 65) : { _A = 0.00005792684957074546; _M = 1.975 ; }; - case (_velocity > 0) : { _A = 0.00005206214107320588; _M = 2.000 ; }; - }; - }; - case 2: - { - switch true do { - case (_velocity > 1674) : { _A = 0.0079470052136733; _M = 1.36999902851493; }; - case (_velocity > 1172) : { _A = 0.00100419763721974; _M = 1.65392237010294; }; - case (_velocity > 1060) : { _A = 0.0000000000000000000000715571228255369; _M = 7.91913562392361; }; - case (_velocity > 949) : { _A = 0.000000000139589807205091; _M = 3.81439537623717; }; - case (_velocity > 670) : { _A = 0.000234364342818625; _M = 1.71869536324748; }; - case (_velocity > 335) : { _A = 0.000177962438921838; _M = 1.76877550388679; }; - case (_velocity > 0) : { _A = 0.0000518033561289704; _M = 1.98160270524632; }; - }; - }; - case 5: - { - switch true do { - case (_velocity > 1730) : { _A = 0.00724854775171929; _M = 1.41538574492812; }; - case (_velocity > 1228) : { _A = 0.0000350563361516117; _M = 2.13077307854948; }; - case (_velocity > 1116) : { _A = 0.000000000000184029481181151; _M = 4.81927320350395; }; - case (_velocity > 1004) : { _A = 0.000000000000000000000134713064017409; _M = 7.8100555281422 ; }; - case (_velocity > 837) : { _A = 0.000000103965974081168; _M = 2.84204791809926; }; - case (_velocity > 335) : { _A = 0.0001093015938698234; _M = 1.81096361579504; }; - case (_velocity > 0) : { _A = 0.0000351963178524273; _M = 2.00477856801111; }; - }; - }; - case 6: - { - switch true do { - case (_velocity > 3236) : { _A = 0.0455384883480781; _M = 1.15997674041274; }; - case (_velocity > 2065) : { _A = 0.07167261849653769; _M = 1.10704436538885; }; - case (_velocity > 1311) : { _A = 0.00166676386084348; _M = 1.60085100195952; }; - case (_velocity > 1144) : { _A = 0.000000101482730119215; _M = 2.9569674731838 ; }; - case (_velocity > 1004) : { _A = 0.00000000000000000431542773103552; _M = 6.34106317069757; }; - case (_velocity > 670) : { _A = 0.0000204835650496866; _M = 2.11688446325998; }; - case (_velocity > 0) : { _A = 0.0000750912466084823; _M = 1.92031057847052; }; - }; - }; - case 7: - { - switch true do { - case (_velocity > 4200) : { _A = 0.00000000129081656775919; _M = 3.24121295355962; }; - case (_velocity > 3000) : { _A = 0.0171422231434847; _M = 1.27907168025204; }; - case (_velocity > 1470) : { _A = 0.00233355948302505; _M = 1.52693913274526; }; - case (_velocity > 1260) : { _A = 0.000797592111627665; _M = 1.67688974440324; }; - case (_velocity > 1110) : { _A = 0.00000000000571086414289273; _M = 4.3212826264889 ; }; - case (_velocity > 960) : { _A = 0.0000000000000000302865108244904; _M = 5.99074203776707; }; - case (_velocity > 670) : { _A = 0.00000752285155782535; _M = 2.1738019851075 ; }; - case (_velocity > 540) : { _A = 0.0000131766281225189; _M = 2.08774690257991; }; - case (_velocity > 0) : { _A = 0.0000134504843776525; _M = 2.08702306738884; }; - }; - }; - case 8: - { - switch true do { - case (_velocity > 3571) : { _A = 0.0112263766252305; _M = 1.33207346655961; }; - case (_velocity > 1841) : { _A = 0.0167252613732636; _M = 1.28662041261785; }; - case (_velocity > 1120) : { _A = 0.00220172456619625; _M = 1.55636358091189; }; - case (_velocity > 1088) : { _A = 0.00000000000000020538037167098; _M = 5.80410776994789; }; - case (_velocity > 976) : { _A = 0.00000000000592182174254121; _M = 4.29275576134191; }; - case (_velocity > 0) : { _A = 0.000043917343795117; _M = 1.99978116283334; }; - }; - }; + case 1: + { + switch true do { + case (_velocity > 4230) : { _A = 0.0001477404177730177; _M = 1.9565; }; + case (_velocity > 3680) : { _A = 0.0001920339268755614; _M = 1.925 ; }; + case (_velocity > 3450) : { _A = 0.0002894751026819746; _M = 1.875 ; }; + case (_velocity > 3295) : { _A = 0.0004349905111115636; _M = 1.825 ; }; + case (_velocity > 3130) : { _A = 0.0006520421871892662; _M = 1.775 ; }; + case (_velocity > 2960) : { _A = 0.0009748073694078696; _M = 1.725 ; }; + case (_velocity > 2830) : { _A = 0.001453721560187286; _M = 1.675 ; }; + case (_velocity > 2680) : { _A = 0.002162887202930376; _M = 1.625 ; }; + case (_velocity > 2460) : { _A = 0.003209559783129881; _M = 1.575 ; }; + case (_velocity > 2225) : { _A = 0.003904368218691249; _M = 1.55 ; }; + case (_velocity > 2015) : { _A = 0.003222942271262336; _M = 1.575 ; }; + case (_velocity > 1890) : { _A = 0.002203329542297809; _M = 1.625 ; }; + case (_velocity > 1810) : { _A = 0.001511001028891904; _M = 1.675 ; }; + case (_velocity > 1730) : { _A = 0.0008609957592468259; _M = 1.75 ; }; + case (_velocity > 1595) : { _A = 0.0004086146797305117; _M = 1.85 ; }; + case (_velocity > 1520) : { _A = 0.0001954473210037398; _M = 1.95 ; }; + case (_velocity > 1420) : { _A = 0.00005431896266462351; _M = 2.125 ; }; + case (_velocity > 1360) : { _A = 0.000008847742581674416; _M = 2.375 ; }; + case (_velocity > 1315) : { _A = 0.000001456922328720298; _M = 2.625 ; }; + case (_velocity > 1280) : { _A = 0.0000002419485191895565; _M = 2.875 ; }; + case (_velocity > 1220) : { _A = 0.00000001657956321067612; _M = 3.25 ; }; + case (_velocity > 1185) : { _A = 0.0000000004745469537157371; _M = 3.75 ; }; + case (_velocity > 1150) : { _A = 0.00000000001379746590025088; _M = 4.25 ; }; + case (_velocity > 1100) : { _A = 0.0000000000004070157961147882; _M = 4.75 ; }; + case (_velocity > 1060) : { _A = 0.00000000000002938236954847331; _M = 5.125 ; }; + case (_velocity > 1025) : { _A = 0.00000000000001228597370774746; _M = 5.25 ; }; + case (_velocity > 980) : { _A = 0.00000000000002916938264100495; _M = 5.125 ; }; + case (_velocity > 945) : { _A = 0.0000000000003855099424807451; _M = 4.75 ; }; + case (_velocity > 905) : { _A = 0.00000000001185097045689854; _M = 4.25 ; }; + case (_velocity > 860) : { _A = 0.0000000003566129470974951; _M = 3.75 ; }; + case (_velocity > 810) : { _A = 0.00000001045513263966272; _M = 3.25 ; }; + case (_velocity > 780) : { _A = 0.0000001291159200846216; _M = 2.875 ; }; + case (_velocity > 750) : { _A = 0.0000006824429329105383; _M = 2.625 ; }; + case (_velocity > 700) : { _A = 0.000003569169672385163; _M = 2.375 ; }; + case (_velocity > 640) : { _A = 0.00001839015095899579; _M = 2.125 ; }; + case (_velocity > 600) : { _A = 0.00005711174688734240; _M = 1.950 ; }; + case (_velocity > 550) : { _A = 0.00009226557091973427; _M = 1.875 ; }; + case (_velocity > 250) : { _A = 0.00009337991957131389; _M = 1.875 ; }; + case (_velocity > 100) : { _A = 0.00007225247327590413; _M = 1.925 ; }; + case (_velocity > 65) : { _A = 0.00005792684957074546; _M = 1.975 ; }; + case (_velocity > 0) : { _A = 0.00005206214107320588; _M = 2.000 ; }; + }; + }; + case 2: + { + switch true do { + case (_velocity > 1674) : { _A = 0.0079470052136733; _M = 1.36999902851493; }; + case (_velocity > 1172) : { _A = 0.00100419763721974; _M = 1.65392237010294; }; + case (_velocity > 1060) : { _A = 0.0000000000000000000000715571228255369; _M = 7.91913562392361; }; + case (_velocity > 949) : { _A = 0.000000000139589807205091; _M = 3.81439537623717; }; + case (_velocity > 670) : { _A = 0.000234364342818625; _M = 1.71869536324748; }; + case (_velocity > 335) : { _A = 0.000177962438921838; _M = 1.76877550388679; }; + case (_velocity > 0) : { _A = 0.0000518033561289704; _M = 1.98160270524632; }; + }; + }; + case 5: + { + switch true do { + case (_velocity > 1730) : { _A = 0.00724854775171929; _M = 1.41538574492812; }; + case (_velocity > 1228) : { _A = 0.0000350563361516117; _M = 2.13077307854948; }; + case (_velocity > 1116) : { _A = 0.000000000000184029481181151; _M = 4.81927320350395; }; + case (_velocity > 1004) : { _A = 0.000000000000000000000134713064017409; _M = 7.8100555281422 ; }; + case (_velocity > 837) : { _A = 0.000000103965974081168; _M = 2.84204791809926; }; + case (_velocity > 335) : { _A = 0.0001093015938698234; _M = 1.81096361579504; }; + case (_velocity > 0) : { _A = 0.0000351963178524273; _M = 2.00477856801111; }; + }; + }; + case 6: + { + switch true do { + case (_velocity > 3236) : { _A = 0.0455384883480781; _M = 1.15997674041274; }; + case (_velocity > 2065) : { _A = 0.07167261849653769; _M = 1.10704436538885; }; + case (_velocity > 1311) : { _A = 0.00166676386084348; _M = 1.60085100195952; }; + case (_velocity > 1144) : { _A = 0.000000101482730119215; _M = 2.9569674731838 ; }; + case (_velocity > 1004) : { _A = 0.00000000000000000431542773103552; _M = 6.34106317069757; }; + case (_velocity > 670) : { _A = 0.0000204835650496866; _M = 2.11688446325998; }; + case (_velocity > 0) : { _A = 0.0000750912466084823; _M = 1.92031057847052; }; + }; + }; + case 7: + { + switch true do { + case (_velocity > 4200) : { _A = 0.00000000129081656775919; _M = 3.24121295355962; }; + case (_velocity > 3000) : { _A = 0.0171422231434847; _M = 1.27907168025204; }; + case (_velocity > 1470) : { _A = 0.00233355948302505; _M = 1.52693913274526; }; + case (_velocity > 1260) : { _A = 0.000797592111627665; _M = 1.67688974440324; }; + case (_velocity > 1110) : { _A = 0.00000000000571086414289273; _M = 4.3212826264889 ; }; + case (_velocity > 960) : { _A = 0.0000000000000000302865108244904; _M = 5.99074203776707; }; + case (_velocity > 670) : { _A = 0.00000752285155782535; _M = 2.1738019851075 ; }; + case (_velocity > 540) : { _A = 0.0000131766281225189; _M = 2.08774690257991; }; + case (_velocity > 0) : { _A = 0.0000134504843776525; _M = 2.08702306738884; }; + }; + }; + case 8: + { + switch true do { + case (_velocity > 3571) : { _A = 0.0112263766252305; _M = 1.33207346655961; }; + case (_velocity > 1841) : { _A = 0.0167252613732636; _M = 1.28662041261785; }; + case (_velocity > 1120) : { _A = 0.00220172456619625; _M = 1.55636358091189; }; + case (_velocity > 1088) : { _A = 0.00000000000000020538037167098; _M = 5.80410776994789; }; + case (_velocity > 976) : { _A = 0.00000000000592182174254121; _M = 4.29275576134191; }; + case (_velocity > 0) : { _A = 0.000043917343795117; _M = 1.99978116283334; }; + }; + }; }; if (_A != -1 && _M != -1 && _velocity > 0 && _velocity < 10000) then { - _result = _A * (_velocity ^ _M) / _dragCoefficient; - _result = _result / 3.2808399; + _result = _A * (_velocity ^ _M) / _dragCoefficient; + _result = _result / 3.2808399; }; _result diff --git a/addons/advanced_ballistics/functions/fnc_calculateRoughnessLength.sqf b/addons/advanced_ballistics/functions/fnc_calculateRoughnessLength.sqf index a1aa839fbc..f2865a1526 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateRoughnessLength.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateRoughnessLength.sqf @@ -11,11 +11,11 @@ _nearBuildings = count (_windSource nearObjects ["Building", 50]); _isWater = surfaceIsWater _windSource; if (_nearBuildings == 0 && _isWater) exitWith { - 0.0005 + 0.0005 }; if (_nearBuildings >= 10) exitWith { - 1.6 + 1.6 }; _roughness_lengths select (2 + (_nearBuildings min 6)) diff --git a/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf b/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf index b09a527713..1f524b85ca 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf @@ -15,9 +15,9 @@ _stabilityFactor = 30 * _bulletMass / (_t^2 * _caliber^3 * _l * (1 + _l^2)); _muzzleVelocity = _muzzleVelocity * 3.2808399; if (_muzzleVelocity > 1120) then { - _stabilityFactor = _stabilityFactor * (_muzzleVelocity / 2800) ^ (1/3); + _stabilityFactor = _stabilityFactor * (_muzzleVelocity / 2800) ^ (1/3); } else { - _stabilityFactor = _stabilityFactor * (_muzzleVelocity / 1120) ^ (1/3); + _stabilityFactor = _stabilityFactor * (_muzzleVelocity / 1120) ^ (1/3); }; _stabilityFactor = _stabilityFactor * (_temperature + 273) / (15 + 273) * 1013.25 / _barometricPressure; diff --git a/addons/advanced_ballistics/functions/fnc_calculateWindSpeed.sqf b/addons/advanced_ballistics/functions/fnc_calculateWindSpeed.sqf index 5a4a97e3db..8905d457a3 100644 --- a/addons/advanced_ballistics/functions/fnc_calculateWindSpeed.sqf +++ b/addons/advanced_ballistics/functions/fnc_calculateWindSpeed.sqf @@ -3,9 +3,9 @@ private ["_windSpeed", "_windDir", "_height", "_newWindSpeed", "_windSource", "_roughnessLength"]; fnc_polar2vect = { - private ["_mag2D"]; - _mag2D = (_this select 0) * cos((_this select 2)); - [_mag2D * sin((_this select 1)), _mag2D * cos((_this select 1)), (_this select 0) * sin((_this select 2))]; + private ["_mag2D"]; + _mag2D = (_this select 0) * cos((_this select 2)); + [_mag2D * sin((_this select 1)), _mag2D * cos((_this select 1)), (_this select 0) * sin((_this select 2))]; }; _windSpeed = vectorMagnitude ACE_wind; @@ -13,52 +13,52 @@ _windDir = (ACE_wind select 0) atan2 (ACE_wind select 1); // Wind gradient if (_windSpeed > 0.05) then { - _height = (ASLToATL _this) select 2; - _height = 0 max _height min 20; - if (_height < 20) then { - _roughnessLength = _this call FUNC(calculateRoughnessLength); - _windSpeed = _windSpeed * ln(_height / _roughnessLength) / ln(20 / _roughnessLength); - }; + _height = (ASLToATL _this) select 2; + _height = 0 max _height min 20; + if (_height < 20) then { + _roughnessLength = _this call FUNC(calculateRoughnessLength); + _windSpeed = _windSpeed * ln(_height / _roughnessLength) / ln(20 / _roughnessLength); + }; }; // Terrain effect on wind if (_windSpeed > 0.05) then { - _newWindSpeed = 0; - { - _windSource = [100, _windDir + 180, _x] call fnc_polar2vect; - if (!(terrainIntersectASL [_this, _this vectorAdd _windSource])) exitWith { - _newWindSpeed = cos(_x * 9) * _windSpeed; - }; - _windSource = [100, _windDir + 180 + _x, 0] call fnc_polar2vect; - if (!(terrainIntersectASL [_this, _this vectorAdd _windSource])) exitWith { - _newWindSpeed = cos(_x * 9) * _windSpeed; - }; - _windSource = [100, _windDir + 180 - _x, 0] call fnc_polar2vect; - if (!(terrainIntersectASL [_this, _this vectorAdd _windSource])) exitWith { - _newWindSpeed = cos(_x * 9) * _windSpeed; - }; - } forEach [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; - _windSpeed = _newWindSpeed; + _newWindSpeed = 0; + { + _windSource = [100, _windDir + 180, _x] call fnc_polar2vect; + if (!(terrainIntersectASL [_this, _this vectorAdd _windSource])) exitWith { + _newWindSpeed = cos(_x * 9) * _windSpeed; + }; + _windSource = [100, _windDir + 180 + _x, 0] call fnc_polar2vect; + if (!(terrainIntersectASL [_this, _this vectorAdd _windSource])) exitWith { + _newWindSpeed = cos(_x * 9) * _windSpeed; + }; + _windSource = [100, _windDir + 180 - _x, 0] call fnc_polar2vect; + if (!(terrainIntersectASL [_this, _this vectorAdd _windSource])) exitWith { + _newWindSpeed = cos(_x * 9) * _windSpeed; + }; + } forEach [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + _windSpeed = _newWindSpeed; }; // Obstacle effect on wind if (_windSpeed > 0.05) then { - _newWindSpeed = 0; - { - _windSource = [20, _windDir + 180, _x] call fnc_polar2vect; - if (!(lineIntersects [_this, _this vectorAdd _windSource])) exitWith { - _newWindSpeed = cos(_x * 2) * _windSpeed; - }; - _windSource = [20, _windDir + 180 + _x, 0] call fnc_polar2vect; - if (!(lineIntersects [_this, _this vectorAdd _windSource])) exitWith { - _newWindSpeed = cos(_x * 2) * _windSpeed; - }; - _windSource = [20, _windDir + 180 - _x, 0] call fnc_polar2vect; - if (!(lineIntersects [_this, _this vectorAdd _windSource])) exitWith { - _newWindSpeed = cos(_x * 2) * _windSpeed; - }; - } forEach [0, 5, 10, 15, 20, 25, 30, 35, 40, 45]; - _windSpeed = _newWindSpeed; + _newWindSpeed = 0; + { + _windSource = [20, _windDir + 180, _x] call fnc_polar2vect; + if (!(lineIntersects [_this, _this vectorAdd _windSource])) exitWith { + _newWindSpeed = cos(_x * 2) * _windSpeed; + }; + _windSource = [20, _windDir + 180 + _x, 0] call fnc_polar2vect; + if (!(lineIntersects [_this, _this vectorAdd _windSource])) exitWith { + _newWindSpeed = cos(_x * 2) * _windSpeed; + }; + _windSource = [20, _windDir + 180 - _x, 0] call fnc_polar2vect; + if (!(lineIntersects [_this, _this vectorAdd _windSource])) exitWith { + _newWindSpeed = cos(_x * 2) * _windSpeed; + }; + } forEach [0, 5, 10, 15, 20, 25, 30, 35, 40, 45]; + _windSpeed = _newWindSpeed; }; _windSpeed = 0 max _windSpeed; diff --git a/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf b/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf index 84f810969a..91218e7818 100644 --- a/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf +++ b/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf @@ -7,44 +7,44 @@ private ["_inclinationAngle", "_refPosition"]; if (GVAR(Protractor)) exitWith { - GVAR(Protractor) = false; - 1 cutText ["", "PLAIN"]; - true + GVAR(Protractor) = false; + 1 cutText ["", "PLAIN"]; + true }; if (weaponLowered ACE_player) exitWith { true }; if (vehicle ACE_player != ACE_player) exitWith { true }; if (currentWeapon ACE_player != primaryWeapon ACE_player) exitWith { true }; [] spawn { - 2 cutText ["", "PLAIN"]; - GVAR(WindInfo) = false; - 0 cutText ["", "PLAIN"]; - GVAR(Protractor) = true; - - while {GVAR(Protractor) && !(weaponLowered ACE_player) && currentWeapon ACE_player == primaryWeapon ACE_player} do { - _refPosition = [SafeZoneX + 0.001, SafeZoneY + 0.001, 0.2, 0.2 * 4/3]; - - _inclinationAngle = asin((ACE_player weaponDirection currentWeapon ACE_player) select 2); - _inclinationAngle = -58 max _inclinationAngle min 58; - - 1 cutRsc ["RscProtractor", "PLAIN", 1, false]; - - __ctrl1 ctrlSetScale 0.75; - __ctrl1 ctrlCommit 0; - __ctrl1 ctrlSetText QUOTE(PATHTOF(UI\protractor.paa)); - __ctrl1 ctrlSetTextColor [1, 1, 1, 1]; - - __ctrl2 ctrlSetScale 0.75; - __ctrl2 ctrlSetPosition [(_refPosition select 0), (_refPosition select 1) - 0.0012 * _inclinationAngle, (_refPosition select 2), (_refPosition select 3)]; - __ctrl2 ctrlCommit 0; - __ctrl2 ctrlSetText QUOTE(PATHTOF(UI\protractor_marker.paa)); - __ctrl2 ctrlSetTextColor [1, 1, 1, 1]; - - sleep 0.1; - }; + 2 cutText ["", "PLAIN"]; + GVAR(WindInfo) = false; + 0 cutText ["", "PLAIN"]; + GVAR(Protractor) = true; + + while {GVAR(Protractor) && !(weaponLowered ACE_player) && currentWeapon ACE_player == primaryWeapon ACE_player} do { + _refPosition = [SafeZoneX + 0.001, SafeZoneY + 0.001, 0.2, 0.2 * 4/3]; + + _inclinationAngle = asin((ACE_player weaponDirection currentWeapon ACE_player) select 2); + _inclinationAngle = -58 max _inclinationAngle min 58; + + 1 cutRsc ["RscProtractor", "PLAIN", 1, false]; + + __ctrl1 ctrlSetScale 0.75; + __ctrl1 ctrlCommit 0; + __ctrl1 ctrlSetText QUOTE(PATHTOF(UI\protractor.paa)); + __ctrl1 ctrlSetTextColor [1, 1, 1, 1]; + + __ctrl2 ctrlSetScale 0.75; + __ctrl2 ctrlSetPosition [(_refPosition select 0), (_refPosition select 1) - 0.0012 * _inclinationAngle, (_refPosition select 2), (_refPosition select 3)]; + __ctrl2 ctrlCommit 0; + __ctrl2 ctrlSetText QUOTE(PATHTOF(UI\protractor_marker.paa)); + __ctrl2 ctrlSetTextColor [1, 1, 1, 1]; + + sleep 0.1; + }; - GVAR(Protractor) = false; - 1 cutText ["", "PLAIN"]; + GVAR(Protractor) = false; + 1 cutText ["", "PLAIN"]; }; true diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf index 87637022e3..e4f7bb8b80 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf @@ -44,52 +44,52 @@ _airFriction = getNumber(configFile >> "cfgAmmo" >> _ammo >> "airFriction"); _muzzleVelocity = getNumber(configFile >> "cfgMagazines" >> _magazine >> "initSpeed"); _muzzleVelocityCoef = getNumber(configFile >> "cfgWeapons" >> _weapon >> "initSpeed"); if (_muzzleVelocityCoef > 0) then { - _muzzleVelocity = _muzzleVelocityCoef; + _muzzleVelocity = _muzzleVelocityCoef; }; if (_muzzleVelocityCoef < 0) then { - _muzzleVelocity = _muzzleVelocity * (-1 * _muzzleVelocityCoef); + _muzzleVelocity = _muzzleVelocity * (-1 * _muzzleVelocityCoef); }; _muzzleAccessory = ""; switch (currentWeapon _unit) do { - case primaryWeapon _unit: { _muzzleAccessory = (primaryWeaponItems _unit) select 0; }; - case handgunWeapon _unit: { _muzzleAccessory = (handgunItems _unit) select 0; }; + case primaryWeapon _unit: { _muzzleAccessory = (primaryWeaponItems _unit) select 0; }; + case handgunWeapon _unit: { _muzzleAccessory = (handgunItems _unit) select 0; }; }; if (_muzzleAccessory != "" && isNumber(configFile >> "cfgWeapons" >> _muzzleAccessory >> "ItemInfo" >> "MagazineCoef" >> "initSpeed")) then { - _initSpeedCoef = getNumber(configFile >> "cfgWeapons" >> _muzzleAccessory >> "ItemInfo" >> "MagazineCoef" >> "initSpeed"); - _muzzleVelocity = _muzzleVelocity * _initSpeedCoef; + _initSpeedCoef = getNumber(configFile >> "cfgWeapons" >> _muzzleAccessory >> "ItemInfo" >> "MagazineCoef" >> "initSpeed"); + _muzzleVelocity = _muzzleVelocity * _initSpeedCoef; }; if (GVAR(BarrelLengthInfluenceEnabled)) then { - _muzzleVelocityShift = [_ammo, _weapon, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift); - if (_muzzleVelocityShift != 0) then { - _bulletVelocity = velocity _bullet; - _bulletSpeed = vectorMagnitude _bulletVelocity; - _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift * (_bulletSpeed / _muzzleVelocity))); - _bullet setVelocity _bulletVelocity; - _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; - }; + _muzzleVelocityShift = [_ammo, _weapon, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift); + if (_muzzleVelocityShift != 0) then { + _bulletVelocity = velocity _bullet; + _bulletSpeed = vectorMagnitude _bulletVelocity; + _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift * (_bulletSpeed / _muzzleVelocity))); + _bullet setVelocity _bulletVelocity; + _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; + }; }; if (GVAR(AmmoTemperatureEnabled)) then { - _temperature = GET_TEMPERATURE_AT_HEIGHT((getPosASL _unit) select 2); - _muzzleVelocityShift = [_ammo, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift); - if (_muzzleVelocityShift != 0) then { - _bulletVelocity = velocity _bullet; - _bulletSpeed = vectorMagnitude _bulletVelocity; - _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift * (_bulletSpeed / _muzzleVelocity))); - _bullet setVelocity _bulletVelocity; - _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; - }; + _temperature = GET_TEMPERATURE_AT_HEIGHT((getPosASL _unit) select 2); + _muzzleVelocityShift = [_ammo, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift); + if (_muzzleVelocityShift != 0) then { + _bulletVelocity = velocity _bullet; + _bulletSpeed = vectorMagnitude _bulletVelocity; + _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift * (_bulletSpeed / _muzzleVelocity))); + _bullet setVelocity _bulletVelocity; + _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; + }; }; // TODO: Make _bulletTraceVisible global and toggle it with events _bulletTraceVisible = false; if (GVAR(BulletTraceEnabled) && currentWeapon ACE_player == primaryWeapon ACE_player && count primaryWeaponItems ACE_player > 2) then { - _opticsName = (primaryWeaponItems ACE_player) select 2; - _opticType = getNumber(configFile >> "cfgWeapons" >> _opticsName >> "ItemInfo" >> "opticType"); - _bulletTraceVisible = (_opticType == 2 || currentWeapon ACE_player in ["ACE_Vector", "Binocular", "Rangefinder", "Laserdesignator"]) && cameraView == "GUNNER"; + _opticsName = (primaryWeaponItems ACE_player) select 2; + _opticType = getNumber(configFile >> "cfgWeapons" >> _opticsName >> "ItemInfo" >> "opticType"); + _bulletTraceVisible = (_opticType == 2 || currentWeapon ACE_player in ["ACE_Vector", "Binocular", "Rangefinder", "Laserdesignator"]) && cameraView == "GUNNER"; }; _caliber = getNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_caliber"); @@ -99,22 +99,22 @@ _barrelTwist = getNumber(configFile >> "cfgWeapons" >> _weapon >> "ACE_barrelTwi _stabilityFactor = 1.5; if (_caliber > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then { - _temperature = GET_TEMPERATURE_AT_HEIGHT((getPosASL _unit) select 2); - _barometricPressure = 1013.25 * exp(-(EGVAR(weather,Altitude) + ((getPosASL _bullet) select 2)) / 7990) - 10 * overcast; - _stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call FUNC(calculateStabilityFactor); + _temperature = GET_TEMPERATURE_AT_HEIGHT((getPosASL _unit) select 2); + _barometricPressure = 1013.25 * exp(-(EGVAR(weather,Altitude) + ((getPosASL _bullet) select 2)) / 7990) - 10 * overcast; + _stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call FUNC(calculateStabilityFactor); }; _twistDirection = 1; if (isNumber(configFile >> "cfgWeapons" >> _weapon >> "ACE_twistDirection")) then { - _twistDirection = getNumber(configFile >> "cfgWeapons" >> _weapon >> "ACE_twistDirection"); - if (_twistDirection != -1 && _twistDirection != 0 && _twistDirection != 1) then { - _twistDirection = 1; - }; + _twistDirection = getNumber(configFile >> "cfgWeapons" >> _weapon >> "ACE_twistDirection"); + if (_twistDirection != -1 && _twistDirection != 0 && _twistDirection != 1) then { + _twistDirection = 1; + }; }; _transonicStabilityCoef = 0.5; if (isNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_transonicStabilityCoef")) then { - _transonicStabilityCoef = getNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_transonicStabilityCoef"); + _transonicStabilityCoef = getNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_transonicStabilityCoef"); }; _dragModel = 1; @@ -122,27 +122,27 @@ _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"); + }; }; _index = count GVAR(bulletDatabase); if (count GVAR(bulletDatabaseFreeIndices) > 0) then { - _index = GVAR(bulletDatabaseFreeIndices) select 0; - GVAR(bulletDatabaseFreeIndices) = GVAR(bulletDatabaseFreeIndices) - [_index]; + _index = GVAR(bulletDatabaseFreeIndices) select 0; + GVAR(bulletDatabaseFreeIndices) = GVAR(bulletDatabaseFreeIndices) - [_index]; }; #ifdef USE_ADVANCEDBALLISTICS_DLL diff --git a/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf b/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf index 4f50fdfb3f..a79b76bd31 100644 --- a/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf +++ b/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf @@ -13,31 +13,31 @@ #include "script_component.hpp" [] spawn { - private ["_initStartTime", "_mapSize", "_mapGrids", "_gridCenter", "_gridHeight", "_gridNumObjects", "_gridSurfaceIsWater"]; - - _initStartTime = time; - _mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize"); - - if (("AdvancedBallistics" callExtension format["init:%1:%2", worldName, _mapSize]) == "Terrain already initialized") exitWith { - if (GVAR(INIT_MESSAGE_ENABLED)) then { - systemChat "AdvancedBallistics: Terrain already initialized"; - }; - }; - - _mapGrids = ceil(_mapSize / 50); - - for "_x" from 0 to _mapGrids * 50 step 50 do { - for "_y" from 0 to _mapGrids * 50 step 50 do { - _gridCenter = [_x + 25, _y + 25]; - _gridHeight = round(getTerrainHeightASL _gridCenter); - _gridNumObjects = count (_gridCenter nearObjects ["Building", 50]); - _gridSurfaceIsWater = if (surfaceIsWater _gridCenter) then {1} else {0}; - "AdvancedBallistics" callExtension format["set:%1:%2:%3", _gridHeight, _gridNumObjects, _gridSurfaceIsWater]; - }; - sleep 0.001; - }; - - if (GVAR(INIT_MESSAGE_ENABLED)) then { - systemChat format["AdvancedBallistics: Finished terrain initialization in %1 seconds", ceil(time - _initStartTime)]; - }; + private ["_initStartTime", "_mapSize", "_mapGrids", "_gridCenter", "_gridHeight", "_gridNumObjects", "_gridSurfaceIsWater"]; + + _initStartTime = time; + _mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize"); + + if (("AdvancedBallistics" callExtension format["init:%1:%2", worldName, _mapSize]) == "Terrain already initialized") exitWith { + if (GVAR(INIT_MESSAGE_ENABLED)) then { + systemChat "AdvancedBallistics: Terrain already initialized"; + }; + }; + + _mapGrids = ceil(_mapSize / 50); + + for "_x" from 0 to _mapGrids * 50 step 50 do { + for "_y" from 0 to _mapGrids * 50 step 50 do { + _gridCenter = [_x + 25, _y + 25]; + _gridHeight = round(getTerrainHeightASL _gridCenter); + _gridNumObjects = count (_gridCenter nearObjects ["Building", 50]); + _gridSurfaceIsWater = if (surfaceIsWater _gridCenter) then {1} else {0}; + "AdvancedBallistics" callExtension format["set:%1:%2:%3", _gridHeight, _gridNumObjects, _gridSurfaceIsWater]; + }; + sleep 0.001; + }; + + if (GVAR(INIT_MESSAGE_ENABLED)) then { + systemChat format["AdvancedBallistics: Finished terrain initialization in %1 seconds", ceil(time - _initStartTime)]; + }; }; diff --git a/addons/advanced_ballistics/script_component.hpp b/addons/advanced_ballistics/script_component.hpp index fde5f5a97c..e398f8869c 100644 --- a/addons/advanced_ballistics/script_component.hpp +++ b/addons/advanced_ballistics/script_component.hpp @@ -4,11 +4,11 @@ #define USE_ADVANCEDBALLISTICS_DLL #ifdef DEBUG_ENABLED_ADVANCEDBALLISTICS - #define DEBUG_MODE_FULL + #define DEBUG_MODE_FULL #endif #ifdef DEBUG_SETTINGS_ADVANCEDBALLISTICS - #define DEBUG_SETTINGS DEBUG_SETTINGS_ADVANCEDBALLISTICS + #define DEBUG_SETTINGS DEBUG_SETTINGS_ADVANCEDBALLISTICS #endif #include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file diff --git a/addons/advanced_ballistics/stringtable.xml b/addons/advanced_ballistics/stringtable.xml index ef43bd18ed..7136e89d0f 100644 --- a/addons/advanced_ballistics/stringtable.xml +++ b/addons/advanced_ballistics/stringtable.xml @@ -1,11 +1,11 @@  - + Show Wind Info Show Protractor - +