Merge branch 'cse_advanced_ballistics' of git@github.com:KoffeinFlummi/ACE3.git into weather

This commit is contained in:
Nicolás Badano 2015-01-21 01:23:30 -03:00
commit 590528c879
136 changed files with 9071 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,30 @@
class cfgFunctions {
class cse_AB_ballistics
{
class advancedBallistics {
file = "cse\cse_sys_ballistics\advancedBallistics\functions";
class adjust_parallax { recompile = 1; };
class adjust_turret { recompile = 1; };
class advanced_ballistics { recompile = 1; };
class advanced_ballistics_extension { recompile = 1; };
class ammo_temperature_muzzle_velocity { recompile = 1; };
class apply_turret_adjustments { recompile = 1; };
class barrel_length_muzzle_velocity { recompile = 1; };
class calculate_air_density { recompile = 1; };
class calculate_atmospheric_correction { recompile = 1; };
class calculate_hellmann_exponent { recompile = 1; };
class calculate_retardation { recompile = 1; };
class calculate_roughness_length { recompile = 1; };
class calculate_stability_factor { recompile = 1; };
class calculate_wind_speed { recompile = 1; };
class climate_simulation { recompile = 1; };
class display_protractor { recompile = 1; };
class display_wind_info { recompile = 1; };
class get_humidity_at_height { recompile = 1; };
class get_temperature_at_height { recompile = 1; };
class initialize_terrain_extension { recompile = 1; };
class mirage_simulation { recompile = 1; };
class synchronize_scope_zero { recompile = 1; };
};
};
};

View File

@ -0,0 +1,165 @@
class CfgMagazines
{
class 7Rnd_408_Mag;
class 16Rnd_9x21_Mag;
class 30Rnd_556x45_Stanag;
class 30Rnd_556x45_Stanag_Tracer_Red;
class 200Rnd_65x39_cased_Box;
class 200Rnd_65x39_cased_Box_Tracer;
class 10Rnd_762x51_Mag;
class 20Rnd_762x51_Mag;
class 100Rnd_127x99_mag;
class 8Rnd_mas_9x18_Mag: 16Rnd_9x21_Mag
{
ammo="B_mas_9x18_Ball_57N181S";
count=8;
displayName="8rnd 9mm Mag";
picture="\A3\weapons_f\data\ui\M_16Rnd_9x21_CA.paa";
descriptionshort="Caliber: 9x18 mm Makarov<br />Rounds: 8<br />Used in: Makarov";
};
class 64Rnd_mas_9x18_mag: 30Rnd_556x45_Stanag
{
ammo="B_mas_9x18_Ball_57N181S";
count=64;
displayName="64rnds 9x18 Bizon";
picture="\mas_us_rifle\ui\m_bizon_ca.paa";
descriptionshort="Caliber: 9x18 mm cal<br />Rounds: 64<br />Used in: Bizon";
};
class 30Rnd_mas_545x39_mag: 30Rnd_556x45_Stanag
{
ammo="M_mas_545x39_Ball_7N6M";
count=30;
descriptionshort="Caliber: 5.45x39 mm<br />Rounds: 30<br />Used in: AK74M,AKS74,AKSU";
displayname="30rnd 5.45mm Mag";
};
class 30Rnd_mas_545x39_T_mag: 30Rnd_556x45_Stanag_Tracer_Red
{
ammo="M_mas_545x39_Ball_7T3M";
count=30;
descriptionshort="Caliber: 5.45x39 mm Tracer<br />Rounds: 30<br />Used in: AK74M,AKS74,AKSU";
displayname="30rnd 5.45mm Mag(Tracer)";
};
class 100Rnd_mas_545x39_mag: 200Rnd_65x39_cased_Box
{
ammo="M_mas_545x39_Ball_7N6M";
count=100;
descriptionshort="Caliber: 5.45x39 mm<br />Rounds: 100<br />Used in: RPK74";
displayname="100rnd 5.45mm Drum";
mass=25;
};
class 100Rnd_mas_545x39_T_mag: 200Rnd_65x39_cased_Box_Tracer
{
ammo="M_mas_545x39_Ball_7T3M";
count=100;
descriptionshort="Caliber: 5.45x39 mm Tracer<br />Rounds: 100<br />Used in: RPK74";
displayname="100rnd 5.45mm Drum(Tracer)";
mass=25;
};
class 30Rnd_mas_556x45_Mk262_Stanag: 30Rnd_556x45_Stanag
{
ammo="B_mas_556x45_Ball_Mk262";
count=30;
descriptionshort="Caliber: 5.56x45 mm STANAG Mk262<br />Rounds: 30<br />Used in: M4,HK416,M16,SCAR-L";
displayname="30rnd 5.56mm STANAG(Mk262)";
};
class 20Rnd_mas_762x51_M118LR_Stanag: 30Rnd_556x45_Stanag
{
ammo="B_mas_762x51_Ball_M118LR";
count=20;
descriptionshort="Caliber: 7.62x51 mm STANAG M118LR<br />Rounds: 20<br />Used in: HK417,SR25,SCAR-H,EBR";
displayname="20rnd 7.62mm Mag(M118LR)";
picture="\A3\weapons_f\data\UI\M_20Rnd_762x51_CA.paa";
};
class 5Rnd_mas_762x51_M118LR_Stanag: 30Rnd_556x45_Stanag
{
ammo="B_mas_762x51_Ball_M118LR";
count=5;
descriptionshort="Caliber: 7.62x51 mm STANAG M118LR<br />Rounds: 5<br />Used in: M24";
displayname="5rnd 7.62mm Mag(M118LR)";
picture="\A3\weapons_f\data\UI\m_M24_CA.paa";
};
class Trixie_30x556_Mk262_Mag: 30Rnd_556x45_Stanag
{
scope=2;
author="Trixie";
count=30;
descriptionshort="Caliber: 5.56x45mm<br />Rounds: 30<br />Used in: Mk12 SPR";
displayname="30Rnd Mk262 5.56x45mm";
ammo="cse_AB_556x45_Ball_Mk262";
lastroundstracer=0;
tracersevery=0;
};
class Trixie_20x762_M118LR_Mag: 20Rnd_762x51_Mag
{
scope=2;
author="Trixie";
count=20;
descriptionshort="Caliber: 7.62x51mm<br />Rounds: 20<br />Used in: M110 SASS";
displayname="20Rnd 7.62x51mm M118LR";
ammo="cse_AB_762x51_Ball_M118LR";
picture="\Trixie_recon\UI\20x762_mag.paa";
lastroundstracer=0;
tracersevery=0;
};
class Trixie_10x762_M118LR_Mag: 10Rnd_762x51_Mag
{
scope=2;
author="Trixie";
count=10;
descriptionshort="Caliber: 7.62x51mm<br />Rounds: 10<br />Used in: CZ750";
displayname="10Rnd 7.62x51mm M118LR";
ammo="cse_AB_762x51_Ball_M118LR";
picture="\Trixie_recon\UI\5x762_mag.paa";
lastroundstracer=0;
tracersevery=0;
};
class Trixie_5x762_M118LR_Mag: 10Rnd_762x51_Mag
{
scope=2;
author="Trixie";
count=5;
descriptionshort="Caliber: 7.62x51mm<br />Rounds: 5<br />Used in: M40A3";
displayname="5Rnd 7.62x51mm M118LR";
ammo="cse_AB_762x51_Ball_M118LR";
picture="\Trixie_recon\UI\5x762_mag.paa";
lastroundstracer=0;
tracersevery=0;
};
class Trixie_10x127_Mag: 100Rnd_127x99_mag
{
scope=2;
author="Trixie";
count=10;
descriptionshort="Caliber: 12.7x99mm<br />Rounds: 10<br />Used in: Barret M107";
displayname="10Rnd 12.7x99mm";
ammo="B_127x99_Ball";
picture="\Trixie_recon\UI\50BMGx10_mag.paa";
lastroundstracer=0;
tracersevery=0;
};
class Trixie_10x105_Mag: 100Rnd_127x99_mag
{
scope=2;
author="Trixie";
count=10;
descriptionshort="Caliber: .416 Barrett<br />Rounds: 10<br />Used in: Barret M107";
displayname="10Rnd 10.5x83mm";
ammo="AB_106x83mm_Ball";
picture="\Trixie_recon\UI\50BMGx10_mag.paa";
lastroundstracer=0;
tracersevery=0;
};
class Trixie_10x127_Amax_Mag: 100Rnd_127x99_mag
{
scope=2;
author="Trixie";
count=10;
descriptionshort="Caliber: .50 BMG 750 gr A-MAX<br />Rounds: 10<br />Used in: Barret M107";
displayname="10Rnd 12.7x99mm A-MAX";
ammo="AB_127x99_Ball_AMAX";
picture="\Trixie_recon\UI\50BMGx10_mag.paa";
lastroundstracer=0;
tracersevery=0;
};
};

View File

@ -0,0 +1,9 @@
class CfgSounds
{
class cse_AB_scope_click
{
name="cse_AB_scope_click";
sound[]={"cse\cse_sys_ballistics\advancedballistics\sound\scope_click.wav",1,1};
titles[]={};
};
};

View File

@ -0,0 +1,167 @@
class CfgVehicles {
class Logic;
class Module_F: Logic {
class ArgumentsBaseUnits {
};
};
class cse_AB_moduleAdvancedBallistics: Module_F {
scope = 2;
displayName = "Advanced Ballistics [CSE]";
icon = "\cse\cse_main\data\cse_backblast_module.paa";
category = "cseModules";
function = "cse_fnc_initalizeModule_F";
author = "Ruthberg";
functionPriority = 1;
isGlobal = 1;
isTriggerActivated = 0;
class Arguments {
class FORCE_CLIENT_SETTINGS_OVERRIDE {
displayName = "Force Client Settings override";
description = "Force Client Settings override";
typeName = "BOOL";
defaultValue = 1;
};
class WIND_ENABLED {
displayName = "Wind drift";
description = "Add wind drift";
typeName = "BOOL";
defaultValue = 1;
};
class SPIN_DRIFT_ENABLED {
displayName = "Spin drift";
description = "add spin drift";
typeName = "BOOL";
defaultValue = 1;
};
class CORIOLIS_ENABLED {
displayName = "Horizontal Coriolis drift";
description = "Horizontal Coriolis drift";
typeName = "BOOL";
defaultValue = 1;
};
class EOETVOES_ENABLED {
displayName = "Vertical Coriolis drift";
description = "Vertical Coriolis drift";
typeName = "BOOL";
defaultValue = 1;
};
class ADVANCED_AIR_DRAG_ENABLED {
displayName = "Advanced air drag";
description = "Enabled the advanced air drag model (only availible with compatible 3rd party ammunition)";
typeName = "BOOL";
defaultValue = 1;
};
class ATMOSPHERIC_DENSITY_SIMULATION_ENABLED {
displayName = "Ambient air density ";
description = "The bullets ability to cut through air becomes affected by the ambient air density";
typeName = "BOOL";
defaultValue = 1;
};
class TRANSONIC_REGION_ENABLED {
displayName = "Dispersion beyond supersonic";
description = "Adds dispersion beyond supersonic flight of rifle bullets";
typeName = "BOOL";
defaultValue = 1;
};
class MIL_TURRETS_ENABLED {
displayName = "Zero scope in 1/10 mil";
description = "Adds the ability to zero your scope in 1/10 Mil steps";
typeName = "BOOL";
defaultValue = 1;
};
class AMMO_TEMPERATURE_ENABLED {
displayName = "Ammo temperature";
description = "Muzzle velocity changes with ammo temperature";
typeName = "BOOL";
defaultValue = 1;
};
class DISABLED_IN_FULL_AUTO_MODE {
displayName = "Disabled during full auto";
description = "Disables the advanced ballistics during full auto fire";
typeName = "BOOL";
defaultValue = 0;
};
class BULLET_TRACE_ENABLED {
displayName = "Bullet trace effect";
description = "Adds a bullet trace effect to high caliber bullets";
typeName = "BOOL";
defaultValue = 1;
};
class MIRAGE_ENABLED {
displayName = "Mirage and scope parallax";
description = "Adds mirage and scope parallax adjustment";
typeName = "BOOL";
defaultValue = 1;
};
class BARREL_LENGTH_INFLUENCE {
displayName = "Barrel length dependent";
description = "Enables barrel length dependent muzzle velocity";
typeName = "BOOL";
defaultValue = 1;
};
class VEHICLE_GUNNER_ENABLED {
displayName = "Vehicle Gunners";
description = "Enables the advanced ballistics for rounds fired as vehicle gunner";
typeName = "BOOL";
defaultValue = 1;
};
class EXTENSIONS_ENABLED {
displayName = "Extension allowed";
description = "Allows the use of the DLL extension";
typeName = "BOOL";
defaultValue = 1;
};
class INIT_MESSAGE_ENABLED {
displayName = "Initialization message";
description = "Prints a system chat message once the terrain initialization is finished";
typeName = "BOOL";
defaultValue = 0;
};
class ONLY_ACTIVE_FOR_LOCAL_PLAYER {
displayName = "Local only";
description = "Disables the advanced ballistics for bullets coming from other players";
typeName = "BOOL";
defaultValue = 0;
};
class ONLY_ACTIVE_FOR_PLAYER_GROUP {
displayName = "Group only";
description = "Disables the advanced ballistics for bullets coming from players in other groups";
typeName = "BOOL";
defaultValue = 0;
};
class DISABLED_BY_DEFAULT {
displayName = "Disabled by default";
description = "Allows you to enable the advanced ballistics selectively in the unit initialization";
typeName = "BOOL";
defaultValue = 0;
};
class PRECISION {
displayName = "Calculation precision";
description = "Allows to reduces the calculation precision to avoid frame drops (1 - maximum precision, 2 - medium precision, 3 - minimal precision)";
typeName = "NUMBER";
defaultValue = 1;
};
};
};
};

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,16 @@
class Combat_Space_Enhancement {
class cfgModules {
class cse_AB_moduleAdvancedBallistics {
init = "call compile preprocessFile 'cse\cse_sys_ballistics\advancedballistics\init.sqf';";
name = "Advanced Ballistics";
class EventHandlers {
class AllVehicles {
fired = "call cse_ab_ballistics_fnc_advanced_ballistics; false";
};
class CAManBase {
take = "call cse_ab_ballistics_fnc_synchronize_scope_zero; false";
};
};
};
};
};

View File

@ -0,0 +1 @@
#include "ui\rscTitles.h"

View File

@ -0,0 +1,44 @@
#define ST_LEFT 0
#define ST_RIGHT 1
#define ST_CENTER 2
class CfgPatches
{
class cse_ab_advancedballistics
{
units[]={};
weapons[]={};
requiredVersion=1.26;
requiredAddons[]=
{
};
version="2.7";
author[]=
{
"Ruthberg"
};
};
};
class CfgAddons
{
class PreloadAddons
{
class cse_ab_advancedballistics
{
list[]=
{
"cse_ab_advancedballistics"
};
};
};
};
#include "CfgAmmo.h"
#include "CfgMagazines.h"
#include "CfgWeapons.h"
#include "CfgSounds.h"
#include "CfgVehicles.h"
#include "CfgFunctions.h"
#include "Combat_Space_Enhancement.h"
#include "UI.h"

View File

@ -0,0 +1,11 @@
#define GRAVITY 9.80665
#define ABSOLUTE_ZERO_IN_CELSIUS -273.15
#define KELVIN(t) (t - ABSOLUTE_ZERO_IN_CELSIUS)
#define CELSIUS(t) (t + ABSOLUTE_ZERO_IN_CELSIUS)
#define UNIVERSAL_GAS_CONSTANT 8.314
#define WATER_VAPOR_MOLAR_MASS 0.018016
#define DRY_AIR_MOLAR_MASS 0.028964
#define SPECIFIC_GAS_CONSTANT_DRY_AIR 287.058
#define STD_AIR_DENSITY_ICAO 1.22498
#define STD_AIR_DENSITY_ASM 1.20885
#define GET_TEMPERATURE_AT_HEIGHT(h) (cse_AB_Temperature - 0.0065 * (h))

View File

@ -0,0 +1,72 @@
/**
* fn_adjust_parralax.sqf
* @Descr: N/A
* @Author: Ruthberg
*
* @Arguments: []
* @Return: []
* @PublicAPI: false
*/
#include "defines.h"
#define __dsp (uiNamespace getVariable "RscTurretDial")
#define __ctrl (__dsp displayCtrl 132949)
private ["_direction", "_opticsName", "_opticType", "_parallax"];
_direction = _this;
_opticsName = currentWeapon player;
_opticType = 0;
if (!cse_AB_MirageEnabled) exitWith { false };
if (!(weaponLowered player) && currentWeapon player == primaryWeapon player && count primaryWeaponItems player > 2) then {
_opticsName = (primaryWeaponItems player) select 2;
_opticType = getNumber(configFile >> "cfgWeapons" >> _opticsName >> "ItemInfo" >> "opticType");
};
if (_opticType != 2 && !(currentWeapon player in ["Binocular", "Rangefinder", "Laserdesignator"])) exitWith { false };
_parallax = player getVariable [format["cse_AB_Parallax:%1", _opticsName], 0];
switch (_direction) do
{
case 0:
{
if (_parallax > 0) then {
_parallax = _parallax + 100;
};
if (_parallax > 1000) then {
_parallax = 0;
};
};
case 1:
{
if (_parallax > 100) then {
_parallax = _parallax - 100;
};
if (_parallax == 0) then {
_parallax = 1000;
};
};
};
cse_AB_WindInfo = false;
0 cutText ["", "PLAIN"];
cse_AB_Protractor = false;
1 cutText ["", "PLAIN"];
2 cutRsc ["RscTurretDial", "PLAIN"];
if (_parallax > 0) then {
__ctrl ctrlSetText format["%1 m", round(_parallax)];
} else {
__ctrl ctrlSetText "infinity";
};
__ctrl ctrlSetTextColor [0.8, 0.0, 0.0, 1.0];
if (_parallax != player getVariable [format["cse_AB_Parallax:%1", _opticsName], 0]) then {
player setVariable [format["cse_AB_Parallax:%1", _opticsName], _parallax, false];
PlaySound "cse_AB_scope_click";
};
true

View File

