diff --git a/.travis.yml b/.travis.yml
index 388b1f114f..0aadd9cd0b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,6 +9,7 @@ before_script:
- pip install pygithub3
script:
- python3 tools/deploy.py
+ - python3 tools/sqf_validator.py
env:
global:
- secure: "KcJQbknBOdC5lA4nFGKPXVRVIGLDXDRzC8XkHuXJCE9pIR/wbxbkvx8fHKcC6SC9eHgzneC3+o4m4+CjIbVvIwDgslRbJ8Y59i90ncONmdoRx1HUYHwuYWVZm9HJFjCsIbrEqhSyyKS+PB3WZVOLbErtNHsgS8f43PTh5Ujg7Vg="
diff --git a/AUTHORS.txt b/AUTHORS.txt
index 62329d7c1d..caa19109a7 100644
--- a/AUTHORS.txt
+++ b/AUTHORS.txt
@@ -1,4 +1,4 @@
-# ACE 3 CONTRIBUTOR LIST
+# ACE3 CONTRIBUTOR LIST
# If you contributed, but are not listed here, contact me:
# koffeinflummi@gmail.com
#
@@ -14,6 +14,7 @@ Garth "L-H" de Wet
Giallustio
Glowbal
Janus
+jokoho482 `
Kieran
NouberNou
PabstMirror
@@ -50,6 +51,8 @@ Coren
Crusty
Dharma Bellamkonda
Dimaslg
+Drill
+Dudakov
eRazeri
evromalarkey
F3 Project
@@ -68,8 +71,7 @@ Hamburger SV
Harakhti
havena
Hawkins
-Head
-jokoho482 `
+Head
Jonpas
Karneck
Kavinsky
@@ -81,6 +83,7 @@ Macusercom
MarcBook
meat
Michail Nikolaev
+MikeMatrix
nic547
nikolauska
nomisum
@@ -106,5 +109,3 @@ Valentin Torikian
VyMajoris(W-Cephei)
Winter
zGuba
-Drill
-MikeMatrix
diff --git a/README.md b/README.md
index 2739ce55be..5a01e5d5de 100644
--- a/README.md
+++ b/README.md
@@ -3,75 +3,78 @@
-
+
-
-
+
+
-
+
-
-
+
+
-
+
+
+
+
-Requires the latest version of CBA A3. Visit us on Facebook | YouTube | Twitter | Reddit
+Requires the latest version of CBA A3. Visit us on Facebook | YouTube | Twitter | Reddit
**ACE3** is a joint effort by the teams behind **ACE2**, **AGM** and **CSE** to improve the realism and authenticity of Arma 3.
The project is entirely **open-source** and all contributions are welcome. Feel free to maintain your own custom version, so long as the changes you make are open to the public in accordance with the GNU General Public License ([GPLv2](https://github.com/acemod/ACE3/blob/master/LICENSE)).
-The mod is **built modularly**, so almost any included PBO can be easily removed from the configuration. This way, a team can maintain its own tailored version of ACE by simply excluding any components they don't need, or those possibly in conflict with other add-ons. Modules themselves, e.g. the medical system, also include various customization options, allowing mission designers to tweak the overall experience.
+The mod is **built modularly**, so almost any included PBO can be easily removed from the configuration. This way, a team can maintain its own tailored version of ACE3 by simply excluding any components they don't need, or those possibly in conflict with other mods. Modules themselves, e.g. the medical system, also include various customization options, allowing mission designers to tweak the overall experience.
### Core features
-* Brand new 3D interaction/action system
-* Performance and reliability framework
-* Focus on modularity and customization
-* New flexible client and server settings & configuration
-* Improved medical system with various levels (basic/advanced) focus on gameplay/realism
-* Proper & consistent network-synced weather
-* Wind and weather-based ballistics
-* Captivity system
-* Explosives system, including different trigger types
-* Map screen improvements – marker placement and map tools
-* Advanced missile guidance and laser designation
+- Brand new 3D interaction/action system
+- Performance and reliability framework
+- Focus on modularity and customization
+- New flexible client and server settings & configuration
+- Improved medical system with various levels (basic/advanced) focus on gameplay/realism
+- Proper & consistent network-synced weather
+- Wind and weather-based ballistics
+- Captivity system
+- Explosives system, including different trigger types
+- Map screen improvements – marker placement and map tools
+- Advanced missile guidance and laser designation
#### Additional features
-* Carrying and dragging
-* Realistic names for vehicles and weapons
-* A fire control system (FCS) for armored vehicles and helicopters
-* Realistic ballistics/FCS calculated in C/C++ extensions
-* Backblast area and overpressure simulation
-* Disposable launchers
-* Realistic G-forces
-* Vehicle locking
-* Realistic night and thermal vision modes
-* Magazine repacking
-* Realistic weapon overheating mechanic
-* Combat deafness (temporary loss of hearing) simulation
-* Improved ragdoll physics
-* Improved interactions for AARs and ammo bearers
-* Adjustable sniper scopes
-* No idle animation with lowered weapon
-* No talking player avatar
-* Jumping over obstacles, climbing over walls and cutting down fences
-* Vector, MicroDAGR and Kestrel devices
+- Carrying and dragging
+- Realistic names for vehicles and weapons
+- A fire control system (FCS) for armored vehicles and helicopters
+- Realistic ballistics/FCS calculated in C/C++ extensions
+- Backblast area and overpressure simulation
+- Disposable launchers
+- Realistic G-forces
+- Vehicle locking
+- Realistic night and thermal vision modes
+- Magazine repacking
+- Realistic weapon overheating mechanic
+- Combat deafness (temporary loss of hearing) simulation
+- Improved ragdoll physics
+- Improved interactions for AARs and ammo bearers
+- Adjustable sniper scopes
+- No idle animation with lowered weapon
+- No talking player avatar
+- Jumping over obstacles, climbing over walls and cutting down fences
+- Vector, MicroDAGR and Kestrel devices
***and much more...***
### Guides & how-tos
If you installed ACE3 but have trouble understanding how it all works, or where to start, read this first:
-* [Getting started](http://ace3mod.com/wiki/user/getting-started.html)
+- [Getting started](http://ace3mod.com/wiki/user/getting-started.html)
#### Contributing
-You can help out with the ongoing development by looking for potential bugs in our code base, or by contributing new features. To contribute something to ACE, simply fork this repository and submit your pull requests for review by other collaborators. Remember to add yourself to the author array of any PBO you will be editing and the [`AUTHORS.txt`](https://github.com/acemod/ACE3/blob/master/AUTHORS.txt) file; including a valid email address.
+You can help out with the ongoing development by looking for potential bugs in our code base, or by contributing new features. To contribute something to ACE3, simply fork this repository and submit your pull requests for review by other collaborators. Remember to add yourself to the author array of any PBO you will be editing and the [`AUTHORS.txt`](https://github.com/acemod/ACE3/blob/master/AUTHORS.txt) file; including a valid email address.
Please, use our [Issue Tracker](https://github.com/acemod/ACE3/issues) to report a bug, propose a feature, or suggest changes to the existing ones. See also:
-* [How to report an issue](http://ace3mod.com/wiki/user/how-to-report-an-issue.html)
-* [How to make a feature request](http://ace3mod.com/wiki/user/how-to-make-a-feature-request.html)
+- [How to report an issue](http://ace3mod.com/wiki/user/how-to-report-an-issue.html)
+- [How to make a feature request](http://ace3mod.com/wiki/user/how-to-make-a-feature-request.html)
#### Testing & building
To help us test the latest development changes, download our master branch ([directly](https://github.com/acemod/ACE3/archive/master.zip), or [with git](https://help.github.com/articles/fetching-a-remote/)), then assemble a test build:
-* [Setting up the development environment](http://ace3mod.com/wiki/development/setting-up-the-development-environment.html) – step-by-step instructions on how to properly setup and build a version of ACE for testing purposes.
+- [Setting up the development environment](http://ace3mod.com/wiki/development/setting-up-the-development-environment.html) – step-by-step instructions on how to properly setup and build a version of ACE3 for testing purposes.
diff --git a/ace_medical.dll b/ace_medical.dll
index 790154d4c4..c54febf34f 100644
Binary files a/ace_medical.dll and b/ace_medical.dll differ
diff --git a/addons/advanced_ballistics/README.md b/addons/advanced_ballistics/README.md
index ef98bcd2b6..122769b191 100644
--- a/addons/advanced_ballistics/README.md
+++ b/addons/advanced_ballistics/README.md
@@ -3,8 +3,9 @@ ace_advanced_ballistics
The Advanced Ballistics module introduces advanced external- and internal ballistics to the game.
+
## Maintainers
The people responsible for merging changes to this component or answering potential questions.
-- [Ruthberg] (http://github.com/Ulteq)
\ No newline at end of file
+- [Ruthberg](http://github.com/Ulteq)
diff --git a/addons/advanced_ballistics/XEH_postInit.sqf b/addons/advanced_ballistics/XEH_postInit.sqf
index b199acb9e5..1f9002e606 100644
--- a/addons/advanced_ballistics/XEH_postInit.sqf
+++ b/addons/advanced_ballistics/XEH_postInit.sqf
@@ -6,9 +6,8 @@ GVAR(currentbulletID) = -1;
GVAR(Protractor) = false;
GVAR(ProtractorStart) = ACE_time;
-
+GVAR(allBullets) = [];
GVAR(currentGrid) = 0;
-GVAR(initMessageEnabled) = false;
GVAR(extensionAvailable) = true;
/* @TODO: Remove this until versioning is in sync with cmake/build versioning
diff --git a/addons/advanced_ballistics/XEH_preInit.sqf b/addons/advanced_ballistics/XEH_preInit.sqf
index 12018ad412..f722d9c573 100644
--- a/addons/advanced_ballistics/XEH_preInit.sqf
+++ b/addons/advanced_ballistics/XEH_preInit.sqf
@@ -13,5 +13,5 @@ PREP(initializeTerrainExtension);
PREP(initModuleSettings);
PREP(readAmmoDataFromConfig);
PREP(readWeaponDataFromConfig);
-
+PREP(handleFirePFH);
ADDON = true;
diff --git a/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf b/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf
index 28df9d1d97..8b0c78e86c 100644
--- a/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf
+++ b/addons/advanced_ballistics/functions/fnc_calculateAmmoTemperatureVelocityShift.sqf
@@ -8,29 +8,29 @@
* 1: temperature - degrees celcius
*
* Return Value:
- * 0: muzzle velocity shift - m/s
+ * muzzle velocity shift - m/s
*
- * Return value:
- * None
+ * Public: No
*/
#include "script_component.hpp"
-private ["_muzzleVelocityShiftTable", "_temperature", "_muzzleVelocityShift", "_temperatureIndexA", "_temperatureIndexB", "_temperatureRatio"];
-_muzzleVelocityShiftTable = _this select 0;
-_temperature = _this select 1;
+private ["_muzzleVelocityShiftTableUpperLimit", "_temperatureIndexFunction",
+ "_temperatureIndexA", "_temperatureIndexB", "_interpolationRatio"];
+params["_muzzleVelocityShiftTable", "_temperature"];
-if (count _muzzleVelocityShiftTable != 11) exitWith { 0 };
+// Check if muzzleVelocityShiftTable is Larger Than 11 Entrys
+_muzzleVelocityShiftTableUpperLimit = _muzzleVelocityShiftTable select 10;
+if (isNil "_muzzleVelocityShiftTableUpperLimit") exitWith { 0 };
-_temperatureIndexA = floor((_temperature + 15) / 5);
-_temperatureIndexA = 0 max _temperatureIndexA;
-_temperatureIndexA = _temperatureIndexA min 10;
+// Find exact data index required for given temperature
+_temperatureIndexFunction = (_temperature + 15) / 5;
-_temperatureIndexB = ceil((_temperature + 15) / 5);
-_temperatureIndexB = 0 max _temperatureIndexB;
-_temperatureIndexB = _temperatureIndexB min 10;
+// lower and upper data index used for interpolation
+_temperatureIndexA = (0 max (floor(_temperatureIndexFunction))) min 10;
+_temperatureIndexB = (0 max (ceil(_temperatureIndexFunction))) min 10;
-_temperatureRatio = ((_temperature + 15) / 5) - floor((_temperature + 15) / 5);
+// Interpolation ratio
+_interpolationRatio = _temperatureIndexFunction - floor(_temperatureIndexFunction);
-_muzzleVelocityShift = (_muzzleVelocityShiftTable select _temperatureIndexA) * (1 - _temperatureRatio) + (_muzzleVelocityShiftTable select _temperatureIndexB) * _temperatureRatio;
-
-_muzzleVelocityShift
+// Interpolation
+(_muzzleVelocityShiftTable select _temperatureIndexA) * (1 - _interpolationRatio) + (_muzzleVelocityShiftTable select _temperatureIndexB) * _interpolationRatio // Return
diff --git a/addons/advanced_ballistics/functions/fnc_calculateAtmosphericCorrection.sqf b/addons/advanced_ballistics/functions/fnc_calculateAtmosphericCorrection.sqf
index b0166109f5..fac048c061 100644
--- a/addons/advanced_ballistics/functions/fnc_calculateAtmosphericCorrection.sqf
+++ b/addons/advanced_ballistics/functions/fnc_calculateAtmosphericCorrection.sqf
@@ -17,12 +17,9 @@
*/
#include "script_component.hpp"
-private ["_ballisticCoefficient", "_temperature", "_pressure", "_relativeHumidity", "_atmosphereModel", "_airDensity"];
-_ballisticCoefficient = _this select 0;
-_temperature = _this select 1; // in C
-_pressure = _this select 2; // in hPa
-_relativeHumidity = _this select 3; // as ratio 0-1
-_atmosphereModel = _this select 4; // "ICAO" or "ASM"
+private "_airDensity";
+
+params ["_ballisticCoefficient", "_temperature"/*in C*/, "_pressure"/*in hPa*/, "_relativeHumidity"/*as ratio 0-1*/, "_atmosphereModel"/*"ICAO" or "ASM"*/];
_airDensity = [_temperature, _pressure, _relativeHumidity] call EFUNC(weather,calculateAirDensity);
diff --git a/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf b/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf
index de037f49bc..9c46cc2423 100644
--- a/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf
+++ b/addons/advanced_ballistics/functions/fnc_calculateBarrelLengthVelocityShift.sqf
@@ -1,5 +1,5 @@
/*
- * Author: Ruthberg
+ * Author: Ruthberg, MikeMatrix, joko // Jonas
*
* Calculates the muzzle velocity shift caused by different barrel lengths
*
@@ -10,46 +10,61 @@
* 3: muzzle velocity - m/s
*
* Return Value:
- * 0: muzzle velocity shift - m/s
+ * muzzle velocity shift - m/s
*
- * Return value:
- * None
+ * Public: No
*/
#include "script_component.hpp"
-private ["_barrelLength", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocity", "_lowerIndex", "_upperIndex", "_barrelLengthRatio", "_muzzleVelocityNew"];
-_barrelLength = _this select 0;
-_muzzleVelocityTable = _this select 1;
-_barrelLengthTable = _this select 2;
-_muzzleVelocity = _this select 3;
+scopeName "main";
+private ["_muzzleVelocityTableCount", "_barrelLengthTableCount", "_lowerDataIndex",
+ "_upperDataIndex", "_lowerBarrelLength", "_upperBarrelLength", "_lowerMuzzleVelocity",
+ "_upperMuzzleVelocity", "_interpolationRatio"];
+params ["_barrelLength", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocity"];
+
+// If barrel length is not defined, then there is no point in calculating muzzle velocity
if (_barrelLength == 0) exitWith { 0 };
-if (count _muzzleVelocityTable != count _barrelLengthTable) exitWith { 0 };
-if (count _muzzleVelocityTable == 0 || count _barrelLengthTable == 0) exitWith { 0 };
-if (count _muzzleVelocityTable == 1) exitWith { (_muzzleVelocityTable select 0) - _muzzleVelocity };
-_lowerIndex = 0;
-_upperIndex = (count _barrelLengthTable) - 1;
+_muzzleVelocityTableCount = count _muzzleVelocityTable;
+_barrelLengthTableCount = count _barrelLengthTable;
-if (_barrelLength <= (_barrelLengthTable select _lowerIndex)) exitWith { (_muzzleVelocityTable select _lowerIndex) - _muzzleVelocity };
-if (_barrelLength >= (_barrelLengthTable select _upperIndex)) exitWith { (_muzzleVelocityTable select _upperIndex) - _muzzleVelocity };
+// Exit if tables are different sizes, have no elements or have only one element
+if (_muzzleVelocityTableCount != _barrelLengthTableCount || _muzzleVelocityTableCount == 0 || _barrelLengthTableCount == 0) exitWith { 0 };
+if (_muzzleVelocityTableCount == 1) exitWith { (_muzzleVelocityTable select 0) - _muzzleVelocity };
-for "_i" from 0 to (count _barrelLengthTable) - 1 do {
- 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 we have the precise barrel length value, return result immediately
+if (_barrelLength in _barrelLengthTable) exitWith {
+ (_muzzleVelocityTable select (_barrelLengthTable find _barrelLength)) - _muzzleVelocity
+};
+
+// Limit values to lower and upper bound of data we have available
+if (_barrelLength <= (_barrelLengthTable select 0)) exitWith { (_muzzleVelocityTable select 0) - _muzzleVelocity };
+if (_barrelLength >= (_barrelLengthTable select _barrelLengthTableCount - 1)) exitWith { (_muzzleVelocityTable select _barrelLengthTableCount - 1) - _muzzleVelocity };
+
+// Find closest bordering values for barrel length
+{
+ if (_barrelLength <= _x) then {
+ _upperDataIndex = _forEachIndex;
+ _lowerDataIndex = _upperDataIndex - 1;
+ breakTo "main";
};
+} forEach _barrelLengthTable;
+
+// Worst case scenario
+if (isNil "_lowerDataIndex" || isNil "_upperDataIndex") exitWith {0};
+
+_lowerBarrelLength = _barrelLengthTable select _lowerDataIndex;
+_upperBarrelLength = _barrelLengthTable select _upperDataIndex;
+_lowerMuzzleVelocity = _muzzleVelocityTable select _lowerDataIndex;
+_upperMuzzleVelocity = _muzzleVelocityTable select _upperDataIndex;
+
+// Calculate interpolation ratio
+_interpolationRatio = if (abs (_lowerBarrelLength - _upperBarrelLength) > 0) then {
+ (_upperBarrelLength - _barrelLength) / (_upperBarrelLength - _lowerBarrelLength)
+} else {
+ 0
};
-_barrelLengthRatio = 0;
-if ((_barrelLengthTable select _upperIndex) - (_barrelLengthTable select _lowerIndex) > 0) then {
- _barrelLengthRatio = ((_barrelLengthTable select _upperIndex) - _barrelLength) / ((_barrelLengthTable select _upperIndex) - (_barrelLengthTable select _lowerIndex));
-};
-
-_muzzleVelocityNew = (_muzzleVelocityTable select _lowerIndex) + ((_muzzleVelocityTable select _upperIndex) - (_muzzleVelocityTable select _lowerIndex)) * (1 - _barrelLengthRatio);
-
-_muzzleVelocityNew - _muzzleVelocity
+// Calculate interpolated muzzle velocity shift
+(_lowerMuzzleVelocity + ((_upperMuzzleVelocity - _lowerMuzzleVelocity) * (1 - _interpolationRatio))) - _muzzleVelocity // Return
diff --git a/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf b/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf
index 433dafbe10..0bd801c6b9 100644
--- a/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf
+++ b/addons/advanced_ballistics/functions/fnc_calculateRetardation.sqf
@@ -4,142 +4,129 @@
* Calculates the retardation of the bullet
*
* Arguments:
- * 0: drag model - 1-7
+ * 0: drag model - integer 1-7
* 1: drag coefficient - bc
* 2: velocity - m/s
*
* Return Value:
- * 0: retardation - m/(s^2)
+ * retardation - m/(s^2)
*
- * Return value:
- * None
+ * Public: No
*/
#include "script_component.hpp"
// Source: GNU Exterior Ballistics
-private ["_dragModel", "_dragCoefficient", "_velocity", "_A", "_M", "_result"];
-_dragModel = _this select 0;
-_dragCoefficient = _this select 1;
-_velocity = (_this select 2) * 3.2808399;
-
-_A = -1;
-_M = -1;
-_result = 0;
+private ["_A", "_M"];
+params ["_dragModel", "_dragCoefficient", "_velocity"];
+_velocity = _velocity * 3.2808399;
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 1: {
+ call {
+ if (_velocity > 4230) exitWith { _A = 0.0001477404177730177; _M = 1.9565; };
+ if (_velocity > 3680) exitWith { _A = 0.0001920339268755614; _M = 1.925; };
+ if (_velocity > 3450) exitWith { _A = 0.0002894751026819746; _M = 1.875; };
+ if (_velocity > 3295) exitWith { _A = 0.0004349905111115636; _M = 1.825; };
+ if (_velocity > 3130) exitWith { _A = 0.0006520421871892662; _M = 1.775; };
+ if (_velocity > 2960) exitWith { _A = 0.0009748073694078696; _M = 1.725; };
+ if (_velocity > 2830) exitWith { _A = 0.001453721560187286; _M = 1.675; };
+ if (_velocity > 2680) exitWith { _A = 0.002162887202930376; _M = 1.625; };
+ if (_velocity > 2460) exitWith { _A = 0.003209559783129881; _M = 1.575; };
+ if (_velocity > 2225) exitWith { _A = 0.003904368218691249; _M = 1.55; };
+ if (_velocity > 2015) exitWith { _A = 0.003222942271262336; _M = 1.575; };
+ if (_velocity > 1890) exitWith { _A = 0.002203329542297809; _M = 1.625; };
+ if (_velocity > 1810) exitWith { _A = 0.001511001028891904; _M = 1.675; };
+ if (_velocity > 1730) exitWith { _A = 0.0008609957592468259; _M = 1.75; };
+ if (_velocity > 1595) exitWith { _A = 0.0004086146797305117; _M = 1.85; };
+ if (_velocity > 1520) exitWith { _A = 0.0001954473210037398; _M = 1.95; };
+ if (_velocity > 1420) exitWith { _A = 0.00005431896266462351; _M = 2.125; };
+ if (_velocity > 1360) exitWith { _A = 0.000008847742581674416; _M = 2.375; };
+ if (_velocity > 1315) exitWith { _A = 0.000001456922328720298; _M = 2.625; };
+ if (_velocity > 1280) exitWith { _A = 0.0000002419485191895565; _M = 2.875; };
+ if (_velocity > 1220) exitWith { _A = 0.00000001657956321067612; _M = 3.25; };
+ if (_velocity > 1185) exitWith { _A = 0.0000000004745469537157371; _M = 3.75; };
+ if (_velocity > 1150) exitWith { _A = 0.00000000001379746590025088; _M = 4.25; };
+ if (_velocity > 1100) exitWith { _A = 0.0000000000004070157961147882; _M = 4.75; };
+ if (_velocity > 1060) exitWith { _A = 0.00000000000002938236954847331; _M = 5.125; };
+ if (_velocity > 1025) exitWith { _A = 0.00000000000001228597370774746; _M = 5.25; };
+ if (_velocity > 980) exitWith { _A = 0.00000000000002916938264100495; _M = 5.125; };
+ if (_velocity > 945) exitWith { _A = 0.0000000000003855099424807451; _M = 4.75; };
+ if (_velocity > 905) exitWith { _A = 0.00000000001185097045689854; _M = 4.25; };
+ if (_velocity > 860) exitWith { _A = 0.0000000003566129470974951; _M = 3.75; };
+ if (_velocity > 810) exitWith { _A = 0.00000001045513263966272; _M = 3.25; };
+ if (_velocity > 780) exitWith { _A = 0.0000001291159200846216; _M = 2.875; };
+ if (_velocity > 750) exitWith { _A = 0.0000006824429329105383; _M = 2.625; };
+ if (_velocity > 700) exitWith { _A = 0.000003569169672385163; _M = 2.375; };
+ if (_velocity > 640) exitWith { _A = 0.00001839015095899579; _M = 2.125; };
+ if (_velocity > 600) exitWith { _A = 0.00005711174688734240; _M = 1.950; };
+ if (_velocity > 550) exitWith { _A = 0.00009226557091973427; _M = 1.875; };
+ if (_velocity > 250) exitWith { _A = 0.00009337991957131389; _M = 1.875; };
+ if (_velocity > 100) exitWith { _A = 0.00007225247327590413; _M = 1.925; };
+ if (_velocity > 65) exitWith { _A = 0.00005792684957074546; _M = 1.975; };
+ if (_velocity > 0) exitWith { _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 2: {
+ call {
+ if (_velocity > 1674) exitWith { _A = 0.0079470052136733; _M = 1.36999902851493; };
+ if (_velocity > 1172) exitWith { _A = 0.00100419763721974; _M = 1.65392237010294; };
+ if (_velocity > 1060) exitWith { _A = 0.0000000000000000000000715571228255369; _M = 7.91913562392361; };
+ if (_velocity > 949) exitWith { _A = 0.000000000139589807205091; _M = 3.81439537623717; };
+ if (_velocity > 670) exitWith { _A = 0.000234364342818625; _M = 1.71869536324748; };
+ if (_velocity > 335) exitWith { _A = 0.000177962438921838; _M = 1.76877550388679; };
+ if (_velocity > 0) exitWith { _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 5: {
+ call {
+ if (_velocity > 1730) exitWith { _A = 0.00724854775171929; _M = 1.41538574492812; };
+ if (_velocity > 1228) exitWith { _A = 0.0000350563361516117; _M = 2.13077307854948; };
+ if (_velocity > 1116) exitWith { _A = 0.000000000000184029481181151; _M = 4.81927320350395; };
+ if (_velocity > 1004) exitWith { _A = 0.000000000000000000000134713064017409; _M = 7.8100555281422; };
+ if (_velocity > 837) exitWith { _A = 0.000000103965974081168; _M = 2.84204791809926; };
+ if (_velocity > 335) exitWith { _A = 0.0001093015938698234; _M = 1.81096361579504; };
+ if (_velocity > 0) exitWith { _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 6: {
+ call {
+ if (_velocity > 3236) exitWith { _A = 0.0455384883480781; _M = 1.15997674041274; };
+ if (_velocity > 2065) exitWith { _A = 0.07167261849653769; _M = 1.10704436538885; };
+ if (_velocity > 1311) exitWith { _A = 0.00166676386084348; _M = 1.60085100195952; };
+ if (_velocity > 1144) exitWith { _A = 0.000000101482730119215; _M = 2.9569674731838; };
+ if (_velocity > 1004) exitWith { _A = 0.00000000000000000431542773103552; _M = 6.34106317069757; };
+ if (_velocity > 670) exitWith { _A = 0.0000204835650496866; _M = 2.11688446325998; };
+ if (_velocity > 0) exitWith { _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 7: {
+ call {
+ if (_velocity > 4200) exitWith { _A = 0.00000000129081656775919; _M = 3.24121295355962; };
+ if (_velocity > 3000) exitWith { _A = 0.0171422231434847; _M = 1.27907168025204; };
+ if (_velocity > 1470) exitWith { _A = 0.00233355948302505; _M = 1.52693913274526; };
+ if (_velocity > 1260) exitWith { _A = 0.000797592111627665; _M = 1.67688974440324; };
+ if (_velocity > 1110) exitWith { _A = 0.00000000000571086414289273; _M = 4.3212826264889; };
+ if (_velocity > 960) exitWith { _A = 0.0000000000000000302865108244904; _M = 5.99074203776707; };
+ if (_velocity > 670) exitWith { _A = 0.00000752285155782535; _M = 2.1738019851075; };
+ if (_velocity > 540) exitWith { _A = 0.0000131766281225189; _M = 2.08774690257991; };
+ if (_velocity > 0) exitWith { _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 8: {
+ call {
+ if (_velocity > 3571) exitWith { _A = 0.0112263766252305; _M = 1.33207346655961; };
+ if (_velocity > 1841) exitWith { _A = 0.0167252613732636; _M = 1.28662041261785; };
+ if (_velocity > 1120) exitWith { _A = 0.00220172456619625; _M = 1.55636358091189; };
+ if (_velocity > 1088) exitWith { _A = 0.00000000000000020538037167098; _M = 5.80410776994789; };
+ if (_velocity > 976) exitWith { _A = 0.00000000000592182174254121; _M = 4.29275576134191; };
+ if (_velocity > 0) exitWith { _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;
+if (!isNil "_A" && !isNil "_M" && _velocity > 0 && _velocity < 10000) then {
+ (_A * (_velocity ^ _M) / _dragCoefficient) / 3.2808399
+} else {
+ 0
};
-
-_result
diff --git a/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf b/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf
index 9b205c3ec2..671ab2ccb0 100644
--- a/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf
+++ b/addons/advanced_ballistics/functions/fnc_calculateStabilityFactor.sqf
@@ -13,33 +13,23 @@
* 6: barometric Pressure - hPA
*
* Return Value:
- * 0: stability factor
+ * stability factor
*
* Public: No
*/
#include "script_component.hpp"
-private ["_caliber", "_bulletLength", "_bulletMass", "_barrelTwist", "_muzzleVelocity", "_temperature", "_barometricPressure", "_l", "_t", "_stabilityFactor"];
-_caliber = _this select 0;
-_bulletLength = _this select 1;
-_bulletMass = _this select 2;
-_barrelTwist = _this select 3;
-_muzzleVelocity = _this select 4;
-_temperature = _this select 5;
-_barometricPressure = _this select 6;
+private ["_twist", "_length", "_stabilityFactor"];
+params ["_caliber", "_bulletLength", "_bulletMass", "_barrelTwist", "_muzzleVelocity", "_temperature", "_barometricPressure"];
// Source: http://www.jbmballistics.com/ballistics/bibliography/articles/miller_stability_1.pdf
-_t = _barrelTwist / _caliber;
-_l = _bulletLength / _caliber;
+_twist = _barrelTwist / _caliber;
+_length = _bulletLength / _caliber;
-_stabilityFactor = 7587000 * _bulletMass / (_t^2 * _caliber^3 * _l * (1 + _l^2));
+_stabilityFactor = 7587000 * _bulletMass / (_twist^2 * _caliber^3 * _length * (1 + _length^2));
if (_muzzleVelocity > 341.376) then {
- _stabilityFactor = _stabilityFactor * (_muzzleVelocity / 853.44) ^ (1/3);
+ (_stabilityFactor * (_muzzleVelocity / 853.44) ^ (1/3)) * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure
} else {
- _stabilityFactor = _stabilityFactor * (_muzzleVelocity / 341.376) ^ (1/3);
+ (_stabilityFactor * (_muzzleVelocity / 341.376) ^ (1/3)) * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure
};
-
-_stabilityFactor = _stabilityFactor * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure;
-
-_stabilityFactor
diff --git a/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf b/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf
index 1a4c344b2e..9debec1dc8 100644
--- a/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf
+++ b/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf
@@ -8,6 +8,8 @@
*
* Return value:
* None
+ *
+ * Public: No
*/
#include "script_component.hpp"
@@ -15,8 +17,6 @@
#define __ctrl1 (__dsp displayCtrl 132950)
#define __ctrl2 (__dsp displayCtrl 132951)
-private ["_inclinationAngle", "_refPosition"];
-
if (GVAR(Protractor)) exitWith {
GVAR(Protractor) = false;
1 cutText ["", "PLAIN"];
@@ -32,30 +32,26 @@ EGVAR(weather,WindInfo) = false;
GVAR(Protractor) = true;
[{
+ params ["","_idPFH"];
if !(GVAR(Protractor) && !(weaponLowered ACE_player) && currentWeapon ACE_player == primaryWeapon ACE_player) exitWith {
GVAR(Protractor) = false;
1 cutText ["", "PLAIN"];
- [_this select 1] call cba_fnc_removePerFrameHandler;
+ [_idPFH] call cba_fnc_removePerFrameHandler;
};
-
- _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 1;
__ctrl1 ctrlCommit 0;
__ctrl1 ctrlSetText QUOTE(PATHTOF(UI\protractor.paa));
__ctrl1 ctrlSetTextColor [1, 1, 1, 1];
-
+
__ctrl2 ctrlSetScale 1;
- __ctrl2 ctrlSetPosition [(_refPosition select 0), (_refPosition select 1) - 0.0012 * _inclinationAngle, (_refPosition select 2), (_refPosition select 3)];
+ __ctrl2 ctrlSetPosition [SafeZoneX + 0.001, SafeZoneY + 0.001 - 0.0012 * (-58 max (asin((ACE_player weaponDirection currentWeapon ACE_player) select 2)) min 58), 0.2, 0.2 * 4/3];
__ctrl2 ctrlCommit 0;
__ctrl2 ctrlSetText QUOTE(PATHTOF(UI\protractor_marker.paa));
__ctrl2 ctrlSetTextColor [1, 1, 1, 1];
-
+
}, 0.1, []] call CBA_fnc_addPerFrameHandler;
true
diff --git a/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf b/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf
new file mode 100644
index 0000000000..7a432831ad
--- /dev/null
+++ b/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf
@@ -0,0 +1,46 @@
+/*
+ * Author: Glowbal, Ruthberg, joko // Jonas
+ * Handle the PFH for Bullets
+ *
+ * Arguments:
+ * None
+ *
+ * Return Value:
+ * None
+ *
+ * Public: No
+ */
+#include "script_component.hpp"
+
+private "_deleted";
+
+_deleted = 0;
+
+_aceTimeSecond = floor ACE_time;
+
+{
+ private ["_bulletVelocity", "_bulletPosition", "_bulletSpeed"];
+ _x params["_bullet","_caliber","_bulletTraceVisible","_index"];
+
+ _bulletVelocity = velocity _bullet;
+
+ _bulletSpeed = vectorMagnitude _bulletVelocity;
+
+ if (!alive _bullet || _bulletSpeed < 100) exitWith {
+ GVAR(allBullets) deleteAt (_forEachIndex - _deleted);
+ _deleted = _deleted + 1;
+ };
+
+ _bulletPosition = getPosASL _bullet;
+
+ if (_bulletTraceVisible && _bulletSpeed > 500) then {
+ drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""];
+ };
+
+ call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, _aceTimeSecond, ACE_time - _aceTimeSecond]);
+} forEach GVAR(allBullets);
+
+if (GVAR(allBullets) isEqualTo []) then {
+ [_this select 1] call CBA_fnc_removePerFrameHandler;
+ GVAR(BulletPFH) = nil;
+};
diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf
index 7c01bd9f23..d97c9b952a 100644
--- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf
+++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf
@@ -13,28 +13,28 @@
* 6: projectile - Object of the projectile that was shot