@ -0,0 +1,91 @@
#include "defines.h"
#define __dsp (uiNamespace getVariable "RscTurretDial")
#define __ctrl (__dsp displayCtrl 132949)
private ["_opticsName", "_opticType", "_scopeStep", "_turretAndDirection", "_majorStep", "_elevation", "_windage", "_zero"];
_turretAndDirection = _this select 0;
_majorStep = _this select 1;
if (!cse_AB_MilTurretsEnabled) exitWith { false };
if (weaponLowered player) exitWith { false };
if (vehicle player != player) exitWith { false };
if (currentWeapon player != primaryWeapon player) exitWith { false };
if (count primaryWeaponItems player < 3) exitWith { false };
_opticsName = (primaryWeaponItems player) select 2;
_opticType = getNumber(configFile >> "cfgWeapons" >> _opticsName >> "ItemInfo" >> "opticType");
if (_opticType != 2) exitWith { false };
_elevation = player getVariable [format["cse_AB_Elevation:%1", _opticsName], 0];
_windage = player getVariable [format["cse_AB_Windage:%1", _opticsName], 0];
_zero = player getVariable [format["cse_AB_Zero:%1", _opticsName], profileNamespace getVariable [format["cse_AB_Zero:%1", _opticsName], 0]];
_scopeStep = 0.1;
switch (_turretAndDirection) do
{
case 0: { _elevation = _elevation + _scopeStep };
case 1: { _elevation = _elevation - _scopeStep };
case 2: { _windage = _windage - _scopeStep };
case 3: { _windage = _windage + _scopeStep };
case 4: { _zero = _zero + _scopeStep };
case 5: { _zero = _zero - _scopeStep };
};
if (_majorStep) then {
switch (_turretAndDirection) do
{
case 0: { _elevation = ceil(_elevation) };
case 1: { _elevation = floor(_elevation) };
case 2: { _windage = floor(_windage) };
case 3: { _windage = ceil(_windage) };
};
};
_zero = -4 max _zero min 30;
_elevation = (-4 - _zero) max _elevation min (30 - _zero);
_windage = -20 max _windage min 20;
cse_AB_WindInfo = false;
0 cutText ["", "PLAIN"];
cse_AB_Protractor = false;
1 cutText ["", "PLAIN"];
2 cutRsc ["RscTurretDial", "PLAIN"];
switch (_turretAndDirection) do
{
case 0;
case 1: {
__ctrl ctrlSetText format["%1 Mil", round(_elevation * 10) / 10];
__ctrl ctrlSetTextColor [1.0, 1.0, 0.5, 1.0];
};
case 2;
case 3: {
__ctrl ctrlSetText format["%1 Mil", round(_windage * 10) / 10];
__ctrl ctrlSetTextColor [0.8, 0.8, 1.0, 1.0];
};
case 4;
case 5: {
__ctrl ctrlSetText format["%1 Mil", round(_zero * 10) / 10];
__ctrl ctrlSetTextColor [0, 0.5, 0.0, 1.0];
};
};
if (_elevation != player getVariable [format["cse_AB_Elevation:%1", _opticsName], 0]) then {
player setVariable [format["cse_AB_Elevation:%1", _opticsName], _elevation, true];
PlaySound "cse_AB_scope_click";
};
if (_windage != player getVariable [format["cse_AB_Windage:%1", _opticsName], 0]) then {
player setVariable [format["cse_AB_Windage:%1", _opticsName], _windage, true];
PlaySound "cse_AB_scope_click";
};
if (_zero != player getVariable [format["cse_AB_Zero:%1", _opticsName], 0]) then {
profileNamespace setVariable [format["cse_AB_Zero:%1", _opticsName], _zero];
player setVariable [format["cse_AB_Zero:%1", _opticsName], _zero, true];
PlaySound "cse_AB_scope_click";
};
true

View File

@ -0,0 +1,345 @@
#include "defines.h"
private ["_unit", "_weapon", "_mode", "_ammo", "_magazine", "_caliber", "_bullet", "_index", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_atmosphereModel", "_bulletMass", "_bulletLength", "_bulletTranslation", "_airFriction", "_dragModel", "_velocityBoundaryData", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_bulletWeight", "_barrelTwist", "_twistDirection", "_stabilityFactor", "_transonicStabilityCoef", "_cse_AB_Elevation", "_cse_AB_Windage", "_ID"];
_unit = _this select 0;
_weapon = _this select 1;
_mode = _this select 3;
_ammo = _this select 4;
_bullet = _this select 5;
_magazine = _this select 6;
if (!isClass (configFile >> 'CfgPatches' >> 'CBA_main')) then {
_bullet = _this select 6;
_magazine = _this select 5;
};
if (isDedicated) exitWith {};
if (!alive _bullet) exitWith {};
if (!(isPlayer _unit)) exitWith {};
if (underwater _unit) exitWith {};
if (!(_ammo isKindOf "BulletBase")) exitWith {};
if (_unit distanceSqr player > 9000000) exitWith {};
if (cse_AB_OnlyActiveForLocalPlayer && !(local _unit)) exitWith {};
if (cse_AB_OnlyActiveForPlayerGroup && (group _unit != group player)) exitWith {};
if (!cse_AB_VehicleGunnerEnabled && !(_unit isKindOf "Man")) exitWith {};
if (cse_AB_DisabledInFullAutoMode && getNumber(configFile >> "cfgWeapons" >> _weapon >> _mode >> "autoFire") == 1) exitWith {};
if (!isServer && !((gunner _unit) getVariable ["cse_enabled_AdvancedBallistics", false])) exitWith {};
_airFriction = getNumber(configFile >> "cfgAmmo" >> _ammo >> "airFriction");
_muzzleVelocity = getNumber(configFile >> "cfgMagazines" >> _magazine >> "initSpeed");
_muzzleAccessory = (primaryWeaponItems _unit) select 0;
if (_muzzleAccessory != "" && isNumber(configFile >> "cfgWeapons" >> _muzzleAccessory >> "ItemInfo" >> "MagazineCoef" >> "initSpeed")) then {
_initSpeedCoef = getNumber(configFile >> "cfgWeapons" >> _muzzleAccessory >> "ItemInfo" >> "MagazineCoef" >> "initSpeed");
_muzzleVelocity = _muzzleVelocity * _initSpeedCoef;
};
if (cse_AB_BarrelLengthInfluenceEnabled) then {
_muzzleVelocityShift = [_ammo, _weapon, _muzzleVelocity] call cse_ab_ballistics_fnc_barrel_length_muzzle_velocity;
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 (cse_AB_AmmoTemperatureEnabled) then {
_temperature = GET_TEMPERATURE_AT_HEIGHT((getPosASL _unit) select 2);
_muzzleVelocityShift = [_ammo, _temperature] call cse_ab_ballistics_fnc_ammo_temperature_muzzle_velocity;
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;
};
};
_bulletTraceVisible = false;
if (cse_AB_BulletTraceEnabled && currentWeapon player == primaryWeapon player && count primaryWeaponItems player > 2) then {
_opticsName = (primaryWeaponItems player) select 2;
_opticType = getNumber(configFile >> "cfgWeapons" >> _opticsName >> "ItemInfo" >> "opticType");
_bulletTraceVisible = (_opticType == 2 || currentWeapon player in ["Binocular", "Rangefinder", "Laserdesignator"]) && cameraView == "GUNNER";
};
if (cse_AB_MilTurretsEnabled) then {
[_bullet, _unit] call cse_ab_ballistics_fnc_apply_turret_adjustments;
};
_caliber = getNumber(configFile >> "cfgAmmo" >> _ammo >> "AB_caliber");
_bulletLength = getNumber(configFile >> "cfgAmmo" >> _ammo >> "AB_bulletLength");
_bulletMass = getNumber(configFile >> "cfgAmmo" >> _ammo >> "AB_bulletMass");
_barrelTwist = getNumber(configFile >> "cfgWeapons" >> _weapon >> "AB_barrelTwist");
_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(-(cse_AB_Altitude + ((getPosASL _bullet) select 2)) / 7990) - 10 * overcast;
_stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call cse_ab_ballistics_fnc_calculate_stability_factor;
};
_twistDirection = 1;
if (isNumber(configFile >> "cfgWeapons" >> _weapon >> "AB_twistDirection")) then {
_twistDirection = getNumber(configFile >> "cfgWeapons" >> _weapon >> "AB_twistDirection");
if (_twistDirection != -1 && _twistDirection != 0 && _twistDirection != 1) then {
_twistDirection = 1;
};
};
_transonicStabilityCoef = 0.5;
if (isNumber(configFile >> "cfgAmmo" >> _ammo >> "AB_transonicStabilityCoef")) then {
_transonicStabilityCoef = getNumber(configFile >> "cfgAmmo" >> _ammo >> "AB_transonicStabilityCoef");
};
_dragModel = 1;
_ballisticCoefficients = [];
_velocityBoundaries = [];
_atmosphereModel = "ICAO";
if (cse_AB_AdvancedAirDragEnabled) then {
if (isNumber(configFile >> "cfgAmmo" >> _ammo >> "AB_dragModel")) then {
_dragModel = getNumber(configFile >> "cfgAmmo" >> _ammo >> "AB_dragModel");
if (!(_dragModel in [1, 2, 5, 6, 7, 8])) then {
_dragModel = 1;
};
};
if (isArray(configFile >> "cfgAmmo" >> _ammo >> "AB_ballisticCoefficients")) then {
_ballisticCoefficients = getArray(configFile >> "cfgAmmo" >> _ammo >> "AB_ballisticCoefficients");
};
if (isArray(configFile >> "cfgAmmo" >> _ammo >> "AB_velocityBoundaries")) then {
_velocityBoundaries = getArray(configFile >> "cfgAmmo" >> _ammo >> "AB_velocityBoundaries");
};
if (isText(configFile >> "cfgAmmo" >> _ammo >> "AB_standardAtmosphere")) then {
_atmosphereModel = getText(configFile >> "cfgAmmo" >> _ammo >> "AB_standardAtmosphere");
};
};
_index = count cse_AB_bulletDatabase;
if (count cse_AB_bulletDatabaseFreeIndices > 0) then {
_index = cse_AB_bulletDatabaseFreeIndices select 0;
cse_AB_bulletDatabaseFreeIndices = cse_AB_bulletDatabaseFreeIndices - [_index];
};
cse_AB_bulletDatabase set[_index, [_bullet, _caliber, _airFriction, _muzzleVelocity, _stabilityFactor, _transonicStabilityCoef, _twistDirection, _unit, _bulletTraceVisible, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _index]];
cse_AB_bulletDatabaseStartTime set[_index, time];
cse_AB_bulletDatabaseSpeed set[_index, 0];
cse_AB_bulletDatabaseFrames set[_index, 1];
cse_AB_bulletDatabaseLastFrame set[_index, time];
cse_AB_bulletDatabaseHDeflect set[_index, 0];
cse_AB_bulletDatabaseSpinDrift set[_index, 0];
if ((cse_AB_bulletDatabaseOccupiedIndices pushBack _index) == 0) then {
["AdvancedBallistics", "onEachFrame", {
private ["_bulletDatabaseEntry", "_bullet", "_caliber", "_muzzleVelocity", "_frames", "_speed", "_airFriction", "_airFrictionRef", "_dragModel", "_atmosphereModel", "_ballisticCoefficient", "_ballisticCoefficients", "_velocityBoundaries", "_airDensity", "_stabilityFactor", "_transonicStabilityCoef", "_twistDirection", "_unit", "_bulletTraceVisible", "_index", "_temperature", "_humidity", "_deltaT", "_TOF", "_bulletPosition", "_bulletVelocity", "_bulletSpeed", "_trueVelocity", "_trueSpeed", "_bulletSpeedAvg", "_wind", "_drag", "_dragRef", "_vect", "_accel", "_accelRef", "_centripetalAccel", "_pressure", "_pressureDeviation", "_windSourceObstacle", "_windSourceTerrain", "_height", "_roughnessLength"];
{
_bullet = (cse_AB_bulletDatabase select _x) select 0;
_index = (cse_AB_bulletDatabase select _x) select 13;
if (!alive _bullet) then {
cse_AB_bulletDatabaseOccupiedIndices = cse_AB_bulletDatabaseOccupiedIndices - [_index];
cse_AB_bulletDatabaseFreeIndices pushBack _index;
};
true
} count cse_AB_bulletDatabaseOccupiedIndices;
if (count cse_AB_bulletDatabaseOccupiedIndices == 0) exitWith {
cse_AB_bulletDatabase = [];
cse_AB_bulletDatabaseStartTime = [];
cse_AB_bulletDatabaseSpeed = [];
cse_AB_bulletDatabaseFrames = [];
cse_AB_bulletDatabaseLastFrame = [];
cse_AB_bulletDatabaseHDeflect = [];
cse_AB_bulletDatabaseSpinDrift = [];
cse_AB_bulletDatabaseOccupiedIndices = [];
cse_AB_bulletDatabaseFreeIndices = [];
["AdvancedBallistics", "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
};
{
_bulletDatabaseEntry = (cse_AB_bulletDatabase select _x);
_bullet = _bulletDatabaseEntry select 0;
_caliber = _bulletDatabaseEntry select 1;
_airFriction = _bulletDatabaseEntry select 2;
_muzzleVelocity = _bulletDatabaseEntry select 3;
_stabilityFactor = _bulletDatabaseEntry select 4;
_transonicStabilityCoef = _bulletDatabaseEntry select 5;
_twistDirection = _bulletDatabaseEntry select 6;
_unit = _bulletDatabaseEntry select 7;
_bulletTraceVisible = _bulletDatabaseEntry select 8;
_ballisticCoefficients = _bulletDatabaseEntry select 9;
_velocityBoundaries = _bulletDatabaseEntry select 10;
_atmosphereModel = _bulletDatabaseEntry select 11;
_dragModel = _bulletDatabaseEntry select 12;
_index = _bulletDatabaseEntry select 13;
_TOF = time - (cse_AB_bulletDatabaseStartTime select _index);
_bulletVelocity = velocity _bullet;
_bulletPosition = getPosASL _bullet;
_bulletSpeed = vectorMagnitude _bulletVelocity;
_bulletDir = (_bulletVelocity select 0) atan2 (_bulletVelocity select 1);
_speed = (cse_AB_bulletDatabaseSpeed select _index);
cse_AB_bulletDatabaseSpeed set[_index, _speed + _bulletSpeed];
_frames = (cse_AB_bulletDatabaseFrames select _index);
cse_AB_bulletDatabaseFrames set[_index, _frames + 1];
_bulletSpeedAvg = (_speed / _frames);
if ((cse_AB_Precision < 2) || {_frames % cse_AB_Precision == _index % cse_AB_Precision}) then {
_deltaT = time - (cse_AB_bulletDatabaseLastFrame select _index);
cse_AB_bulletDatabaseLastFrame set[_index, time];
_trueVelocity = _bulletVelocity;
_trueSpeed = _bulletSpeed;
_wind = [0, 0, 0];
if (cse_AB_WindEnabled && (vectorMagnitude wind) > 0) then {
_windSourceObstacle = _bulletPosition vectorDiff ((vectorNormalized wind) vectorMultiply 10);
_windSourceTerrain = _bulletPosition vectorDiff ((vectorNormalized wind) vectorMultiply 100);
if (!(lineIntersects [_bulletPosition, _windSourceObstacle]) && !(terrainIntersectASL [_bulletPosition, _windSourceTerrain])) then {
_wind = wind;
_height = ASLToATL(_bulletPosition) select 2;
_height = 0 max _height min 20;
if (_height < 20) then {
_roughnessLength = _bulletPosition call cse_ab_ballistics_fnc_calculate_roughness_length;
_wind = _wind vectorMultiply (ln(_height / _roughnessLength) / ln(20 / _roughnessLength));
};
_trueVelocity = _bulletVelocity vectorDiff _wind;
_trueSpeed = vectorMagnitude _trueVelocity;
};
};
_airFrictionRef = _airFriction;
if (cse_AB_AdvancedAirDragEnabled && (count _ballisticCoefficients) == (count _velocityBoundaries) + 1) then {
_dragRef = _deltaT * _airFrictionRef * _bulletSpeed * _bulletSpeed;
_accelRef = (vectorNormalized _bulletVelocity) vectorMultiply (_dragRef);
_bulletVelocity = _bulletVelocity vectorDiff _accelRef;
_ballisticCoefficient = (_ballisticCoefficients select 0);
for "_i" from (count _velocityBoundaries) - 1 to 0 step -1 do {
if (_bulletSpeed < (_velocityBoundaries select _i)) exitWith {
_ballisticCoefficient = (_ballisticCoefficients select (_i + 1));
};
};
if (cse_AB_AtmosphericDensitySimulationEnabled) then {
_pressure = 1013.25 * exp(-(cse_AB_Altitude + (_bulletPosition select 2)) / 7990) - 10 * overcast;
_temperature = GET_TEMPERATURE_AT_HEIGHT(_bulletPosition select 2);
_humidity = cse_AB_Humidity;
if (cse_AB_Humidity < 1 && fog > 0) then {
private ["_fogValue", "_fogDecay", "_fogBase"];
_fogValue = fogParams select 0;
_fogDecay = fogParams select 1;
_fogBase = fogParams select 2;
_fogDensity = 1 - 0.05 * (_fogDecay / _fogValue * (_height - _fogBase))^2;
if (_fogDensity > 0) then {
_humidity = 1;
} else {
_humidity = cse_AB_Humidity + (1 - cse_AB_Humidity) * (0 max (1 + _fogDensity));
};
};
_airDensity = STD_AIR_DENSITY_ICAO;
if (_humidity > 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 = _humidity * _pSat;
_partialPressure = (_pressure * 100)- _vaporPressure;
_airDensity = (_partialPressure * DRY_AIR_MOLAR_MASS + _vaporPressure * WATER_VAPOR_MOLAR_MASS) / (UNIVERSAL_GAS_CONSTANT * KELVIN(_temperature));
} else {
_airDensity = (_pressure * 100) / (SPECIFIC_GAS_CONSTANT_DRY_AIR * KELVIN(_temperature));
};
if (_atmosphereModel == "ICAO") then {
_ballisticCoefficient = (STD_AIR_DENSITY_ICAO / _airDensity) * _ballisticCoefficient;
} else {
_ballisticCoefficient = (STD_AIR_DENSITY_ASM / _airDensity) * _ballisticCoefficient;
};
};
_drag = _deltaT * ([_dragModel, _ballisticCoefficient, _trueSpeed] call cse_ab_ballistics_fnc_calculate_retardation);
_accel = (vectorNormalized _trueVelocity) vectorMultiply (_drag);
_bulletVelocity = _bulletVelocity vectorDiff _accel;
} else {
if (cse_AB_AtmosphericDensitySimulationEnabled) then {
_pressureDeviation = 1013.25 * exp(-(cse_AB_Altitude + (_bulletPosition select 2)) / 7990) - 1013.25 - 10 * overcast;
_temperature = GET_TEMPERATURE_AT_HEIGHT(_bulletPosition select 2);
_humidity = cse_AB_Humidity;
if (cse_AB_Humidity < 1 && fog > 0) then {
private ["_fogValue", "_fogDecay", "_fogBase"];
_fogValue = fogParams select 0;
_fogDecay = fogParams select 1;
_fogBase = fogParams select 2;
_fogDensity = 1 - 0.05 * (_fogDecay / _fogValue * (_height - _fogBase))^2;
if (_fogDensity > 0) then {
_humidity = 1;
} else {
_humidity = cse_AB_Humidity + (1 - cse_AB_Humidity) * (0 max (1 + _fogDensity));
};
};
_airFriction = _airFriction + ((_temperature - 15) * 0.0000015 + _humidity * 0.0000040 + _pressureDeviation * -0.0000009);
};
if (_airFriction != _airFrictionRef || vectorMagnitude _wind > 0) then {
_dragRef = _deltaT * _airFrictionRef * _bulletSpeed * _bulletSpeed;
_accelRef = (vectorNormalized _bulletVelocity) vectorMultiply (_dragRef);
_bulletVelocity = _bulletVelocity vectorDiff _accelRef;
_drag = _deltaT * _airFriction * _trueSpeed * _trueSpeed;
_accel = (vectorNormalized _trueVelocity) vectorMultiply (_drag);
_bulletVelocity = _bulletVelocity vectorAdd _accel;
};
};
if (cse_AB_CoriolisEnabled && _bulletSpeedAvg > 0) then {
_horizontalDeflection = 0.0000729 * (_unit distanceSqr _bullet) * sin(cse_AB_Latitude) / _bulletSpeedAvg;
_horizontalDeflectionPartial = _horizontalDeflection - (cse_AB_bulletDatabaseHDeflect select _index);
cse_AB_bulletDatabaseHDeflect set[_index, _horizontalDeflection];
_vect = [sin(_bulletDir + 90) * _horizontalDeflectionPartial, cos(_bulletDir + 90) * _horizontalDeflectionPartial, 0];
_bulletPosition = _bulletPosition vectorAdd _vect;
};
if (cse_AB_EoetvoesEnabled) then {
_centripetalAccel = 2 * 0.0000729 * (_muzzleVelocity / -32.2) * cos(cse_AB_Latitude) * sin(_bulletDir);
_accel = [0, 0, -(_centripetalAccel * _deltaT)];
_bulletVelocity = _bulletVelocity vectorAdd _accel;
};
if (cse_AB_SpinDriftEnabled) then {
_spinDrift = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83;
_spinDriftPartial = _spinDrift - (cse_AB_bulletDatabaseSpinDrift select _index);
cse_AB_bulletDatabaseSpinDrift set[_index, _spinDrift];
_vect = [sin(_bulletDir + 90) * _spinDriftPartial, cos(_bulletDir + 90) * _spinDriftPartial, 0];
_bulletPosition = _bulletPosition vectorAdd _vect;
};
};
if (cse_AB_TransonicRegionEnabled && _transonicStabilityCoef < 1) then {
if (_bulletSpeed < 345 && _bulletSpeedAvg > 340 && _bulletSpeed > 335) then {
_accel = [(random 0.8) - 0.4, (random 0.8) - 0.4, (random 0.8) - 0.4];
_accel = _accel vectorMultiply (1 - _transonicStabilityCoef);
_bulletVelocity = _bulletVelocity vectorAdd _accel;
};
};
if (_bulletTraceVisible && _bulletSpeed > 600 && _bullet distanceSqr _unit > 400) then {
drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.4*_caliber,0.2*_caliber],[[0,0,0,0.6],[0,0,0,0.4]],[1,0],0,0,"","",""];
};
_bullet setVelocity _bulletVelocity;
_bullet setPosASL _bulletPosition;
true
} count cse_AB_bulletDatabaseOccupiedIndices;
}] call BIS_fnc_addStackedEventHandler;
};

View File

@ -0,0 +1,171 @@
#include "defines.h"
private ["_unit", "_weapon", "_mode", "_ammo", "_magazine", "_caliber", "_bullet", "_index", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_atmosphereModel", "_bulletMass", "_bulletLength", "_bulletTranslation", "_airFriction", "_dragModel", "_velocityBoundaryData", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_bulletWeight", "_barrelTwist", "_twistDirection", "_stabilityFactor", "_transonicStabilityCoef", "_cse_AB_Elevation", "_cse_AB_Windage", "_ID"];
_unit = _this select 0;
_weapon = _this select 1;
_mode = _this select 3;
_ammo = _this select 4;
_bullet = _this select 5;
_magazine = _this select 6;
if (!isClass (configFile >> 'CfgPatches' >> 'CBA_main')) then {
_bullet = _this select 6;
_magazine = _this select 5;
};
if (isDedicated) exitWith {};
if (!alive _bullet) exitWith {};
if (!(isPlayer _unit)) exitWith {};
if (underwater _unit) exitWith {};
if (!(_ammo isKindOf "BulletBase")) exitWith {};
if (_unit distanceSqr player > 9000000) exitWith {};
if (cse_AB_OnlyActiveForLocalPlayer && !(local _unit)) exitWith {};
if (cse_AB_OnlyActiveForPlayerGroup && (group _unit != group player)) exitWith {};
if (!cse_AB_VehicleGunnerEnabled && !(_unit isKindOf "Man")) exitWith {};
if (cse_AB_DisabledInFullAutoMode && getNumber(configFile >> "cfgWeapons" >> _weapon >> _mode >> "autoFire") == 1) exitWith {};
if (!isServer && !((gunner _unit) getVariable ["cse_enabled_AdvancedBallistics", false])) exitWith {};
_airFriction = getNumber(configFile >> "cfgAmmo" >> _ammo >> "airFriction");
_muzzleVelocity = getNumber(configFile >> "cfgMagazines" >> _magazine >> "initSpeed");
_muzzleAccessory = (primaryWeaponItems _unit) select 0;
if (_muzzleAccessory != "" && isNumber(configFile >> "cfgWeapons" >> _muzzleAccessory >> "ItemInfo" >> "MagazineCoef" >> "initSpeed")) then {
_initSpeedCoef = getNumber(configFile >> "cfgWeapons" >> _muzzleAccessory >> "ItemInfo" >> "MagazineCoef" >> "initSpeed");
_muzzleVelocity = _muzzleVelocity * _initSpeedCoef;
};
if (cse_AB_BarrelLengthInfluenceEnabled) then {
_muzzleVelocityShift = [_ammo, _weapon, _muzzleVelocity] call cse_ab_ballistics_fnc_barrel_length_muzzle_velocity;
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 (cse_AB_AmmoTemperatureEnabled) then {
_temperature = GET_TEMPERATURE_AT_HEIGHT((getPosASL _unit) select 2);
_muzzleVelocityShift = [_ammo, _temperature] call cse_ab_ballistics_fnc_ammo_temperature_muzzle_velocity;
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;
};
};
_opticsName = "";
_opticType = 0;
if (currentWeapon player == primaryWeapon player && count primaryWeaponItems player > 2) then {
_opticsName = (primaryWeaponItems player) select 2;
_opticType = getNumber(configFile >> "cfgWeapons" >> _opticsName >> "ItemInfo" >> "opticType");
};
_bulletTraceVisible = (_opticType == 2 || currentWeapon player in ["Binocular", "Rangefinder", "Laserdesignator"]) && cameraView == "GUNNER";
if (cse_AB_MilTurretsEnabled) then {
[_bullet, _unit] call cse_ab_ballistics_fnc_apply_turret_adjustments;
};
_caliber = getNumber(configFile >> "cfgAmmo" >> _ammo >> "AB_caliber");
_bulletLength = getNumber(configFile >> "cfgAmmo" >> _ammo >> "AB_bulletLength");
_bulletMass = getNumber(configFile >> "cfgAmmo" >> _ammo >> "AB_bulletMass");
_barrelTwist = getNumber(configFile >> "cfgWeapons" >> _weapon >> "AB_barrelTwist");
_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(-(cse_AB_Altitude + ((getPosASL _bullet) select 2)) / 7990) - 10 * overcast;
_stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call cse_ab_ballistics_fnc_calculate_stability_factor;
};
_twistDirection = 1;
if (isNumber(configFile >> "cfgWeapons" >> _weapon >> "AB_twistDirection")) then {
_twistDirection = getNumber(configFile >> "cfgWeapons" >> _weapon >> "AB_twistDirection");
if (_twistDirection != -1 && _twistDirection != 0 && _twistDirection != 1) then {
_twistDirection = 1;
};
};
_transonicStabilityCoef = 0.5;
if (isNumber(configFile >> "cfgAmmo" >> _ammo >> "AB_transonicStabilityCoef")) then {
_transonicStabilityCoef = getNumber(configFile >> "cfgAmmo" >> _ammo >> "AB_transonicStabilityCoef");
};
_dragModel = 1;
_ballisticCoefficients = [];
_velocityBoundaries = [];
_atmosphereModel = "ICAO";
if (cse_AB_AdvancedAirDragEnabled) then {
if (isNumber(configFile >> "cfgAmmo" >> _ammo >> "AB_dragModel")) then {
_dragModel = getNumber(configFile >> "cfgAmmo" >> _ammo >> "AB_dragModel");
if (!(_dragModel in [1, 2, 5, 6, 7, 8])) then {
_dragModel = 1;
};
};
if (isArray(configFile >> "cfgAmmo" >> _ammo >> "AB_ballisticCoefficients")) then {
_ballisticCoefficients = getArray(configFile >> "cfgAmmo" >> _ammo >> "AB_ballisticCoefficients");
};
if (isArray(configFile >> "cfgAmmo" >> _ammo >> "AB_velocityBoundaries")) then {
_velocityBoundaries = getArray(configFile >> "cfgAmmo" >> _ammo >> "AB_velocityBoundaries");
};
if (isText(configFile >> "cfgAmmo" >> _ammo >> "AB_standardAtmosphere")) then {
_atmosphereModel = getText(configFile >> "cfgAmmo" >> _ammo >> "AB_standardAtmosphere");
};
};
_index = count cse_AB_bulletDatabase;
if (count cse_AB_bulletDatabaseFreeIndices > 0) then {
_index = cse_AB_bulletDatabaseFreeIndices select 0;
cse_AB_bulletDatabaseFreeIndices = cse_AB_bulletDatabaseFreeIndices - [_index];
};
"AdvancedBallistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", _index, _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _bullet, cse_AB_Latitude, cse_AB_Temperature, cse_AB_Altitude, cse_AB_Humidity, overcast, floor(time), time - floor(time)];
cse_AB_bulletDatabase set[_index, [_bullet, _caliber, _bulletTraceVisible, _index]];
if ((cse_AB_bulletDatabaseOccupiedIndices pushBack _index) == 0) then {
["AdvancedBallistics", "onEachFrame", {
private ["_bulletDatabaseEntry", "_index", "_bullet", "_caliber", "_bulletTraceVisible", "_bulletVelocity", "_bulletPosition", "_bulletVelocityShift", "_bulletPositionShift"];
{
_bulletDatabaseEntry = (cse_AB_bulletDatabase select _x);
_bullet = _bulletDatabaseEntry select 0;
_index = _bulletDatabaseEntry select 3;
if (!alive _bullet) then {
cse_AB_bulletDatabaseOccupiedIndices = cse_AB_bulletDatabaseOccupiedIndices - [_index];
cse_AB_bulletDatabaseFreeIndices pushBack _index;
};
true
} count cse_AB_bulletDatabaseOccupiedIndices;
if (count cse_AB_bulletDatabaseOccupiedIndices == 0) exitWith {
cse_AB_bulletDatabase = [];
cse_AB_bulletDatabaseOccupiedIndices = [];
cse_AB_bulletDatabaseFreeIndices = [];
["AdvancedBallistics", "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
};
{
_bulletDatabaseEntry = (cse_AB_bulletDatabase select _x);
_bullet = _bulletDatabaseEntry select 0;
_caliber = _bulletDatabaseEntry select 1;
_bulletTraceVisible = _bulletDatabaseEntry select 2;
_index = _bulletDatabaseEntry select 3;
_bulletVelocity = velocity _bullet;
_bulletPosition = getPosASL _bullet;
if (_bulletTraceVisible && vectorMagnitude _bulletVelocity > 600) then {
drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.4*_caliber,0.2*_caliber],[[0,0,0,0.6],[0,0,0,0.4]],[1,0],0,0,"","",""];
};
call compile ("AdvancedBallistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, wind, ASLToATL(_bulletPosition) select 2, floor(time), time - floor(time)]);
true
} count cse_AB_bulletDatabaseOccupiedIndices;
}] call BIS_fnc_addStackedEventHandler;
};

View File

@ -0,0 +1,38 @@
/**
* fn_ammo_temperature_muzzle_velocity.sqf
* @Descr: ?
* @Author: Ruthberg
*
* @Arguments: [Ammo Class Name, Temperature in C]
* @Return: [Muzzle Velocity Shift in m/s]
* @PublicAPI: true
*/
#include "defines.h"
private ["_ammo", "_temperature", "_muzzleVelocityTable", "_muzzleVelocityShift", "_temperatureIndexA", "_temperatureIndexB", "_temperatureRatio"];
_ammo = _this select 0;
_temperature = _this select 1;
_muzzleVelocityTable = [];
if (isArray(configFile >> "cfgAmmo" >> _ammo >> "AB_ammoTempMuzzleVelocityShifts")) then {
_muzzleVelocityTable = getArray(configFile >> "cfgAmmo" >> _ammo >> "AB_ammoTempMuzzleVelocityShifts");
};
if (count _muzzleVelocityTable != 11) exitWith { 0 };
_temperatureIndexA = floor((_temperature + 15) / 5);
_temperatureIndexA = 0 max _temperatureIndexA;
_temperatureIndexA = _temperatureIndexA min 10;
_temperatureIndexB = ceil((_temperature + 15) / 5);
_temperatureIndexB = 0 max _temperatureIndexB;
_temperatureIndexB = _temperatureIndexB min 10;
_temperatureRatio = ((_temperature + 15) / 5) - floor((_temperature + 15) / 5);
_muzzleVelocityShift = (_muzzleVelocityTable select _temperatureIndexA) * (1 - _temperatureRatio) + (_muzzleVelocityTable select _temperatureIndexB) * _temperatureRatio;
_muzzleVelocityShift

View File

@ -0,0 +1,37 @@
#include "defines.h"
private ["_bullet", "_unit", "_opticsName", "_opticType", "_windage", "_elevation", "_zero", "_bulletVelocity", "_dir", "_elev", "_mag3D", "_mag2D"];
_bullet = _this select 0;
_unit = _this select 1;
_opticsName = "";
_opticType = 0;
if (currentWeapon _unit == primaryWeapon _unit && count primaryWeaponItems _unit > 2) then {
_opticsName = (primaryWeaponItems _unit) select 2;
_opticType = getNumber(configFile >> "cfgWeapons" >> _opticsName >> "ItemInfo" >> "opticType");
};
if (_opticType == 2) then {
_windage = _unit getVariable [format["cse_AB_Windage:%1", _opticsName], 0];
_elevation = _unit getVariable [format["cse_AB_Elevation:%1", _opticsName], 0];
_zero = _unit getVariable [format["cse_AB_Zero:%1", _opticsName], 0];
_elevation = _elevation + _zero;
if (_windage != 0 || _elevation != 0) then {
_windage = _windage * 3.47 / 60;
_elevation = _elevation * 3.47 / 60;
_bulletVelocity = (velocity _bullet);
_mag3D = vectorMagnitude _bulletVelocity;
_dir = (_bulletVelocity select 0) atan2 (_bulletVelocity select 1);
_elev = asin((_bulletVelocity select 2) / _mag3D);
_dir = _dir + _windage;
_elev = _elev + _elevation;
_mag2D = _mag3D * cos(_elev);
_bullet setVelocity [_mag2D * sin(_dir), _mag2D * cos(_dir), _mag3D * sin(_elev)];
};
};

View File

@ -0,0 +1,61 @@
/**
* fn_barrel_length_muzzle_velocity.sqf
* @Descr: ?
* @Author: Ruthberg
*
* @Arguments: [Ammo Class Name, Weapon Class Name, Muzzle Velocity in m/s]
* @Return: [Muzzle Velocity in m/s]
* @PublicAPI: true
*/
#include "defines.h"
private ["_ammo", "_weapon", "_barrelLength", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocity", "_lowerIndex", "_upperIndex", "_barrelLengthRatio", "_muzzleVelocityNew"];
_ammo = _this select 0;
_weapon = _this select 1;
_muzzleVelocity = _this select 2;
_barrelLength = getNumber(configFile >> "cfgWeapons" >> _weapon >> "AB_barrelLength");
if (_barrelLength == 0) exitWith { 0 };
_muzzleVelocityTable = [];
_barrelLengthTable = [];
if (isArray(configFile >> "cfgAmmo" >> _ammo >> "AB_muzzleVelocities")) then {
_muzzleVelocityTable = getArray(configFile >> "cfgAmmo" >> _ammo >> "AB_muzzleVelocities");
};
if (isArray(configFile >> "cfgAmmo" >> _ammo >> "AB_barrelLengths")) then {
_barrelLengthTable = getArray(configFile >> "cfgAmmo" >> _ammo >> "AB_barrelLengths");
};
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;
if (_barrelLength <= (_barrelLengthTable select _lowerIndex)) exitWith { (_muzzleVelocityTable select _lowerIndex) - _muzzleVelocity };
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;
};
};
for "_i" from (count _barrelLengthTable) - 1 to 0 step -1 do {
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));
};
_muzzleVelocityNew = (_muzzleVelocityTable select _lowerIndex) + ((_muzzleVelocityTable select _upperIndex) - (_muzzleVelocityTable select _lowerIndex)) * (1 - _barrelLengthRatio);
_muzzleVelocityNew - _muzzleVelocity

View File

@ -0,0 +1,31 @@
/**
* fn_calculate_air_density.sqf
* @Descr: Calculates air density based on atmospheric pressure, temperature and rel.humidity
* @Author: Ruthberg
*
* @Arguments: [Temperature in C, Pressure in hPa, Relative Humidity as ratio 0.0-1.0]
* @Return: [Air Density in kg/m^3]
* @PublicAPI: true
*/
#include "defines.h"
private ["_temperature", "_pressure", "_relativeHumidity"];
_temperature = _this select 0; // in C
_pressure = _this select 1; // in hPa
_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))
} else {
_pressure / (SPECIFIC_GAS_CONSTANT_DRY_AIR * KELVIN(_temperature))
};

View File

@ -0,0 +1,27 @@
/**
* fn_calculate_atmospheric_correction.sqf
* @Descr: ?
* @Author: Ruthberg
*
* @Arguments: [Ballistic Coefficient, Temperature in C, Pressure in hPa, Relative Humidity as ratio in 0.0-1.0, Atm.Model = "ICAO" || "ASM"]
* @Return: [Corrected Ballistic Coefficient]
* @PublicAPI: true
*/
#include "defines.h"
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"
_airDensity = [_temperature, _pressure, _relativeHumidity] call cse_ab_ballistics_fnc_calculate_air_density;
if (_atmosphereModel == "ICAO") then {
(STD_AIR_DENSITY_ICAO / _airDensity) * _ballisticCoefficient
} else {
(STD_AIR_DENSITY_ASM / _airDensity) * _ballisticCoefficient
};

View File

@ -0,0 +1,38 @@
/**
* fn_calculate_hellmann_exponent.sqf
* @Descr: Wikipedia: The Hellmann exponent depends upon the coastal location and the shape of the terrain on the ground, and the stability of the air.
* @Author: Ruthberg
*
* @Arguments: [position in ASL format]
* @Return: [Hellmann Exponent]
* @PublicAPI: true
*/
#include "defines.h"
private ["_hellmann_exponents", "_hellmann_index", "_windSource", "_nearObjects", "_isWater"];
// Source: https://en.wikipedia.org/wiki/Wind_gradient
// Entries 0-2 -> open water surface; Entries 3-5 -> flat open coast; Entries 6-8 -> human inhabited areas
// Sorting: open water surface/flat open coast/human inhabited areas & stable air/neutral air/unstable air
_hellmann_exponents = [0.27, 0.10, 0.06, 0.40, 0.16, 0.11, 0.60, 0.34, 0.27];
_hellmann_exponent = 0.14;
_windSource = _this vectorDiff ((vectorNormalized wind) vectorMultiply 25);
_nearObjects = count (_windSource nearObjects ["Building", 50]);
_isWater = surfaceIsWater _this;
_hellmann_index = 0 max floor(overcast * 3) min 2;
if (_nearObjects >= 5) then {
_hellmann_exponent = _hellmann_exponents select (_hellmann_index + 6);
};
if (_nearObjects < 5) then {
_hellmann_exponent = _hellmann_exponents select (_hellmann_index + 3);
};
if (_nearObjects == 0 && _isWater) then {
_hellmann_exponent = _hellmann_exponents select (_hellmann_index + 0);
};
_hellmann_exponent

View File

@ -0,0 +1,129 @@
#include "defines.h"
// 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;
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; };
};
};
};
if (_A != -1 && _M != -1 && _velocity > 0 && _velocity < 10000) then {
_result = _A * (_velocity ^ _M) / _dragCoefficient;
_result = _result / 3.2808399;
};
_result

View File

@ -0,0 +1,21 @@
#include "defines.h"
private ["_roughness_lengths", "_windSource", "_nearBuildings", "_isWater"];
// Source: http://es.ucsc.edu/~jnoble/wind/extrap/index.html
_roughness_lengths = [0.0002, 0.0005, 0.0024, 0.03, 0.055, 0.1, 0.2, 0.4, 0.8, 1.6];
_windSource = _this vectorDiff ((vectorNormalized wind) vectorMultiply 25);
_nearBuildings = count (_windSource nearObjects ["Building", 50]);
_isWater = surfaceIsWater _windSource;
if (_nearBuildings == 0 && _isWater) exitWith {
0.0005
};
if (_nearBuildings >= 10) exitWith {
1.6
};
_roughness_lengths select (2 + (_nearBuildings min 6))

View File

@ -0,0 +1,27 @@
#include "defines.h"
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;
// Source: http://www.jbmballistics.com/ballistics/bibliography/articles/miller_stability_1.pdf
_t = _barrelTwist / _caliber;
_l = _bulletLength / _caliber;
_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);
} else {
_stabilityFactor = _stabilityFactor * (_muzzleVelocity / 1120) ^ (1/3);
};
_stabilityFactor = _stabilityFactor * (_temperature + 273) / (15 + 273) * 1013.25 / _barometricPressure;
_stabilityFactor

View File

@ -0,0 +1,65 @@
#include "defines.h"
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))];
};
_windSpeed = vectorMagnitude wind;
_windDir = (wind select 0) atan2 (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 cse_ab_ballistics_fnc_calculate_roughness_length;
_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;
};
// 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;
};
_windSpeed = 0 max _windSpeed;
_windSpeed

View File

@ -0,0 +1,117 @@
#include "defines.h"
private ["_time", "_timeRatio", "_month", "_avgTemperature", "_pS1", "_pS2", "_cse_AB_Day_Temperature", "_cse_AB_Night_Temperature", "_cse_AB_Humidity"];
_cse_AB_Day_Temperature = [1, 3, 9, 14, 19, 23, 25, 24, 21, 13, 7, 2];
_cse_AB_Night_Temperature = [-4, -3, 0, 4, 9, 12, 14, 14, 10, 6, 2, -2];
_cse_AB_Humidity = [82, 80, 78, 70, 71, 72, 70, 73, 78, 80, 83, 82];
// Climate graphs
if (toLower worldName in ["chernarus", "bootcamp_acr", "woodland_acr", "utes"]) then {
// Source: http://www.iten-online.ch/klima/europa/tschechien/prag.htm
_cse_AB_Day_Temperature = [1, 3, 9, 14, 19, 23, 25, 24, 21, 13, 7, 2];
_cse_AB_Night_Temperature = [-4, -3, 0, 4, 9, 12, 14, 14, 10, 6, 2, -2];
// Source: http://www.weather-and-climate.com/average-monthly-Humidity-perc,Prague,Czech-Republic
_cse_AB_Humidity = [82, 80, 78, 70, 71, 72, 70, 73, 78, 80, 83, 82];
};
if (toLower worldName in ["altis", "stratis"]) then {
// Source: http://www.iten-online.ch/klima/europa/griechenland/limnos.htm
_cse_AB_Day_Temperature = [10, 10, 12, 16, 21, 26, 29, 28, 25, 20, 15, 11];
_cse_AB_Night_Temperature = [4, 4, 6, 8, 13, 17, 20, 20, 16, 12, 8, 6];
// Source: http://www.weather-and-climate.com/average-monthly-Humidity-perc,Limnos,Greece
_cse_AB_Humidity = [78, 77, 78, 74, 71, 60, 59, 61, 65, 72, 79, 80];
};
if (toLower worldName in ["takistan", "zargabad", "mountains_acr", "shapur_baf", "provinggrounds_pmc"]) then {
// Source: http://www.iten-online.ch/klima/asien/afghanistan/kabul.htm
_cse_AB_Day_Temperature = [4.5, 5.5, 12.5, 19.2, 24.4, 30.2, 32.1, 32, 28.5, 22.4, 15, 8.3];
_cse_AB_Night_Temperature = [-7.1, -5.7, 0.7, 6, 8.8, 12.4, 15.3, 14.3, 9.4, 3.9, -1.2, -4.7];
// Source: http://www.weather-and-climate.com/average-monthly-Humidity-perc,Kabul,Afghanistan
_cse_AB_Humidity = [68, 69, 62, 60, 49, 37, 38, 39, 40, 41, 56, 61];
};
if (toLower worldName in ["fallujah"]) then {
// Source: http://www.iten-online.ch/klima/asien/irak/bagdad.htm
_cse_AB_Day_Temperature = [16, 19, 23, 29, 36, 41, 43, 43, 40, 33, 24, 17];
_cse_AB_Night_Temperature = [4, 6, 10, 15, 20, 23, 25, 25, 21, 16, 10, 5];
// Source: http://www.weather-and-climate.com/average-monthly-Humidity-perc,Bagdad,Iraq
_cse_AB_Humidity = [69, 60, 55, 50, 36, 23, 21, 22, 29, 38, 58, 68];
};
if (toLower worldName in ["fata", "Abbottabad"]) then {
// Source: http://www.iten-online.ch/klima/asien/pakistan/zhob.htm
_cse_AB_Day_Temperature = [12.4, 15.8, 20.8, 26.9, 32.8, 37, 36.8, 35.9, 33.8, 28.2, 22.2, 16.2];
_cse_AB_Night_Temperature = [-0.6, 2.4, 7.4, 13.1, 18.2, 22.8, 23.8, 22.9, 19.2, 12, 5.6, 1.2];
// Source: http://www.weather-and-climate.com/average-monthly-Humidity-perc,Zhob,Pakistan
_cse_AB_Humidity = [50, 40, 42, 40, 30, 30, 50, 49, 40, 32, 38, 41];
};
if (worldName in ["sfp_wamako"]) then {
// Source: http://www.iten-online.ch/klima/afrika/niger/tahoua.htm
_cse_AB_Day_Temperature = [33.4, 35, 38.4, 41.5, 41.4, 40, 35.6, 32.9, 35.8, 38.2, 36.4, 33.1];
_cse_AB_Night_Temperature = [14.9, 16.3, 20.4, 23.7, 25.8, 24.8, 23.1, 22, 22.6, 21.6, 18.6, 15.3];
// Source: http://www.weather-and-climate.com/average-monthly-Humidity-perc,Tahoua,Niger
_cse_AB_Humidity = [68, 60, 57, 50, 32, 22, 20, 21, 25, 38, 58, 69];
};
if (worldName in ["sfp_sturko"]) then {
// Source: http://www.iten-online.ch/klima/afrika/niger/tahoua.htm
_cse_AB_Day_Temperature = [2.2, 2.4, 5.1, 10.2, 16.1, 20.1, 21.1, 20.9, 17.2, 12.7, 7.4, 3.9];
_cse_AB_Night_Temperature = [-2, -2.3, -0.7, 2.6, 7.1, 11.4, 13.1, 12.7, 10, 6.9, 3.1, -0.1];
// Source: http://www.weather-and-climate.com/average-monthly-Humidity-perc,karlskrona,Sweden
_cse_AB_Humidity = [86, 85, 80, 72, 68, 69, 74, 77, 79, 81, 86, 88];
};
if (worldName in ["Bornholm"]) then {
// Source: http://www.iten-online.ch/klima/afrika/niger/tahoua.htm
_cse_AB_Day_Temperature = [1.9, 1.7, 3.8, 8.1, 14, 18.1, 19.6, 19.8, 16.2, 11.9, 7.3, 3.9];
_cse_AB_Night_Temperature = [-1.6, -2.1, -0.7, 1.7, 6.2, 10.7, 13, 13.1, 10.6, 7.2, 3.5, 0.1];
// Source: http://www.weather-and-climate.com/average-monthly-Humidity-perc,allinge,Denmark
_cse_AB_Humidity = [85, 84, 80, 76, 69, 69, 76, 77, 79, 81, 86, 86];
};
if (worldName in ["Imrali"]) then {
// Source: http://www.iten-online.ch/klima/europa/tuerkei/bursa.htm
_cse_AB_Day_Temperature = [9.3, 10.7, 13.6, 18.8, 23.5, 28.2, 30.3, 30.2, 27, 21.4, 16.5, 11.8];
_cse_AB_Night_Temperature = [1.4, 2.4, 3.7, 7.1, 10.9, 14.3, 16.5, 16.3, 13, 9.5, 6, 3.8];
// Source: http://www.weather-and-climate.com/average-monthly-Humidity-perc,Bursa,Turkey
_cse_AB_Humidity = [78, 75, 70, 70, 71, 61, 58, 59, 63, 69, 77, 76];
};
while {true} do
{
_time = daytime;
_month = date select 1;
// Temperature
_timeRatio = abs(_time - 12) / 12;
cse_AB_Temperature = (_cse_AB_Day_Temperature select (_month - 1)) * (1 - _timeRatio) + (_cse_AB_Night_Temperature select (_month - 1)) * _timeRatio;
cse_AB_Temperature = cse_AB_Temperature + cse_AB_temperatureShift - cse_AB_badWeatherShift * overcast;
cse_AB_Temperature = round(cse_AB_Temperature * 10) / 10;
// Humidity
cse_AB_Humidity = (_cse_AB_Humidity select _month) / 100;
cse_AB_Humidity = cse_AB_Humidity + cse_AB_humidityShift;
if (rain > 0 && overcast > 0.7) then {
cse_AB_Humidity = 1;
} else {
_avgTemperature = ((_cse_AB_Day_Temperature select (_month - 1)) + (_cse_AB_Night_Temperature select (_month - 1))) / 2;
_pS1 = 6.112 * exp((17.62 * _avgTemperature) / (243.12 + _avgTemperature));
_PS2 = 6.112 * exp((17.62 * cse_AB_Temperature) / (243.12 + cse_AB_Temperature));
cse_AB_Humidity = cse_AB_Humidity * _PS1 / _PS2;
};
cse_AB_Humidity = 0 max cse_AB_Humidity min 1;
sleep 60;
};

View File

@ -0,0 +1,50 @@
#include "defines.h"
#define __dsp (uiNamespace getVariable "RscProtractor")
#define __ctrl1 (__dsp displayCtrl 132950)
#define __ctrl2 (__dsp displayCtrl 132951)
private ["_inclinationAngle", "_refPosition"];
if (cse_AB_Protractor) exitWith {
cse_AB_Protractor = false;
1 cutText ["", "PLAIN"];
true
};
if (weaponLowered player) exitWith { true };
if (vehicle player != player) exitWith { true };
if (currentWeapon player != primaryWeapon player) exitWith { true };
[] spawn {
2 cutText ["", "PLAIN"];
cse_AB_WindInfo = false;
0 cutText ["", "PLAIN"];
cse_AB_Protractor = true;
while {cse_AB_Protractor && !(weaponLowered player) && currentWeapon player == primaryWeapon player} do {
_refPosition = [SafeZoneX + 0.001, SafeZoneY + 0.001, 0.2, 0.2 * 4/3];
_inclinationAngle = asin((player weaponDirection currentWeapon player) select 2);
_inclinationAngle = -58 max _inclinationAngle min 58;
1 cutRsc ["RscProtractor", "PLAIN", 1, false];
__ctrl1 ctrlSetScale 0.75;
__ctrl1 ctrlCommit 0;
__ctrl1 ctrlSetText "cse\cse_sys_ballistics\advancedballistics\data\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 "cse\cse_sys_ballistics\advancedballistics\data\protractor_marker.paa";
__ctrl2 ctrlSetTextColor [1, 1, 1, 1];
sleep 0.1;
};
cse_AB_Protractor = false;
1 cutText ["", "PLAIN"];
};
true

View File

@ -0,0 +1,64 @@
#include "defines.h"
#define __dsp (uiNamespace getVariable "RscWindIntuitive")
#define __ctrl (__dsp displayCtrl 132948)
private ["_windSpeed", "_windDir", "_playerDir", "_windIndex", "_windColor", "_newWindSpeed", "_windSource", "_height"];
if (cse_AB_WindInfo) exitWith {
cse_AB_WindInfo = false;
0 cutText ["", "PLAIN"];
true
};
if (underwater player) exitWith { true };
if (vehicle player != player) exitWith { true };
[] spawn {
2 cutText ["", "PLAIN"];
cse_AB_Protractor = false;
1 cutText ["", "PLAIN"];
cse_AB_WindInfo = true;
while {cse_AB_WindInfo && !(underwater player) && vehicle player == player} do {
_windIndex = 12;
_windColor = [1, 1, 1, 1];
_windSpeed = (eyePos player) call cse_ab_ballistics_fnc_calculate_wind_speed;
if (_windSpeed > 0.2) then {
_playerDir = getDir player;
_windDir = (wind select 0) atan2 (wind select 1);
_windIndex = round(((_playerDir - _windDir + 360) % 360) / 30);
_windIndex = _windIndex % 12;
};
// Color Codes from https://en.wikipedia.org/wiki/Beaufort_scale#Modern_scale
if (_windSpeed > 0.3) then { _windColor = [0.796, 1, 1, 1]; };
if (_windSpeed > 1.5) then { _windColor = [0.596, 0.996, 0.796, 1]; };
if (_windSpeed > 3.3) then { _windColor = [0.596, 0.996, 0.596, 1]; };
if (_windSpeed > 5.4) then { _windColor = [0.6, 0.996, 0.4, 1]; };
if (_windSpeed > 7.9) then { _windColor = [0.6, 0.996, 0.047, 1]; };
if (_windSpeed > 10.7) then { _windColor = [0.8, 0.996, 0.059, 1]; };
if (_windSpeed > 13.8) then { _windColor = [1, 0.996, 0.067, 1]; };
if (_windSpeed > 17.1) then { _windColor = [1, 0.796, 0.051, 1]; };
if (_windSpeed > 20.7) then { _windColor = [1, 0.596, 0.039, 1]; };
if (_windSpeed > 24.4) then { _windColor = [1, 0.404, 0.031, 1]; };
if (_windSpeed > 28.4) then { _windColor = [1, 0.22, 0.027, 1]; };
if (_windSpeed > 32.6) then { _windColor = [1, 0.078, 0.027, 1]; };
0 cutRsc ["RscWindIntuitive", "PLAIN", 1, false];
__ctrl ctrlSetScale 0.75;
__ctrl ctrlCommit 0;
__ctrl ctrlSetText format["cse\cse_sys_ballistics\advancedballistics\data\wind%1.paa", _windIndex];
__ctrl ctrlSetTextColor _windColor;
sleep 0.5;
};
cse_AB_WindInfo = false;
0 cutText ["", "PLAIN"];
};
true

View File

@ -0,0 +1,17 @@
#include "defines.h"
private ["_fogValue", "_fogDecay", "_fogBase"];
if (cse_AB_Humidity < 1 && fog > 0) then {
_fogValue = fogParams select 0;
_fogDecay = fogParams select 1;
_fogBase = fogParams select 2;
_fogDensity = 1 - 0.05 * (_fogDecay / _fogValue * (_this - _fogBase))^2;
if (_fogDensity > 0) then {
1
} else {
cse_AB_Humidity + (1 - cse_AB_Humidity) * (0 max (1 + _fogDensity))
};
} else {
cse_AB_Humidity
};

View File

@ -0,0 +1,3 @@
#include "defines.h"
GET_TEMPERATURE_AT_HEIGHT(_this)

View File

@ -0,0 +1,31 @@
if (!cse_AB_UseDLL) exitWith {};
[] 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 (cse_AB_InitMessageEnabled) 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 (cse_AB_InitMessageEnabled) then {
systemChat format["AdvancedBallistics: Finished terrain initialization in %1 seconds", ceil(time - _initStartTime)];
};
};

View File

@ -0,0 +1,45 @@
#include "defines.h"
private ["_opticsName", "_parallax", "_playerDirection", "_vectorToFocalPoint", "_focusLength", "_focalPoint", "_roughnessLength", "_distCoef", "_focalPlaneAngle", "_windSpeedRef", "_windSpeed",
"_particleSize", "_particleMoveVelocityRef", "_particleMoveVelocity", "_pASL", "_pATL", "_height"];
while {cse_AB_MirageEnabled} do {
_opticsName = currentWeapon player;
if (currentWeapon player == primaryWeapon player && count primaryWeaponItems player > 2) then {
_opticsName = (primaryWeaponItems player) select 2;
};
_parallax = player getVariable [format["cse_AB_Parallax:%1", _opticsName], 0];
while {sunOrMoon == 1 && cameraView == "GUNNER" && _parallax > 0} do {
_vectorToFocalPoint = (ATLToASL(screenToWorld [0.5,0.5])) vectorDiff (getPosASL player);
_focusLength = vectorMagnitude _vectorToFocalPoint;
if (_focusLength > 0) then {
_vectorToFocalPoint = _vectorToFocalPoint vectorMultiply (_parallax / _focusLength);
};
_focusLength = vectorMagnitude _vectorToFocalPoint;
_focalPoint = (getPosASL player) vectorAdd _vectorToFocalPoint;
_roughnessLength = _focalPoint call cse_ab_ballistics_fnc_calculate_roughness_length;
_distCoef = (1 max (_focusLength / 100)) ^ 0.5;
_focalPlaneAngle = (getDir player) + 90;
_windSpeedRef = vectorMagnitude wind;
_particleSize = 0.5 * _distCoef;
_particleMoveVelocityRef = [0, 0, 0.01] vectorAdd ((vectorNormalized wind) vectorMultiply (0.1));
for "_j" from -10 to 10 do {
for "_i" from -10 to 10 do {
_pASL = [(_focalPoint select 0) + _j / 2 * _distCoef * sin(_focalPlaneAngle), (_focalPoint select 1) + _j / 2 * _distCoef * cos(_focalPlaneAngle), (_focalPoint select 2) + _i / 2 * _distCoef];
_pATL = ASLToATL _pASL;
_windSpeed = _windSpeedRef;
_height = _pATL select 2;
if (_height < 20) then {
_windSpeed = _windSpeed * ln(_height / _roughnessLength) / ln(20 / _roughnessLength);
};
_particleMoveVelocity = _particleMoveVelocityRef vectorMultiply _windSpeed;
drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,8,_pATL,_particleMoveVelocity,0,1.275,1,0,[_particleSize,_particleSize],[[0,0,0,0.3],[0,0,0,0.15]],[1,0],0,0,"","",""];
};
};
_parallax = player getVariable [format["cse_AB_Parallax:%1", _opticsName], 0];
sleep 1;
};
sleep 1;
};

View File

@ -0,0 +1,14 @@
#include "defines.h"
private ["_opticsName", "_zeroPlayer", "_zeroProfileNamespace"];
if (count primaryWeaponItems player > 2) then
{
_opticsName = (primaryWeaponItems player) select 2;
_zeroPlayer = player getVariable [format["cse_AB_Zero:%1", _opticsName], 0];
_zeroProfileNamespace = profileNamespace getVariable [format["cse_AB_Zero:%1", _opticsName], 0];
if (_zeroProfileNamespace != 0 && _zeroPlayer != _zeroProfileNamespace) then {
player setVariable [format["cse_AB_Zero:%1", _opticsName], _zeroProfileNamespace, true];
};
};

View File

@ -0,0 +1,36 @@
private ["_args"];
_args = _this;
{
_varName = "cse_ab_"+(_x select 0);
missionNamespace setvariable[_varName, _x select 1];
}foreach _args;
cse_ab_AdvancedBallistics = true;
if (isNil "cse_AB_WindEnabled") then { cse_AB_WindEnabled = cse_AB_WIND_ENABLED };
if (isNil "cse_AB_SpinDriftEnabled") then { cse_AB_SpinDriftEnabled = cse_AB_SPIN_DRIFT_ENABLED };
if (isNil "cse_AB_CoriolisEnabled") then { cse_AB_CoriolisEnabled = cse_AB_CORIOLIS_ENABLED };
if (isNil "cse_AB_EoetvoesEnabled") then { cse_AB_EoetvoesEnabled = cse_AB_EOETVOES_ENABLED };
if (isNil "cse_AB_AdvancedAirDragEnabled") then { cse_AB_AdvancedAirDragEnabled = cse_AB_ADVANCED_AIR_DRAG_ENABLED };
if (isNil "cse_AB_TransonicRegionEnabled") then { cse_AB_TransonicRegionEnabled = cse_AB_TRANSONIC_REGION_ENABLED };
if (isNil "cse_AB_MilTurretsEnabled") then { cse_AB_MilTurretsEnabled = cse_AB_MIL_TURRETS_ENABLED };
if (isNil "cse_AB_AmmoTemperatureEnabled") then { cse_AB_AmmoTemperatureEnabled = cse_AB_AMMO_TEMPERATURE_ENABLED };
if (isNil "cse_AB_BulletTraceEnabled") then { cse_AB_BulletTraceEnabled = cse_AB_BULLET_TRACE_ENABLED };
if (isNil "cse_AB_MirageEnabled") then { cse_AB_MirageEnabled = cse_AB_MIRAGE_ENABLED };
if (isNil "cse_AB_AtmosphericDensitySimulationEnabled") then { cse_AB_AtmosphericDensitySimulationEnabled = cse_AB_ATMOSPHERIC_DENSITY_SIMULATION_ENABLED };
if (isNil "cse_AB_BarrelLengthInfluenceEnabled") then { cse_AB_BarrelLengthInfluenceEnabled = cse_AB_BARREL_LENGTH_INFLUENCE };
if (isNil "cse_AB_VehicleGunnerEnabled") then { cse_AB_VehicleGunnerEnabled = cse_AB_VEHICLE_GUNNER_ENABLED };
if (isNil "cse_AB_ExtensionsEnabled") then { cse_AB_ExtensionsEnabled = cse_AB_EXTENSIONS_ENABLED };
if (isNil "cse_AB_InitMessageEnabled") then { cse_AB_InitMessageEnabled = cse_AB_INIT_MESSAGE_ENABLED };
if (isNil "cse_AB_OnlyActiveForLocalPlayer") then { cse_AB_OnlyActiveForLocalPlayer = cse_AB_ONLY_ACTIVE_FOR_LOCAL_PLAYER };
if (isNil "cse_AB_OnlyActiveForPlayerGroup") then { cse_AB_OnlyActiveForPlayerGroup = cse_AB_ONLY_ACTIVE_FOR_PLAYER_GROUP };
if (isNil "cse_AB_Precision") then { cse_AB_Precision = cse_AB_PRECISION };
if (isNil "cse_AB_DisabledByDefault") then { cse_AB_DisabledByDefault = cse_AB_DISABLED_BY_DEFAULT in [true, 1] };
if (isNil "cse_AB_temperatureShift") then { cse_AB_temperatureShift = (random 3) - (random 3); publicVariable "cse_AB_temperatureShift"; };
if (isNil "cse_AB_badWeatherShift") then { cse_AB_badWeatherShift = (random 1)^2 * 10; publicVariable "cse_AB_badWeatherShift"; };
if (isNil "cse_AB_humidityShift") then { cse_AB_humidityShift = ((random 5) - (random 5)) / 100; publicVariable "cse_AB_humidityShift"; };
if (hasInterface) then {
call compile preprocessFileLineNumbers "cse\cse_sys_ballistics\advancedballistics\initClient.sqf";
};

View File

@ -0,0 +1,169 @@
if (isNil "cse_AB_OnlyActiveForLocalPlayer") then { cse_AB_OnlyActiveForLocalPlayer = false; };
if (isNil "cse_AB_DisabledInFullAutoMode") then { cse_AB_DisabledInFullAutoMode = false; };
if (isNil "cse_AB_UseDLL") then { cse_AB_UseDLL = false; };
if (cse_AB_ExtensionsEnabled && ("AdvancedBallistics" callExtension "version") == "1.0") then {
cse_AB_UseDLL = true;
cse_ab_ballistics_fnc_advanced_ballistics = cse_ab_ballistics_fnc_advanced_ballistics_extension;
};
cse_AB_bulletDatabase = [];
cse_AB_bulletDatabaseStartTime = [];
cse_AB_bulletDatabaseSpeed = [];
cse_AB_bulletDatabaseFrames = [];
cse_AB_bulletDatabaseLastFrame = [];
cse_AB_bulletDatabaseHDeflect = [];
cse_AB_bulletDatabaseSpinDrift = [];
cse_AB_bulletDatabaseOccupiedIndices = [];
cse_AB_bulletDatabaseFreeIndices = [];
cse_AB_WindInfo = false;
cse_AB_WindInfoStart = time;
cse_AB_Protractor = false;
cse_AB_ProtractorStart = time;
cse_AB_Altitude = 0;
cse_AB_Latitude = 50;
cse_AB_Temperature = 15;
cse_AB_Humidity = 50;
if (worldName in ["Chernarus", "Bootcamp_ACR", "Woodland_ACR", "utes"]) then { cse_AB_Latitude = 50; cse_AB_Altitude = 0; };
if (worldName in ["Altis", "Stratis"]) then { cse_AB_Latitude = 40; cse_AB_Altitude = 0; };
if (worldName in ["Takistan", "Zargabad", "Mountains_ACR"]) then { cse_AB_Latitude = 35; cse_AB_Altitude = 2000; };
if (worldName in ["Shapur_BAF", "ProvingGrounds_PMC"]) then { cse_AB_Latitude = 35; cse_AB_Altitude = 100; };
if (worldName in ["fallujah"]) then { cse_AB_Latitude = 33; cse_AB_Altitude = 0; };
if (worldName in ["fata", "Abbottabad"]) then { cse_AB_Latitude = 30; cse_AB_Altitude = 1000; };
if (worldName in ["sfp_wamako"]) then { cse_AB_Latitude = 14; cse_AB_Altitude = 0; };
if (worldName in ["sfp_sturko"]) then { cse_AB_Latitude = 56; cse_AB_Altitude = 0; };
if (worldName in ["Bornholm"]) then { cse_AB_Latitude = 55; cse_AB_Altitude = 0; };
if (worldName in ["Imrali"]) then { cse_AB_Latitude = 40; cse_AB_Altitude = 0; };
if (worldName in ["Caribou"]) then { cse_AB_Latitude = 68; cse_AB_Altitude = 0; };
if (worldName in ["Namalsk"]) then { cse_AB_Latitude = 65; cse_AB_Altitude = 0; };
if (worldName in ["MCN_Aliabad"]) then { cse_AB_Latitude = 36; cse_AB_Altitude = 0; };
if (worldName in ["Clafghan"]) then { cse_AB_Latitude = 34; cse_AB_Altitude = 640; };
if (worldName in ["Sangin", "hellskitchen"]) then { cse_AB_Latitude = 32; cse_AB_Altitude = 0; };
if (worldName in ["Sara"]) then { cse_AB_Latitude = 40; cse_AB_Altitude = 0; };
if (worldName in ["reshmaan"]) then { cse_AB_Latitude = 35; cse_AB_Altitude = 2000; };
if (worldName in ["Thirsk"]) then { cse_AB_Latitude = 65; cse_AB_Altitude = 0; };
if (worldName in ["lingor"]) then { cse_AB_Latitude = -4; cse_AB_Altitude = 0; };
waitUntil {!isNil "cse_gui"};
waitUntil {!isNull player};
if (isNil {player getVariable "cse_enabled_AdvancedBallistics"}) then {
player setVariable ["cse_enabled_AdvancedBallistics", !cse_AB_DisabledByDefault, true];
};
if (cse_AB_MilTurretsEnabled) then {
// Elevation minor step up
["cse_sys_ballistics_AB_Adjustment_Up", (["cse_sys_ballistics_AB_Adjustment_Up","action",[200, 0,0,0]] call cse_fnc_getKeyBindingFromProfile_F),
{
[0, false] call cse_ab_ballistics_fnc_adjust_turret;
}] call cse_fnc_addKeyBindingForAction_F;
["cse_sys_ballistics_AB_Adjustment_Up","action", "Minor adjustment up", "Opens the ATragMX dialog"] call cse_fnc_settingsDefineDetails_F;
// Elevation minor step down
["cse_sys_ballistics_AB_Adjustment_Down", (["cse_sys_ballistics_AB_Adjustment_Down","action",[208, 0,0,0]] call cse_fnc_getKeyBindingFromProfile_F),
{
[1, false] call cse_ab_ballistics_fnc_adjust_turret;
}] call cse_fnc_addKeyBindingForAction_F;
["cse_sys_ballistics_AB_Adjustment_Down","action", "Minor adjustment Down", "Opens the ATragMX dialog"] call cse_fnc_settingsDefineDetails_F;
// Windage minor step left
["cse_sys_ballistics_AB_Adjustment_Left", (["cse_sys_ballistics_AB_Adjustment_Left","action",[203, 0,0,0]] call cse_fnc_getKeyBindingFromProfile_F),
{
[2, false] call cse_ab_ballistics_fnc_adjust_turret;
}] call cse_fnc_addKeyBindingForAction_F;
["cse_sys_ballistics_AB_Adjustment_Left","action", "Minor adjustment Left", "Opens the ATragMX dialog"] call cse_fnc_settingsDefineDetails_F;
// Windage minor step right
["cse_sys_ballistics_AB_Adjustment_Right", (["cse_sys_ballistics_AB_Adjustment_Right","action",[205, 0,0,0]] call cse_fnc_getKeyBindingFromProfile_F),
{
[3, false] call cse_ab_ballistics_fnc_adjust_turret;
}] call cse_fnc_addKeyBindingForAction_F;
["cse_sys_ballistics_AB_Adjustment_Right","action", "Minor adjustment Right", "Opens the ATragMX dialog"] call cse_fnc_settingsDefineDetails_F;
// Elevation major step up
["cse_sys_ballistics_AB_Adjustment_Up_major", (["cse_sys_ballistics_AB_Adjustment_Up_major","action",[200, 1,0,0]] call cse_fnc_getKeyBindingFromProfile_F),
{
[0, true] call cse_ab_ballistics_fnc_adjust_turret;
}] call cse_fnc_addKeyBindingForAction_F;
["cse_sys_ballistics_AB_Adjustment_Up_major","action", "Major adjustment up", "Opens the ATragMX dialog"] call cse_fnc_settingsDefineDetails_F;
// Elevation major step down
["cse_sys_ballistics_AB_Adjustment_Down_major", (["cse_sys_ballistics_AB_Adjustment_Down_major","action",[208, 1,0,0]] call cse_fnc_getKeyBindingFromProfile_F),
{
[1, true] call cse_ab_ballistics_fnc_adjust_turret;
}] call cse_fnc_addKeyBindingForAction_F;
["cse_sys_ballistics_AB_Adjustment_Down_major","action", "Major adjustment Down", "Opens the ATragMX dialog"] call cse_fnc_settingsDefineDetails_F;
// Windage major step left
["cse_sys_ballistics_AB_Adjustment_Left_major", (["cse_sys_ballistics_AB_Adjustment_Left_major","action",[203, 1,0,0]] call cse_fnc_getKeyBindingFromProfile_F),
{
[2, true] call cse_ab_ballistics_fnc_adjust_turret;
}] call cse_fnc_addKeyBindingForAction_F;
["cse_sys_ballistics_AB_Adjustment_Left_major","action", "Major adjustment Left_major", "Opens the ATragMX dialog"] call cse_fnc_settingsDefineDetails_F;
// Windage major step right
["cse_sys_ballistics_AB_Adjustment_Right_major", (["cse_sys_ballistics_AB_Adjustment_Right_major","action",[205, 1,0,0]] call cse_fnc_getKeyBindingFromProfile_F),
{
[3, true] call cse_ab_ballistics_fnc_adjust_turret;
}] call cse_fnc_addKeyBindingForAction_F;
["cse_sys_ballistics_AB_Adjustment_Right_major","action", "Major adjustment Right", "Opens the ATragMX dialog"] call cse_fnc_settingsDefineDetails_F;
// Scope zero adjustment
["cse_sys_ballistics_AB_Adjustment_Zero_Up", (["cse_sys_ballistics_AB_Adjustment_Zero_Up","action",[200, 1,1,0]] call cse_fnc_getKeyBindingFromProfile_F),
{
[4, false] call cse_ab_ballistics_fnc_adjust_turret;
}] call cse_fnc_addKeyBindingForAction_F;
["cse_sys_ballistics_AB_Adjustment_Zero_Up","action", "Zero adjustment up", "Zero adjustment up"] call cse_fnc_settingsDefineDetails_F;
["cse_sys_ballistics_AB_Adjustment_Zero_Down", (["cse_sys_ballistics_AB_Adjustment_Zero_Down","action",[208, 1,1,0]] call cse_fnc_getKeyBindingFromProfile_F),
{
[5, false] call cse_ab_ballistics_fnc_adjust_turret;
}] call cse_fnc_addKeyBindingForAction_F;
["cse_sys_ballistics_AB_Adjustment_Zero_Down","action", "Zero adjustment down", "Zero adjustment down"] call cse_fnc_settingsDefineDetails_F;
};
// Parallax Adjustment
if (cse_AB_MirageEnabled) then {
["cse_sys_ballistics_AB_Adjustment_Parallax_Up", (["cse_sys_ballistics_AB_Adjustment_Parallax_Up","action",[200, 0,1,0]] call cse_fnc_getKeyBindingFromProfile_F),
{
0 call cse_ab_ballistics_fnc_adjust_parallax;
}] call cse_fnc_addKeyBindingForAction_F;
["cse_sys_ballistics_AB_Adjustment_Parallax_Up","action", "Parallax adjustment up", "Parallax adjustment up"] call cse_fnc_settingsDefineDetails_F;
["cse_sys_ballistics_AB_Adjustment_Parallax_Down", (["cse_sys_ballistics_AB_Adjustment_Parallax_Down","action",[208, 0,1,0]] call cse_fnc_getKeyBindingFromProfile_F),
{
1 call cse_ab_ballistics_fnc_adjust_parallax;
}] call cse_fnc_addKeyBindingForAction_F;
["cse_sys_ballistics_AB_Adjustment_Parallax_Down","action", "Parallax adjustment down", "Parallax adjustment down"] call cse_fnc_settingsDefineDetails_F;
};
// Show wind Info
["cse_sys_ballistics_AB_Display_Wind_Info", (["cse_sys_ballistics_AB_Display_Wind_Info","action",[37,1,0,0]] call cse_fnc_getKeyBindingFromProfile_F),
{
_this call cse_ab_ballistics_fnc_display_wind_info;
}] call cse_fnc_addKeyBindingForAction_F;
["cse_sys_ballistics_AB_Display_Wind_Info","action", "Show wind info", "Show wind info"] call cse_fnc_settingsDefineDetails_F;
// Show protractor
["cse_sys_ballistics_AB_Display_Protractor", (["cse_sys_ballistics_AB_Display_Protractor","action",[37,1,1,0]] call cse_fnc_getKeyBindingFromProfile_F),
{
_this call cse_ab_ballistics_fnc_display_protractor;
}] call cse_fnc_addKeyBindingForAction_F;
["cse_sys_ballistics_AB_Display_Protractor","action", "Show protractor", "Show protractor"] call cse_fnc_settingsDefineDetails_F;
_handle = _this spawn cse_ab_ballistics_fnc_climate_simulation;
_handle = _this spawn cse_ab_ballistics_fnc_mirage_simulation;
_handle = _this spawn cse_ab_ballistics_fnc_initialize_terrain_extension;

View File

@ -0,0 +1,19 @@
Copyright (c) <2014> <Ruthberg>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,92 @@
class RscTitles
{
class RscWindIntuitive
{
idd=-1;
onLoad="with uiNameSpace do { RscWindIntuitive = _this select 0 };";
movingEnable=0;
duration=60;
fadeIn="false";
fadeOut="false";
class controls
{
class RscWindIntuitive
{
idc=132948;
type=0;
style=48;
font="TahomaB";
colorBackground[]={0,0,0,0};
colorText[]={0,0,0,0};
x="SafeZoneX + 0.001";
y="SafeZoneY + 0.001";
w=0.2;
h=0.2*4/3;
size=0.034;
sizeEx=0.027;
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;
};
};
};
};

View File

@ -0,0 +1,48 @@
class cfgFunctions {
class CSE_ab_atragmx
{
class Atragmx {
file = "cse\cse_sys_ballistics\atragmx\functions";
class add_new_gun { recompile = 1; };
class calculate_range_card { recompile = 1; };
class calculate_scope_base_angle { recompile = 1; };
class calculate_solution { recompile = 1; };
class calculate_target_range_assist { recompile = 1; };
class calculate_target_solution { recompile = 1; };
class calculate_target_speed_assist { recompile = 1; };
class change_gun { recompile = 1; };
class create_dialog { recompile = 1; };
class cycle_range_card_columns { recompile = 1; };
class cycle_scope_unit { recompile = 1; };
class delete_gun { recompile = 1; };
class parse_input { recompile = 1; };
class reset_relative_click_memory { recompile = 1; };
class save_gun { recompile = 1; };
class show_add_new_gun { recompile = 1; };
class show_gun_list { recompile = 1; };
class show_main_page { recompile = 1; };
class show_range_card { recompile = 1; };
class show_range_card_setup { recompile = 1; };
class show_target_range_assist { recompile = 1; };
class show_target_speed_assist { recompile = 1; };
class show_target_speed_assist_timer { recompile = 1; };
class sord { recompile = 1; };
class target_speed_assist_timer { recompile = 1; };
class toggle_gun_list { recompile = 1; };
class toggle_range_card { recompile = 1; };
class toggle_range_card_setup { recompile = 1; };
class toggle_target_range_assist { recompile = 1; };
class toggle_target_speed_assist { recompile = 1; };
class update_atmosphere { recompile = 1; };
class update_gun { recompile = 1; };
class update_range_card { recompile = 1; };
class update_relative_click_memory { recompile = 1; };
class update_result { recompile = 1; };
class update_scope_unit { recompile = 1; };
class update_target { recompile = 1; };
class update_target_selection { recompile = 1; };
class update_unit_selection { recompile = 1; };
class update_zero_range { recompile = 1; };
};
};
};

View File

@ -0,0 +1,38 @@
class CfgVehicles
{
class Item_Base_F;
class cse_ab_Item_ATragMX: Item_Base_F
{
scope=2;
scopeCurator=2;
displayName="ATragMX";
author="Ruthberg";
vehicleClass="Items";
class TransportItems
{
class cse_ab_ATragMX
{
name="cse_ab_ATragMX";
count=1;
};
};
};
class NATO_Box_Base;
class cse_ballisticsItemsCrate: NATO_Box_Base
{
scope = 2;
displayName = "Ballistic Items [CSE]";
author = "Combat Space Enhancement";
model = "\A3\weapons_F\AmmoBoxes\AmmoBox_F";
class TransportWeapons
{
class _xx_cse_ab_ATragMX
{
weapon="cse_ab_ATragMX";
count=5;
};
};
};
};

View File

@ -0,0 +1,20 @@
class CfgWeapons
{
class ItemCore;
class InventoryItem_Base_F;
class cse_ab_ATragMX: ItemCore
{
scope=2;
value = 1;
count = 1;
type = 16;
displayName="ATragMX";
picture="\cse\cse_sys_ballistics\atragmx\data\ATrag_Icon.paa";
descriptionShort="Rugged PDA with ATragMX";
class ItemInfo: InventoryItem_Base_F
{
mass=4;
type=201;
};
};
};

View File

@ -0,0 +1,11 @@
class Combat_Space_Enhancement {
class EventHandlers {
class PostInit_EventHandlers {
class cse_ab_atragmx {
init = "call compile preprocessFile 'cse\cse_sys_ballistics\atragmx\XEH_postClientInit.sqf';";
name = "ATragMX";
author = "Ruthberg";
};
};
};
};

View File

@ -0,0 +1,2 @@
#include "ui\defines.h"
#include "ui\display.h"

View File

@ -0,0 +1,32 @@
if (!hasInterface) exitwith{};
if (count (profileNamespace getVariable ["cse_ab_ATragMX_gunList", []]) > 0) then {
cse_ab_ATragMX_gunList = profileNamespace getVariable "cse_ab_ATragMX_gunList";
} else {
// Profile Name, Muzzle Velocity, Zero Range, Scope Base Angle, AirFriction, Bore Height, Scope Unit, Elevation Scope Step, Windage Scope Step, Maximum Elevation, Dialed Elevation, Dialed Windage, Mass, Ammo Class Name, Magazine Class Name, BC, Drag Model, Atmosphere Model
cse_ab_ATragMX_gunList = [["12.7x108mm" , 820, 500, 0.255, -0.0005600, 3.81, 0, 0.338, 0.338, 120, 0, 0, 48.28, "B_127x108_Ball" , "5Rnd_127x108_Mag" , 0.700, 1, "ASM" ],
["12.7x99mm" , 880, 500, 0.202, -0.0005600, 3.81, 0, 0.338, 0.338, 120, 0, 0, 41.92, "B_127x99_Ball" , "5Rnd_mas_127x99_Stanag" , 0.670, 1, "ASM" ],
["10.4x77mm" , 910, 500, 0.200, -0.0004800, 3.81, 0, 0.338, 0.338, 120, 0, 0, 27.15, "B_408_Ball" , "7Rnd_408_Mag" , 0.970, 1, "ASM" ],
["7.62x51mm" , 850, 500, 0.280, -0.0010000, 3.81, 0, 0.338, 0.338, 120, 0, 0, 9.460, "B_762x51_Ball" , "20Rnd_762x51_Mag" , 0.393, 1, "ICAO"],
["6.5x39mm" , 800, 500, 0.304, -0.0009000, 3.81, 0, 0.338, 0.338, 120, 0, 0, 7.776, "B_65x39_Caseless", "30Rnd_65x39_caseless_mag", 0.263, 1, "ICAO"],
["5.56x45mm" , 920, 500, 0.259, -0.0012000, 3.81, 0, 0.338, 0.338, 120, 0, 0, 4.000, "B_556x45_Ball" , "30Rnd_556x45_Stanag" , 0.304, 1, "ASM" ],
["5.56x45mm Mk262" , 850, 500, 0.294, -0.0011250, 3.81, 0, 0.338, 0.338, 120, 0, 0, 4.990, "RH_556x45_Mk262" , "RH_30Rnd_556x45_Mk262" , 0.361, 1, "ASM" ]];
profileNamespace setVariable ["cse_ab_ATragMX_gunList", cse_ab_ATragMX_gunList];
};
call compile preprocessFile ("cse\cse_sys_ballistics\atragmx\init.sqf");
//call compile preprocessFile ("\atragmx\fnc_sord.sqf");
[] spawn {
waituntil {!isnil "cse_gui"};
// TODO seperate config entry for this, outside module space.
["cse_sys_ballistics_ATragMX_open", (["cse_sys_ballistics_ATragMX_open","menu",[197, 0,0,0]] call cse_fnc_getKeyBindingFromProfile_F), { _this call cse_ab_ATragMX_fnc_create_dialog; }, 0] call cse_fnc_addKeyBindingForMenu_F;
["cse_sys_ballistics_ATragMX_open","menu", "Open ATragMX", "Opens the ATragMX dialog"] call cse_fnc_settingsDefineDetails_F;
_entries = [
["ATragMX", {([player, 'cse_ab_ATragMX'] call cse_fnc_hasItem_CC)}, "cse\cse_sys_ballistics\atragmx\data\ATRAG_Icon.paa", { closeDialog 0; call cse_ab_ATragMX_fnc_create_dialog; }, "Use ATragMX"]
];
["ActionMenu", "equipment", _entries] call cse_fnc_addMultipleEntriesToRadialCategory_F;
};

View File

@ -0,0 +1,35 @@
#define ST_LEFT 0
#define ST_RIGHT 1
#define ST_CENTER 2
class CfgPatches
{
class cse_ab_atragmx
{
units[]={};
weapons[]= {"cse_ab_ATragMX"};
requiredVersion=1.26;
requiredAddons[]= {"cse_f_modules", "cse_main", "cse_f_configuration"};
version="1.0";
author[]= {"Ruthberg"};
};
};
class CfgAddons
{
class PreloadAddons
{
class cse_ab_atragmx
{
list[]=
{
"cse_ab_atragmx"
};
};
};
};
#include "Combat_Space_Enhancement.h"
#include "CfgFunctions.h"
#include "CfgWeapons.h"
#include "CfgVehicles.h"
#include "UI.h"

Binary file not shown.

View File

@ -0,0 +1,14 @@
#include "script_component.hpp"
private ["_gunName", "_gunProfileEntry"];
_gunName = ctrlText 11001;
if (_gunName != "") then {
_gunProfileEntry = [_gunName, 850, 500, 0.280, -0.0010000, 3.81, 0, 0.338, 0.338, 120, 0, 0, 9.460, "", "", 0.393, 1, "ICAO"];
cse_ab_ATragMX_gunList = cse_ab_ATragMX_gunList + [_gunProfileEntry];
lbAdd [6000, _gunProfileEntry select 0];
profileNamespace setVariable ["cse_ab_ATragMX_gunList", cse_ab_ATragMX_gunList];
};

View File

@ -0,0 +1,48 @@
#include "script_component.hpp"
call cse_ab_ATragMX_fnc_parse_input;
private ["_scopeBaseAngle"];
_scopeBaseAngle = ((cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 3);
private ["_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel"];
_bulletMass = (cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 12;
_boreHeight = (cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 5;
_airFriction = (cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 4;
_muzzleVelocity = (cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 1;
_bc = (cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 15;
_dragModel = (cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 16;
_atmosphereModel = (cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 17;
private ["_temperature", "_barometricPressure", "_relativeHumidity"];
_temperature = (cse_ab_ATragMX_temperature select cse_ab_ATragMX_currentTarget);
_barometricPressure = (cse_ab_ATragMX_barometricPressure select cse_ab_ATragMX_currentTarget);
_relativeHumidity = (cse_ab_ATragMX_relativeHumidity select cse_ab_ATragMX_currentTarget);
if (cse_ab_ATragMX_currentUnit == 1) then
{
_temperature = (_temperature - 32) / 1.8;
_barometricPressure = _barometricPressure * 33.8638866667;
};
private ["_windSpeed", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange"];
_windSpeed = (cse_ab_ATragMX_windSpeed select cse_ab_ATragMX_currentTarget);
_windDirection = (cse_ab_ATragMX_windDirection select cse_ab_ATragMX_currentTarget);
_inclinationAngle = (cse_ab_ATragMX_inclinationAngle select cse_ab_ATragMX_currentTarget);
_targetSpeed = (cse_ab_ATragMX_targetSpeed select cse_ab_ATragMX_currentTarget);
_targetRange = cse_ab_ATragMX_rangeCardEndRange;
if (cse_ab_ATragMX_currentUnit != 2) then
{
_targetRange = _targetRange / 1.0936133;
};
if (cse_ab_ATragMX_currentUnit == 1) then
{
_windSpeed = _windSpeed / 2.23693629;
_targetSpeed = _targetSpeed / 2.23693629;
};
cse_ab_ATragMX_rangeCardData = [];
private ["_result"];
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000,
_windSpeed, _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, true] call cse_ab_ATragMX_fnc_calculate_solution;

View File

@ -0,0 +1,20 @@
#include "script_component.hpp"
private ["_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_zeroRange"];
_bulletMass = _this select 0;
_boreHeight = _this select 1;
_airFriction = _this select 2;
_muzzleVelocity = _this select 3;
_zeroRange = _this select 4;
private ["_scopeBaseAngle"];
_scopeBaseAngle = 0;
private ["_temperature", "_barometricPressure", "_relativeHumidity"];
_temperature = 15;
_barometricPressure = 1013.25;
_relativeHumidity = 0;
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, 0, 0, 0, 0, _zeroRange, _airFriction, 1, "ICAO", false] call cse_ab_ATragMX_fnc_calculate_solution;
_scopeBaseAngle + (_result select 0) / 60

View File

@ -0,0 +1,123 @@
#include "script_component.hpp"
private ["_scopeBaseAngle", "_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_temperature", "_barometricPressure", "_relativeHumidity", "_simSteps", "_windSpeed", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange", "_bc", "_dragModel", "_atmosphereModel", "_storeRangeCardData"];
_scopeBaseAngle = _this select 0;
_bulletMass = _this select 1;
_boreHeight = _this select 2;
_airFriction = _this select 3;
_muzzleVelocity = _this select 4;
_temperature = _this select 5;
_barometricPressure = _this select 6;
_relativeHumidity = _this select 7;
_simSteps = _this select 8;
_windSpeed = _this select 9;
_windDirection = _this select 10;
_inclinationAngle = _this select 11;
_targetSpeed = _this select 12;
_targetRange = _this select 13;
_bc = _this select 14;
_dragModel = _this select 15;
_atmosphereModel = _this select 16;
_storeRangeCardData = _this select 17;
private ["_bulletPos", "_bulletVelocity", "_bulletAccel", "_gravity", "_deltaT"];
_bulletPos = [0, 0, 0];
_bulletVelocity = [0, 0, 0];
_bulletAccel = [0, 0, 0];
_gravity = [0, sin(_scopeBaseAngle + _inclinationAngle) * -9.80665, cos(_scopeBaseAngle + _inclinationAngle) * -9.80665];
_deltaT = 1 / _simSteps;
private ["_elevation", "_windage", "_lead", "_TOF", "_bulletSpeed", "_kineticEnergy"];
_elevation = 0;
_windage = 0;
_lead = 0;
_TOF = 0;
_bulletSpeed = 0;
private ["_n", "_range", "_rangeFactor"];
_n = 0;
_range = 0;
_rangeFactor = 1;
if (_storeRangeCardData) then {
if (cse_ab_ATragMX_currentUnit != 2) then {
_rangeFactor = 1.0936133;
};
cse_ab_ATragMX_rangeCardData = [];
};
private ["_wind"];
if (["cse_AB_moduleAdvancedBallistics"] call cse_fnc_isModuleEnabled_F) then {
_wind = [cos(270 - _windDirection * 30) * _windSpeed, sin(270 - _windDirection * 30) * _windSpeed, 0];
if (cse_AB_AdvancedAirDragEnabled) then {
_bc = [_bc, _temperature, _barometricPressure, _relativeHumidity, _atmosphereModel] call cse_ab_ballistics_fnc_calculate_Atmospheric_Correction;
};
};
_TOF = 0;
_bulletPos set [0, 0];
_bulletPos set [1, 0];
_bulletPos set [2, -(_boreHeight / 100)];
_bulletVelocity set [0, 0];
_bulletVelocity set [1, Cos(_scopeBaseAngle) * _muzzleVelocity];
_bulletVelocity set [2, Sin(_scopeBaseAngle) * _muzzleVelocity];
while {_TOF < 15 && (_bulletPos select 1) < _targetRange} do
{
_bulletSpeed = vectorMagnitude _bulletVelocity;
if (["cse_AB_moduleAdvancedBallistics"] call cse_fnc_isModuleEnabled_F) then {
private ["_trueVelocity", "_trueSpeed", "_drag"];
_trueVelocity = _bulletVelocity vectorDiff _wind;
_trueSpeed = vectorMagnitude _trueVelocity;
if (cse_AB_AdvancedAirDragEnabled) then {
_drag = -1 * ([_dragModel, _bc, _trueSpeed] call cse_ab_ballistics_fnc_calculate_Retardation);
} else {
_bulletAccel = _trueVelocity vectorMultiply (_trueSpeed * _airFriction);
};
_bulletAccel = (vectorNormalized _trueVelocity) vectorMultiply (_drag);
} else {
_bulletAccel = _bulletVelocity vectorMultiply (_bulletSpeed * _airFriction);
};
_bulletAccel = _bulletAccel vectorAdd _gravity;
_bulletVelocity = _bulletVelocity vectorAdd (_bulletAccel vectorMultiply _deltaT);
_bulletPos = _bulletPos vectorAdd (_bulletVelocity vectorMultiply _deltaT);
_TOF = _TOF + _deltaT;
if (_storeRangeCardData) then {
_range = cse_ab_ATragMX_rangeCardStartRange + _n * cse_ab_ATragMX_rangeCardIncrement;
if ((_bulletPos select 1) * _rangeFactor >= _range && _range <= cse_ab_ATragMX_rangeCardEndRange) then {
if ((_bulletPos select 1) > 0) then {
_elevation = - atan((_bulletPos select 2) / (_bulletPos select 1));
_windage = - atan((_bulletPos select 0) / (_bulletPos select 1));
};
if (_range != 0) then {
_lead = (_targetSpeed * _TOF) / (Tan(3.38 / 60) * _range);
};
_kineticEnergy = 0.5 * (_bulletMass / 1000 * (_bulletSpeed ^ 2));
_kineticEnergy = _kineticEnergy * 0.737562149;
cse_ab_ATragMX_rangeCardData set [_n, [_range, _elevation * 60, _windage * 60, _lead, _TOF, _bulletSpeed, _kineticEnergy]];
_n = _n + 1;
};
};
};
if ((_bulletPos select 1) > 0) then {
_elevation = - atan((_bulletPos select 2) / (_bulletPos select 1));
_windage = - atan((_bulletPos select 0) / (_bulletPos select 1));
};
if (_targetRange != 0) then {
_lead = (_targetSpeed * _TOF) / (Tan(3.38 / 60) * _targetRange);
};
_kineticEnergy = 0.5 * (_bulletMass / 1000 * (_bulletSpeed ^ 2));
_kineticEnergy = _kineticEnergy * 0.737562149;
[_elevation * 60, _windage * 60, _lead, _TOF, _bulletSpeed, _kineticEnergy]

View File

@ -0,0 +1,105 @@
#include "script_component.hpp"
private ["_targetSize", "_imageSize", "_angle", "_estRange"];
_angle = parseNumber(ctrlText 7012);
_targetSize = parseNumber(ctrlText 7010);
if (cse_ab_ATragMX_rangeAssistUseTargetHeight) then
{
_targetSize = _targetSize * cos(_angle);
};
switch (cse_ab_ATragMX_rangeAssistTargetSizeUnit) do
{
case 0:
{
_targetSize = _targetSize * 0.0254;
};
case 1:
{
_targetSize = _targetSize * 0.3048;
};
case 2:
{
_targetSize = _targetSize * 0.01;
};
};
_imageSize = parseNumber(ctrlText 7011);
switch (cse_ab_ATragMX_rangeAssistImageSizeUnit) do
{
case 0:
{
_imageSize = _imageSize / 6400 * 360;
};
case 1:
{
_imageSize = _imageSize / 60;
};
case 2:
{
_imageSize = _imageSize / 60 / 1.047;
};
};
_estRange = parseNumber(ctrlText 7013);
if (cse_ab_ATragMX_currentUnit != 2) then
{
_estRange = _estRange / 1.0936133;
};
switch (_this) do
{
case 0:
{
_targetSize = tan(_imageSize) * _estRange;
if (cse_ab_ATragMX_rangeAssistUseTargetHeight) then
{
_targetSize = _targetSize / cos(_angle);
};
switch (cse_ab_ATragMX_rangeAssistTargetSizeUnit) do
{
case 0:
{
_targetSize = _targetSize / 0.0254;
};
case 1:
{
_targetSize = _targetSize / 0.3048;
};
case 2:
{
_targetSize = _targetSize / 0.01;
};
};
ctrlSetText [7010, Str(Round(_targetSize * 100) / 100)];
};
case 1:
{
_imageSize = atan(_targetSize / _estRange);
switch (cse_ab_ATragMX_rangeAssistImageSizeUnit) do
{
case 0:
{
_imageSize = _imageSize * 6400 / 360;
};
case 1:
{
_imageSize = _imageSize * 60;
};
case 2:
{
_imageSize = _imageSize * 60 * 1.047;
};
};
ctrlSetText [7011, Str(Round(_imageSize * 100) / 100)];
};
case 2:
{
_estRange = _targetSize / tan(_imageSize);
ctrlSetText [7013, Str(Round(_estRange))];
};
};

View File

@ -0,0 +1,52 @@
#include "script_component.hpp"
call cse_ab_ATragMX_fnc_parse_input;
private ["_scopeBaseAngle"];
_scopeBaseAngle = ((cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 3);
private ["_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel"];
_bulletMass = (cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 12;
_boreHeight = (cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 5;
_airFriction = (cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 4;
_muzzleVelocity = (cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 1;
_bc = (cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 15;
_dragModel = (cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 16;
_atmosphereModel = (cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 17;
private ["_temperature", "_barometricPressure", "_relativeHumidity"];
_temperature = (cse_ab_ATragMX_temperature select cse_ab_ATragMX_currentTarget);
_barometricPressure = (cse_ab_ATragMX_barometricPressure select cse_ab_ATragMX_currentTarget);
_relativeHumidity = (cse_ab_ATragMX_relativeHumidity select cse_ab_ATragMX_currentTarget);
if (cse_ab_ATragMX_currentUnit == 1) then
{
_temperature = (_temperature - 32) / 1.8;
_barometricPressure = _barometricPressure * 33.8638866667;
};
private ["_windSpeed", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange"];
_windSpeed = (cse_ab_ATragMX_windSpeed select cse_ab_ATragMX_currentTarget);
_windDirection = (cse_ab_ATragMX_windDirection select cse_ab_ATragMX_currentTarget);
_inclinationAngle = (cse_ab_ATragMX_inclinationAngle select cse_ab_ATragMX_currentTarget);
_targetSpeed = (cse_ab_ATragMX_targetSpeed select cse_ab_ATragMX_currentTarget);
_targetRange = (cse_ab_ATragMX_targetRange select cse_ab_ATragMX_currentTarget);
if (cse_ab_ATragMX_currentUnit != 2) then
{
_targetRange = _targetRange / 1.0936133;
};
if (cse_ab_ATragMX_currentUnit == 1) then
{
_windSpeed = _windSpeed / 2.23693629;
_targetSpeed = _targetSpeed / 2.23693629;
};
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000,
_windSpeed, _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, false] call cse_ab_ATragMX_fnc_calculate_solution;
cse_ab_ATragMX_elevationOutput set [cse_ab_ATragMX_currentTarget, _result select 0];
cse_ab_ATragMX_windageOutput set [cse_ab_ATragMX_currentTarget, _result select 1];
cse_ab_ATragMX_leadOutput set [cse_ab_ATragMX_currentTarget, _result select 2];
cse_ab_ATragMX_tofOutput set [cse_ab_ATragMX_currentTarget, _result select 3];
cse_ab_ATragMX_velocityOutput set [cse_ab_ATragMX_currentTarget, _result select 4];
call cse_ab_ATragMX_fnc_update_result;

View File

@ -0,0 +1,41 @@
#include "script_component.hpp"
private ["_targetRange", "_numTicks", "_timeSecs", "_estSpeed"];
_targetRange = parseNumber(ctrlText 8004);
_numTicks = parseNumber(ctrlText 8005);
_timeSecs = parseNumber(ctrlText 8006);
_estSpeed = 0;
if (cse_ab_ATragMX_currentUnit != 2) then
{
_targetRange = _targetRange / 1.0936133;
};
switch (cse_ab_ATragMX_rangeAssistImageSizeUnit) do
{
case 0:
{
_numTicks = _numTicks / 6400 * 360;
};
case 1:
{
_numTicks = _numTicks / 60;
};
case 2:
{
_numTicks = _numTicks / 60 / 1.047;
};
};
if (_timeSecs > 0) then
{
_estSpeed = tan(_numTicks) * _targetRange / _timeSecs;
};
if (cse_ab_ATragMX_currentUnit == 1) then
{
_estSpeed = _estSpeed * 2.23693629;
};
ctrlSetText [8007, Str(Round(_estSpeed * 10) / 10)];

View File

@ -0,0 +1,23 @@
#include "script_component.hpp"
if (_this < 0 || _this > (count cse_ab_ATragMX_gunList) - 1) exitWith {};
cse_ab_ATragMX_workingMemory set [cse_ab_ATragMX_currentTarget, +(cse_ab_ATragMX_gunList select _this)];
cse_ab_ATragMX_currentGun set [cse_ab_ATragMX_currentTarget, _this];
lbSetCurSel [6000, (cse_ab_ATragMX_currentGun select cse_ab_ATragMX_currentTarget)];
if ((cse_ab_ATragMX_scopeUnits select (cse_ab_ATragMX_currentScopeUnit select cse_ab_ATragMX_currentTarget)) != "Clicks") then
{
cse_ab_ATragMX_currentScopeUnit set [cse_ab_ATragMX_currentTarget, (cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 6];
};
call cse_ab_ATragMX_fnc_update_gun;
cse_ab_ATragMX_elevationOutput set [cse_ab_ATragMX_currentTarget, 0];
cse_ab_ATragMX_windageOutput set [cse_ab_ATragMX_currentTarget, 0];
cse_ab_ATragMX_leadOutput set [cse_ab_ATragMX_currentTarget, 0];
cse_ab_ATragMX_tofOutput set [cse_ab_ATragMX_currentTarget, 0];
cse_ab_ATragMX_velocityOutput set [cse_ab_ATragMX_currentTarget, 0];
call cse_ab_ATragMX_fnc_update_result;

View File

@ -0,0 +1,24 @@
#include "script_component.hpp"
if (underwater player) exitWith { false };
if (!([player, "cse_ab_ATragMX"] call cse_fnc_hasItem_CC)) exitWith { false };
execVM "cse\cse_sys_ballistics\atragmx\functions\fn_update_target_selection.sqf";
createDialog 'cse_ab_ATragMX_Display';
true execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_main_page.sqf";
false execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_add_new_gun.sqf";
false execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_gun_list.sqf";
false execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_range_card.sqf";
false execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_range_card_setup.sqf";
false execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_target_range_assist.sqf";
false execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_target_speed_assist.sqf";
false execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_target_speed_assist_timer.sqf";
{
lbAdd [6000, _x select 0];
} forEach cse_ab_ATragMX_gunList;
true

View File

@ -0,0 +1,7 @@
#include "script_component.hpp"
cse_ab_ATragMX_rangeCardCurrentColumn = (cse_ab_ATragMX_rangeCardCurrentColumn + 1) % (count cse_ab_ATragMX_rangeCardLastColumns);
ctrlSetText [5006, (cse_ab_ATragMX_rangeCardLastColumns select cse_ab_ATragMX_rangeCardCurrentColumn)];
call cse_ab_ATragMX_fnc_update_range_card;

View File

@ -0,0 +1,8 @@
#include "script_component.hpp"
call cse_ab_ATragMX_fnc_parse_input;
cse_ab_ATragMX_currentScopeUnit set [cse_ab_ATragMX_currentTarget, ((cse_ab_ATragMX_currentScopeUnit select cse_ab_ATragMX_currentTarget) + 1) % (count cse_ab_ATragMX_scopeUnits)];
call cse_ab_ATragMX_fnc_update_scope_unit;
call cse_ab_ATragMX_fnc_update_result;

View File

@ -0,0 +1,19 @@
#include "script_component.hpp"
private ["_index"];
_index = lbCurSel 6000;
if (_index == -1) exitWith {};
for "_i" from 0 to (count cse_ab_ATragMX_currentGun) - 1 do {
if ((cse_ab_ATragMX_currentGun select _i) > _index) then {
cse_ab_ATragMX_currentGun set [_i, (cse_ab_ATragMX_currentGun select _i) - 1];
};
};
cse_ab_ATragMX_gunList set [_index, 0];
cse_ab_ATragMX_gunList = cse_ab_ATragMX_gunList - [0];
lbDelete [6000, _index];
profileNamespace setVariable ["cse_ab_ATragMX_gunList", cse_ab_ATragMX_gunList];

View File

@ -0,0 +1,74 @@
#include "script_component.hpp"
cse_ab_ATragMX_temperature set [cse_ab_ATragMX_currentTarget, parseNumber(ctrlText 200)];
cse_ab_ATragMX_barometricPressure set [cse_ab_ATragMX_currentTarget, 0 max parseNumber(ctrlText 210)];
cse_ab_ATragMX_relativeHumidity set [cse_ab_ATragMX_currentTarget, (0 max parseNumber(ctrlText 220) min 100) / 100];
cse_ab_ATragMX_windSpeed set [cse_ab_ATragMX_currentTarget, 0 max abs(parseNumber(ctrlText 300)) min 50];
cse_ab_ATragMX_windDirection set [cse_ab_ATragMX_currentTarget, 1 max Round(parseNumber(ctrlText 310)) min 12];
cse_ab_ATragMX_inclinationAngle set [cse_ab_ATragMX_currentTarget, -60 max parseNumber(ctrlText 320) min 60];
cse_ab_ATragMX_targetSpeed set [cse_ab_ATragMX_currentTarget, 0 max abs(parseNumber(ctrlText 330)) min 50];
cse_ab_ATragMX_targetRange set [cse_ab_ATragMX_currentTarget, 0 max abs(parseNumber(ctrlText 340)) min 4000];
private ["_boreHeight", "_bulletMass", "_airFriction", "_muzzleVelocity"];
_boreHeight = parseNumber(ctrlText 100);
_bulletMass = parseNumber(ctrlText 110);
if ((["cse_AB_moduleAdvancedBallistics"] call cse_fnc_isModuleEnabled_F) && cse_AB_AdvancedAirDragEnabled) then {
_airFriction = 0.1 max parseNumber(ctrlText 120) min 2;
} else {
_airFriction = parseNumber(ctrlText 120) / -1000;
};
_muzzleVelocity = parseNumber(ctrlText 130);
if (cse_ab_ATragMX_currentUnit == 1) then
{
_boreHeight = _boreHeight * 2.54;
_bulletMass = _bulletMass * 0.06479891;
_muzzleVelocity = _muzzleVelocity / 3.2808399;
};
_boreHeight = 0.1 max _boreHeight min 10;
_bulletMass = 1 max _bulletMass min 100;
_muzzleVelocity = 100 max _muzzleVelocity min 1400;
(cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) set [5, _boreHeight];
(cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) set [12, _bulletMass];
if ((["cse_AB_moduleAdvancedBallistics"] call cse_fnc_isModuleEnabled_F) && cse_AB_AdvancedAirDragEnabled) then {
(cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) set [15, _airFriction];
} else {
(cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) set [4, _airFriction];
};
(cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) set [1, _muzzleVelocity];
private ["_elevationCur", "_elevationCur", "_elevationScopeStep", "_windageScopeStep"];
_elevationCur = parseNumber(ctrlText 402);
_windageCur = parseNumber(ctrlText 412);
switch ((cse_ab_ATragMX_currentScopeUnit select cse_ab_ATragMX_currentTarget)) do
{
case 0:
{
_elevationCur = _elevationCur * 3.38;
_windageCur = _windageCur * 3.38;
};
case 2:
{
_elevationCur = _elevationCur / 1.047;
_windageCur = _windageCur / 1.047;
};
case 3:
{
_elevationScopeStep = ((cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 7);
_windageScopeStep = ((cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 8);
_elevationCur = _elevationCur * _elevationScopeStep;
_windageCur = _windageCur * _windageScopeStep;
};
};
(cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) set [10, _elevationCur];
(cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) set [11, _windageCur];
call cse_ab_ATragMX_fnc_update_gun;
call cse_ab_ATragMX_fnc_update_atmosphere;
call cse_ab_ATragMX_fnc_update_target;

View File

@ -0,0 +1,6 @@
#include "script_component.hpp"
(cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) set [10, 0];
(cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) set [11, 0];
call cse_ab_ATragMX_fnc_update_result;

View File

@ -0,0 +1,13 @@
#include "script_component.hpp"
private ["_index"];
_index = 0 max (lbCurSel 6000);
cse_ab_ATragMX_gunList set [_index, +(cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget)];
lbClear 6000;
{
lbAdd [6000, _x select 0];
} forEach cse_ab_ATragMX_gunList;
profileNamespace setVariable ["cse_ab_ATragMX_gunList", cse_ab_ATragMX_gunList];

View File

@ -0,0 +1,3 @@
#include "script_component.hpp"
{ctrlShow [_x, _this]} forEach [11000, 11001, 11002, 11003];

View File

@ -0,0 +1,3 @@
#include "script_component.hpp"
{ctrlShow [_x, _this]} forEach [6000, 6001, 6002, 6003, 6004, 6005, 6006, 6007];

View File

@ -0,0 +1,4 @@
#include "script_component.hpp"
{ctrlShow [_x, _this]} forEach [10, 100, 11, 110, 12, 120, 13, 130, 14, 140, 20, 200, 21, 210, 22, 220, 30, 300, 31, 310, 32, 320, 33, 330, 34, 340, 40, 400, 401, 402, 403, 41, 410, 411, 412, 42, 420,
500, 501, 502, 503, 600, 601, 602, 603, 1000, 2000, 3000, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008];

View File

@ -0,0 +1,3 @@
#include "script_component.hpp"
{ctrlShow [_x, _this]} forEach [5000, 5001, 5002, 5003, 5004, 5005, 5006, 5007];

View File

@ -0,0 +1,3 @@
#include "script_component.hpp"
{ctrlShow [_x, _this]} forEach [10000, 10001, 10002, 10003, 10004, 10005, 10006, 10007, 10008, 10009];

View File

@ -0,0 +1,3 @@
#include "script_component.hpp"
{ctrlShow [_x, _this]} forEach [7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010, 7011, 7012, 7013, 7014, 7015, 7016, 7017, 7018, 7019, 7020];

View File

@ -0,0 +1,3 @@
#include "script_component.hpp"
{ctrlShow [_x, _this]} forEach [8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009, 8010, 8011, 8012, 8013, 8014, 8015];

View File

@ -0,0 +1,3 @@
#include "script_component.hpp"
{ctrlShow [_x, _this]} forEach [9000, 9001, 9002];

View File

@ -0,0 +1,22 @@
#include "script_component.hpp"
cse_ab_ATragMX_COMPAT_LRF = ["Rangefinder", "Laserdesignator"];
private ["_fnc_atragmx"];
_fnc_atragmx = {
private ["_target", "_position", "_range", "_inclinationAngle"];
if ((local player) && (currentWeapon player) in cse_ab_ATragMX_COMPAT_LRF && (!isNull (_this select 0))) then {
_target = getPosATL (_this select 0);
_position = getPosATL player;
_inclinationAngle = asin((player weaponDirection currentWeapon player) select 2);
_range = _position distance _target;
cse_ab_ATragMX_inclinationAngle set [cse_ab_ATragMX_currentTarget, _inclinationAngle];
cse_ab_ATragMX_targetRange set [cse_ab_ATragMX_currentTarget, _range];
};
};
//["ace_sys_rangefinder_Lazing", _fnc_atragmx] call CBA_fnc_addEventHandler;

View File

@ -0,0 +1,30 @@
#include "script_component.hpp"
#define _dsp (uiNamespace getVariable "cse_ab_ATragMX_Display")
if !(ctrlVisible 9000) then
{
private ["_startTime"];
false execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_target_speed_assist.sqf";
true execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_target_speed_assist_timer.sqf";
ctrlSetFocus (_dsp displayCtrl 9002);
_startTime = time;
while {cse_ab_ATragMX_speedAssistTimer} do
{
sleep 0.1;
ctrlSetText [9001, Str(Round((time - _startTime) * 10) / 10)];
};
cse_ab_ATragMX_speedAssistTimer = true;
ctrlSetText [8006, Str(Round((time - _startTime) * 10) / 10)];
call cse_ab_ATragMX_fnc_calculate_target_speed_assist;
false execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_target_speed_assist_timer.sqf";
true execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_target_speed_assist.sqf";
};

View File

@ -0,0 +1,21 @@
#include "script_component.hpp"
#define _dsp (uiNamespace getVariable "cse_ab_ATragMX_Display")
if (ctrlVisible 6000) then
{
false execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_gun_list.sqf";
true execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_main_page.sqf";
if (_this) then {
(lbCurSel 6000) call cse_ab_ATragMX_fnc_change_gun;
};
} else
{
false execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_main_page.sqf";
true execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_gun_list.sqf";
ctrlSetFocus (_dsp displayCtrl 6002);
lbSetCurSel [6000, (cse_ab_ATragMX_currentGun select cse_ab_ATragMX_currentTarget)];
};

View File

@ -0,0 +1,18 @@
#include "script_component.hpp"
#define _dsp (uiNamespace getVariable "cse_ab_ATragMX_Display")
if (ctrlVisible 5006) then
{
false execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_range_card.sqf";
true execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_main_page.sqf";
} else
{
false execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_main_page.sqf";
true execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_range_card.sqf";
ctrlSetFocus (_dsp displayCtrl 5001);
call cse_ab_ATragMX_fnc_calculate_range_card;
call cse_ab_ATragMX_fnc_update_range_card;
};

View File

@ -0,0 +1,29 @@
#include "script_component.hpp"
#define _dsp (uiNamespace getVariable "cse_ab_ATragMX_Display")
if (ctrlVisible 10000) then
{
false execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_range_card_setup.sqf";
true execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_range_card.sqf";
if (_this == 1) then
{
cse_ab_ATragMX_rangeCardStartRange = 0 max Round(parseNumber(ctrlText 10003)) min 3000;
cse_ab_ATragMX_rangeCardEndRange = 0 max Round(parseNumber(ctrlText 10004)) min 3000;
cse_ab_ATragMX_rangeCardIncrement = 1 max Round(parseNumber(ctrlText 10005)) min 3000;
call cse_ab_ATragMX_fnc_calculate_range_card;
call cse_ab_ATragMX_fnc_update_range_card;
};
} else
{
false execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_range_card.sqf";
true execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_range_card_setup.sqf";
ctrlSetFocus (_dsp displayCtrl 10006);
ctrlSetText [10003, Str(Round(cse_ab_ATragMX_rangeCardStartRange))];
ctrlSetText [10004, Str(Round(cse_ab_ATragMX_rangeCardEndRange))];
ctrlSetText [10005, Str(Round(cse_ab_ATragMX_rangeCardIncrement))];
};

View File

@ -0,0 +1,32 @@
#include "script_component.hpp"
#define _dsp (uiNamespace getVariable "cse_ab_ATragMX_Display")
if (ctrlVisible 7000) then
{
false execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_target_range_assist.sqf";
true execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_main_page.sqf";
if (_this == 1) then
{
ctrlSetText [320, Str(parseNumber(ctrlText 7012))];
ctrlSetText [340, Str(parseNumber(ctrlText 7013))];
};
} else
{
false execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_main_page.sqf";
true execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_target_range_assist.sqf";
ctrlSetFocus (_dsp displayCtrl 7018);
ctrlSetText [7012, Str(parseNumber(ctrlText 320))];
ctrlSetText [7013, Str(parseNumber(ctrlText 340))];
if (cse_ab_ATragMX_currentUnit != 2) then
{
ctrlSetText [7016, "Yards"];
} else
{
ctrlSetText [7016, "Meters"];
};
};

View File

@ -0,0 +1,39 @@
#include "script_component.hpp"
#define _dsp (uiNamespace getVariable "cse_ab_ATragMX_Display")
if (ctrlVisible 8000) then
{
false execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_target_speed_assist.sqf";
true execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_main_page.sqf";
if (_this == 1) then
{
call cse_ab_ATragMX_fnc_calculate_target_speed_assist;
ctrlSetText [330, Str(parseNumber(ctrlText 8007))];
};
} else
{
false execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_main_page.sqf";
true execVM "cse\cse_sys_ballistics\atragmx\functions\fn_show_target_speed_assist.sqf";
ctrlSetFocus (_dsp displayCtrl 8012);
ctrlSetText [8004, Str(Round((cse_ab_ATragMX_targetRange select cse_ab_ATragMX_currentTarget)))];
if (cse_ab_ATragMX_currentUnit != 2) then
{
ctrlSetText [8008, "Yards"];
} else
{
ctrlSetText [8008, "Meters"];
};
if (cse_ab_ATragMX_currentUnit != 1) then
{
ctrlSetText [8011, "m/s"];
} else
{
ctrlSetText [8011, "mph"];
};
};

View File

@ -0,0 +1,9 @@
#include "script_component.hpp"
ctrlSetText [200, Str(Round((cse_ab_ATragMX_temperature select cse_ab_ATragMX_currentTarget) * 10) / 10)];
if (cse_ab_ATragMX_currentUnit == 1) then {
ctrlSetText [210, Str(Round((cse_ab_ATragMX_barometricPressure select cse_ab_ATragMX_currentTarget) * 100) / 100)];
} else {
ctrlSetText [210, Str(Round(cse_ab_ATragMX_barometricPressure select cse_ab_ATragMX_currentTarget))];
};
ctrlSetText [220, Str(Round((cse_ab_ATragMX_relativeHumidity select cse_ab_ATragMX_currentTarget) * 100 * 10) / 10)];

View File

@ -0,0 +1,38 @@
#include "script_component.hpp"
ctrlSetText [1000, (cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 0];
if (cse_ab_ATragMX_currentUnit == 1) then
{
ctrlSetText [ 100, Str(Round(((cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 5) / 2.54 * 100) / 100)];
} else
{
ctrlSetText [ 100, Str(Round(((cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 5) * 100) / 100)];
};
if (cse_ab_ATragMX_currentUnit == 1) then
{
ctrlSetText [ 110, Str(Round(((cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 12) * 15.4323584))];
} else
{
ctrlSetText [ 110, Str(Round((cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 12))];
};
if ((["cse_AB_moduleAdvancedBallistics"] call cse_fnc_isModuleEnabled_F) && cse_AB_AdvancedAirDragEnabled) then {
ctrlSetText [ 120, Str(Round(((cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 15) * 1000) / 1000)];
} else {
ctrlSetText [ 120, Str(Round(((cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 4) * -1000 * 1000) / 1000)];
};
if (cse_ab_ATragMX_currentUnit == 1) then
{
ctrlSetText [130, Str(Round(((cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 1) * 3.2808399))];
} else
{
ctrlSetText [130, Str(Round((cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 1))];
};
if (cse_ab_ATragMX_currentUnit == 2) then
{
ctrlSetText [140, Str(Round((cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 2))];
} else
{
ctrlSetText [140, Str(Round(((cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 2) * 1.0936133))];
};
call cse_ab_ATragMX_fnc_update_scope_unit;

View File

@ -0,0 +1,89 @@
#include "script_component.hpp"
private ["_range", "_elevation", "_windage", "_lead", "_TOF", "_velocity", "_kineticEnergy", "_rangeOutput", "_elevationOutput", "_windageOutput", "_lastColumnOutput"];
_lastColumnOutput = "";
ctrlSetText [5006, (cse_ab_ATragMX_rangeCardLastColumns select cse_ab_ATragMX_rangeCardCurrentColumn)];
if (cse_ab_ATragMX_currentUnit != 2) then
{
ctrlSetText [5003, "Yards"];
} else
{
ctrlSetText [5003, "Meters"];
};
lnbClear 5007;
{
_range = _x select 0;
_elevation = _x select 1;
_windage = _x select 2;
_lead = _x select 3;
_TOF = _x select 4;
_velocity = _x select 5;
_kineticEnergy = _x select 6;
switch ((cse_ab_ATragMX_currentScopeUnit select cse_ab_ATragMX_currentTarget)) do
{
case 0:
{
_elevation = _elevation / 3.38;
_windage = _windage / 3.38;
};
case 2:
{
_elevation = _elevation * 1.047;
_windage = _windage * 1.047;
};
case 3:
{
_elevationScopeStep = ((cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 7);
_windageScopeStep = ((cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 8);
_elevation = Round(_elevation / _elevationScopeStep);
_windage = Round(_windage / _windageScopeStep);
};
};
_elevationOutput = Str(Round(_elevation * 100) / 100);
_windageOutput = Str(Round(_windage * 100) / 100);
_rangeOutput = Str(_range);
if (_velocity < 340.29) then
{
_rangeOutput = _rangeOutput + "*";
};
if (cse_ab_ATragMX_currentUnit == 1) then
{
_velocity = _velocity * 3.2808399;
};
switch (cse_ab_ATragMX_rangeCardCurrentColumn) do
{
case 0:
{
_lastColumnOutput = Str(Round(_lead * 100) / 100);
};
case 1:
{
_lastColumnOutput = Str(Round(_velocity));
};
case 2:
{
_lastColumnOutput = Str(Round(_kineticEnergy));
};
case 3:
{
_lastColumnOutput = Str(Round(_TOF * 100) / 100);
}
};
lnbAddRow [5007, [_rangeOutput, _elevationOutput, _windageOutput, _lastColumnOutput]];
} forEach cse_ab_ATragMX_rangeCardData;

View File

@ -0,0 +1,6 @@
#include "script_component.hpp"
(cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) set [10, (cse_ab_ATragMX_elevationOutput select cse_ab_ATragMX_currentTarget)];
(cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) set [11, (cse_ab_ATragMX_windageOutput select cse_ab_ATragMX_currentTarget)];
call cse_ab_ATragMX_fnc_update_result;

View File

@ -0,0 +1,65 @@
#include "script_component.hpp"
private ["_elevationAbs", "_elevationRel", "_elevationCur", "_windageAbs", "_windageRel", "_windageCur", "_lead", "_elevationScopeStep", "_windageScopeStep"];
_elevationAbs = (cse_ab_ATragMX_elevationOutput select cse_ab_ATragMX_currentTarget);
_windageAbs = (cse_ab_ATragMX_windageOutput select cse_ab_ATragMX_currentTarget);
_elevationCur = (cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 10;
_windageCur = (cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 11;
_elevationRel = _elevationAbs - _elevationCur;
_windageRel = _windageAbs - _windageCur;
_lead = (cse_ab_ATragMX_leadOutput select cse_ab_ATragMX_currentTarget);
switch ((cse_ab_ATragMX_currentScopeUnit select cse_ab_ATragMX_currentTarget)) do
{
case 0:
{
_elevationAbs = _elevationAbs / 3.38;
_windageAbs = _windageAbs / 3.38;
_elevationRel = _elevationRel / 3.38;
_windageRel = _windageRel / 3.38;
_elevationCur = _elevationCur / 3.38;
_windageCur = _windageCur / 3.38;
};
case 2:
{
_elevationAbs = _elevationAbs * 1.047;
_windageAbs = _windageAbs * 1.047;
_elevationRel = _elevationRel * 1.047;
_windageRel = _windageRel * 1.047;
_elevationCur = _elevationCur * 1.047;
_windageCur = _windageCur * 1.047;
};
case 3:
{
_elevationScopeStep = ((cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 7);
_windageScopeStep = ((cse_ab_ATragMX_workingMemory select cse_ab_ATragMX_currentTarget) select 8);
_elevationAbs = Round(_elevationAbs / _elevationScopeStep);
_windageAbs = Round(_windageAbs / _windageScopeStep);
_elevationRel = Round(_elevationRel / _elevationScopeStep);
_windageRel = Round(_windageRel / _windageScopeStep);
_elevationCur = Round(_elevationCur / _elevationScopeStep);
_windageCur = Round(_windageCur / _windageScopeStep);
};
};
ctrlSetText [400, Str(Round(_elevationAbs * 100) / 100)];
ctrlSetText [401, Str(Round(_elevationRel * 100) / 100)];
ctrlSetText [402, Str(Round(_elevationCur * 100) / 100)];
ctrlSetText [410, Str(Round(_windageAbs * 100) / 100)];
ctrlSetText [411, Str(Round(_windageRel * 100) / 100)];
ctrlSetText [412, Str(Round(_windageCur * 100) / 100)];
ctrlSetText [420, Str(Round(_lead * 100) / 100)];

View File

@ -0,0 +1,4 @@
#include "script_component.hpp"
ctrlSetText [2000, cse_ab_ATragMX_scopeUnits select (cse_ab_ATragMX_currentScopeUnit select cse_ab_ATragMX_currentTarget)];
ctrlSetText [5000, cse_ab_ATragMX_scopeUnits select (cse_ab_ATragMX_currentScopeUnit select cse_ab_ATragMX_currentTarget)];

View File

@ -0,0 +1,22 @@
#include "script_component.hpp"
if (!isNil ("cse_ab_ATragMX_windSpeed")) then
{
ctrlSetText [300, Str(Round((cse_ab_ATragMX_windSpeed select cse_ab_ATragMX_currentTarget) * 100) / 100)];
};
if (!isNil ("cse_ab_ATragMX_windDirection")) then
{
ctrlSetText [310, Str(Round((cse_ab_ATragMX_windDirection select cse_ab_ATragMX_currentTarget)))];
};
if (!isNil ("cse_ab_ATragMX_inclinationAngle")) then
{
ctrlSetText [320, Str(Round((cse_ab_ATragMX_inclinationAngle select cse_ab_ATragMX_currentTarget)))];
};
if (!isNil ("cse_ab_ATragMX_targetSpeed")) then
{
ctrlSetText [330, Str(Round((cse_ab_ATragMX_targetSpeed select cse_ab_ATragMX_currentTarget) * 100) / 100)];
};
if (!isNil ("cse_ab_ATragMX_targetRange")) then
{
ctrlSetText [340, Str(Round((cse_ab_ATragMX_targetRange select cse_ab_ATragMX_currentTarget)))];
};

View File

@ -0,0 +1,14 @@
#include "script_component.hpp"
#define _dsp (uiNamespace getVariable "cse_ab_ATragMX_Display")
(_dsp displayCtrl 500) ctrlEnable true;
(_dsp displayCtrl 501) ctrlEnable true;
(_dsp displayCtrl 502) ctrlEnable true;
(_dsp displayCtrl 503) ctrlEnable true;
(_dsp displayCtrl 500 + cse_ab_ATragMX_currentTarget) ctrlEnable false;
ctrlSetFocus (_dsp displayCtrl 3000);
call cse_ab_ATragMX_fnc_update_unit_selection;

View File

@ -0,0 +1,14 @@
#include "script_component.hpp"
#define _dsp (uiNamespace getVariable "cse_ab_ATragMX_Display")
(_dsp displayCtrl 600) ctrlEnable true;
(_dsp displayCtrl 601) ctrlEnable true;
(_dsp displayCtrl 602) ctrlEnable true;
(_dsp displayCtrl 600 + cse_ab_ATragMX_currentUnit) ctrlEnable false;
call cse_ab_ATragMX_fnc_update_gun;
call cse_ab_ATragMX_fnc_update_atmosphere;
call cse_ab_ATragMX_fnc_update_target;
call cse_ab_ATragMX_fnc_update_result;

Some files were not shown because too many files have changed in this diff Show More