mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
merge conflict
This commit is contained in:
commit
8c449a454b
22
AUTHORS.txt
22
AUTHORS.txt
@ -26,12 +26,14 @@ Walter Pearce <jaynus@gmail.com>
|
||||
# CONTRIBUTORS
|
||||
11RDP-LoupVert <loupvert@11rdp.fr>
|
||||
[BIG]Bull
|
||||
ACCtomeek
|
||||
ACCtomeek <tomeek99@gmail.com>
|
||||
Adanteh
|
||||
aeroson
|
||||
Aggr094 <bastards4glory@gmail.com>
|
||||
Anthariel <Contact@storm-simulation.com>
|
||||
BlackQwar
|
||||
Brakoviejo
|
||||
Clon1998 <ps.patti1998@gmail.com>
|
||||
Codingboy
|
||||
Crusty
|
||||
eRazeri
|
||||
@ -40,29 +42,43 @@ Falke75
|
||||
Ferenczi
|
||||
Ferenzi
|
||||
Filip Basara <filip.basara93@googlemail.com> (Logo)
|
||||
FreeZbe <freeseb@gmail.com>
|
||||
geraldbolso1899
|
||||
Ghost
|
||||
gienkov
|
||||
GieNkoV <gienkov.grzegorz@gmail.com>
|
||||
gpgpgpgp
|
||||
Grzegorz
|
||||
Hamburger SV
|
||||
Harakhti <shadowdragonphd@gmail.com>
|
||||
havena <silveredenis@gmail.com>
|
||||
Hawkins
|
||||
jokoho48
|
||||
Jonpas <jonpas33@gmail.com>
|
||||
Kllrt <kllrtik@gmail.com>
|
||||
Legolasindar "Viper" <legolasindar@gmail.com>
|
||||
licht-im-Norden87
|
||||
licht-im-Norden87 <lichtimnorden87@gmail.com>
|
||||
MarcBook
|
||||
meat <p.humberdroz@gmail.com>
|
||||
Michail Nikolaev
|
||||
nic547 <nic547@outlook.com>
|
||||
nomisum <nomisum@gmail.com>
|
||||
oscarmolinadev
|
||||
pokertour
|
||||
rakowozz
|
||||
Raspu86
|
||||
Riccardo Petricca <petriccarcc@gmail.com>
|
||||
Robert Boklahánics <bokirobi@gmail.com>
|
||||
ramius86 <pasini86@hotmail.com>
|
||||
simon84
|
||||
Sniperwolf572 <tenga6@gmail.com>
|
||||
Tachi <zaveruha007@gmail.com>
|
||||
Tonic
|
||||
Tourorist <tourorist@gmail.com>
|
||||
Valentin Torikian <valentin.torikian@gmail.com>
|
||||
zGuba
|
||||
Aleksey EpMAK Yermakov <epmak777@gmail.com>
|
||||
ruPaladin <happyworm24@rambler.ru>
|
||||
BlackPixxel
|
||||
Asgar Serran <piechottaf@web.de>
|
||||
Kavinsky <nmunozfernandez@gmail.com>
|
||||
Coren <coren4@gmail.com>
|
||||
|
@ -40,7 +40,7 @@ If you installed ACE3, but have trouble understanding how it all works, or where
|
||||
#### Contributing
|
||||
If you want to help put with the ongoing development, you can do so by looking for possible bugs or by contributing new features. To contribute something to ACE, simply fork this repository and submit your pull requests for review by other collaborators. In the process, please add yourself to the author array of any .pbo you will be editing and the AUTHORS.txt file; including a valid email address.
|
||||
|
||||
To report a bug, propose a feature, or suggest a change to the existing one — please, use our [Issue Tracker](https://github.com/acemod/ACE3/issues).
|
||||
To report a bug, propose a feature, or suggest a change to the existing one — please, use our [Issue Tracker](https://github.com/acemod/ACE3/issues). See [this link](http://ace3mod.com/wiki/user/how-to-report-an-issue.html) for details.
|
||||
|
||||
#### Testing & Building
|
||||
If you want to help us test the latest development changes, feel free to download our master branch, using either git — if familiar with the process — or directly, by following [this link](https://github.com/acemod/ACE3/archive/master.zip).
|
||||
|
BIN
ace_advanced_ballistics.dll
Normal file
BIN
ace_advanced_ballistics.dll
Normal file
Binary file not shown.
BIN
ace_breakLine.dll
Normal file
BIN
ace_breakLine.dll
Normal file
Binary file not shown.
BIN
ace_fcs.dll
BIN
ace_fcs.dll
Binary file not shown.
64
addons/advanced_ballistics/ACE_Settings.hpp
Normal file
64
addons/advanced_ballistics/ACE_Settings.hpp
Normal file
@ -0,0 +1,64 @@
|
||||
class ACE_Settings {
|
||||
class GVAR(enabled) {
|
||||
displayName = "Advanced Ballistics";
|
||||
description = "Enables advanced ballistics";
|
||||
typeName = "BOOL";
|
||||
value = 0;
|
||||
};
|
||||
class GVAR(alwaysSimulateForSnipers) {
|
||||
displayName = "Always Enabled For Snipers";
|
||||
description = "Always enables advanced ballistics when high power optics are used";
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
};
|
||||
class GVAR(disabledInFullAutoMode) {
|
||||
displayName = "Disabled In FullAuto Mode";
|
||||
description = "Disables the advanced ballistics during full auto fire";
|
||||
typeName = "BOOL";
|
||||
value = 0;
|
||||
};
|
||||
class GVAR(onlyActiveForLocalPlayers) {
|
||||
displayName = "Disabled For Non Local Players";
|
||||
description = "Disables the advanced ballistics for bullets coming from other players (enable this if you encounter frame drops during heavy firefights in multiplayer)";
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
};
|
||||
/* // TODO: We currently do not have firedEHs on vehicles
|
||||
class GVAR(vehicleGunnerEnabled) {
|
||||
displayName = "Enabled For Vehicle Gunners";
|
||||
description = "Enables advanced ballistics for vehicle gunners";
|
||||
typeName = "BOOL";
|
||||
value = 0;
|
||||
};
|
||||
*/
|
||||
class GVAR(ammoTemperatureEnabled) {
|
||||
displayName = "Enable Ammo Temperature Simulation";
|
||||
description = "Muzzle velocity varies with ammo temperature";
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
};
|
||||
class GVAR(barrelLengthInfluenceEnabled) {
|
||||
displayName = "Enable Barrel Length Simulation";
|
||||
description = "Muzzle velocity varies with barrel length";
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
};
|
||||
class GVAR(bulletTraceEnabled) {
|
||||
displayName = "Enable Bullet Trace Effect";
|
||||
description = "Enables a bullet trace effect to high caliber bullets (only visible when looking through high power optics)";
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
};
|
||||
class GVAR(simulationInterval) {
|
||||
displayName = "Simulation Interval";
|
||||
description = "Defines the interval between every calculation step";
|
||||
typeName = "SCALAR";
|
||||
value = 0.0;
|
||||
};
|
||||
class GVAR(simulationRadius) {
|
||||
displayName = "Simulation Radius";
|
||||
description = "Defines the radius (in meters) in which advanced ballistics are applied";
|
||||
typeName = "SCALAR";
|
||||
value = 3000;
|
||||
};
|
||||
};
|
19
addons/advanced_ballistics/CfgEventHandlers.hpp
Normal file
19
addons/advanced_ballistics/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,19 @@
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE( call COMPILE_FILE(XEH_preInit) );
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE( call COMPILE_FILE(XEH_postInit) );
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_FiredBIS_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
firedBIS = QUOTE(_this call FUNC(handleFired));
|
||||
};
|
||||
};
|
||||
};
|
78
addons/advanced_ballistics/CfgVehicles.hpp
Normal file
78
addons/advanced_ballistics/CfgVehicles.hpp
Normal file
@ -0,0 +1,78 @@
|
||||
class CfgVehicles {
|
||||
class ACE_Module;
|
||||
class GVAR(ModuleSettings): ACE_Module {
|
||||
scope = 2;
|
||||
displayName = "Advanced Ballistics";
|
||||
icon = QUOTE(PATHTOF(UI\Icon_Module_Wind_ca.paa));
|
||||
category = "ACE";
|
||||
function = QUOTE(DFUNC(initModuleSettings));
|
||||
functionPriority = 1;
|
||||
isGlobal = 1;
|
||||
isTriggerActivated = 0;
|
||||
author = "Ruthberg";
|
||||
class Arguments {
|
||||
class enabled {
|
||||
displayName = "Advanced Ballistics";
|
||||
description = "Enables advanced ballistics";
|
||||
typeName = "BOOL";
|
||||
defaultValue = 0;
|
||||
};
|
||||
class alwaysSimulateForSnipers {
|
||||
displayName = "Always Enabled For Snipers";
|
||||
description = "Always enables advanced ballistics when high power optics are used";
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
class disabledInFullAutoMode {
|
||||
displayName = "Disabled In FullAuto Mode";
|
||||
description = "Disables the advanced ballistics during full auto fire";
|
||||
typeName = "BOOL";
|
||||
defaultValue = 0;
|
||||
};
|
||||
class onlyActiveForLocalPlayers {
|
||||
displayName = "Disabled For Non Local Players";
|
||||
description = "Disables the advanced ballistics for bullets coming from other players (enable this if you encounter frame drops during heavy firefights in multiplayer)";
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
/* // TODO: We currently do not have firedEHs on vehicles
|
||||
class vehicleGunnerEnabled {
|
||||
displayName = "Enabled For Vehicle Gunners";
|
||||
description = "Enables advanced ballistics for vehicle gunners";
|
||||
typeName = "BOOL";
|
||||
defaultValue = 0;
|
||||
};
|
||||
*/
|
||||
class ammoTemperatureEnabled {
|
||||
displayName = "Enable Ammo Temperature Simulation";
|
||||
description = "Muzzle velocity varies with ammo temperature";
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
class barrelLengthInfluenceEnabled {
|
||||
displayName = "Enable Barrel Length Simulation";
|
||||
description = "Muzzle velocity varies with barrel length";
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
class bulletTraceEnabled {
|
||||
displayName = "Enable Bullet Trace Effect";
|
||||
description = "Enables a bullet trace effect to high caliber bullets (only visible when looking through high power optics)";
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
class simulationInterval {
|
||||
displayName = "Simulation Interval";
|
||||
description = "Defines the interval between every calculation step";
|
||||
typeName = "NUMBER";
|
||||
defaultValue = 0.0;
|
||||
};
|
||||
class simulationRadius {
|
||||
displayName = "Simulation Radius";
|
||||
description = "Defines the radius (in meters) in which advanced ballistics are applied";
|
||||
typeName = "NUMBER";
|
||||
defaultValue = 3000;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
10
addons/advanced_ballistics/README.md
Normal file
10
addons/advanced_ballistics/README.md
Normal file
@ -0,0 +1,10 @@
|
||||
ace_advanced_ballistics
|
||||
===============
|
||||
|
||||
The Advanced Ballistics module introduces advanced external- and internal ballistics to the game.
|
||||
|
||||
## Maintainers
|
||||
|
||||
The people responsible for merging changes to this component or answering potential questions.
|
||||
|
||||
- [Ruthberg] (http://github.com/Ulteq)
|
63
addons/advanced_ballistics/RscTitles.hpp
Normal file
63
addons/advanced_ballistics/RscTitles.hpp
Normal file
@ -0,0 +1,63 @@
|
||||
class RscTitles
|
||||
{
|
||||
class RscTurretDial
|
||||
{
|
||||
idd=-1;
|
||||
onLoad="with uiNameSpace do { RscTurretDial = _this select 0 };";
|
||||
movingEnable=0;
|
||||
duration=5;
|
||||
fadeIn="false";
|
||||
fadeOut="false";
|
||||
class controls
|
||||
{
|
||||
class RscTurretDial
|
||||
{
|
||||
idc=132949;
|
||||
type=0;
|
||||
style=128;
|
||||
font="TahomaB";
|
||||
colorBackground[]={0,0,0,0.8};
|
||||
colorText[]={1,1,1,1};
|
||||
x="SafeZoneX + 0.0025";
|
||||
y="SafeZoneY + 0.0025";
|
||||
w=0.10;
|
||||
h=0.05;
|
||||
sizeEx=0.03;
|
||||
text="";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class 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;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
BIN
addons/advanced_ballistics/UI/Icon_Module_Wind_ca.paa
Normal file
BIN
addons/advanced_ballistics/UI/Icon_Module_Wind_ca.paa
Normal file
Binary file not shown.
BIN
addons/advanced_ballistics/UI/protractor.paa
Normal file
BIN
addons/advanced_ballistics/UI/protractor.paa
Normal file
Binary file not shown.
BIN
addons/advanced_ballistics/UI/protractor_marker.paa
Normal file
BIN
addons/advanced_ballistics/UI/protractor_marker.paa
Normal file
Binary file not shown.
46
addons/advanced_ballistics/XEH_postInit.sqf
Normal file
46
addons/advanced_ballistics/XEH_postInit.sqf
Normal file
@ -0,0 +1,46 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#include "initKeybinds.sqf"
|
||||
|
||||
GVAR(currentbulletID) = -1;
|
||||
|
||||
GVAR(bulletDatabase) = [];
|
||||
GVAR(bulletDatabaseStartTime) = [];
|
||||
GVAR(bulletDatabaseSpeed) = [];
|
||||
GVAR(bulletDatabaseFrames) = [];
|
||||
GVAR(bulletDatabaseLastFrame) = [];
|
||||
GVAR(bulletDatabaseHDeflect) = [];
|
||||
GVAR(bulletDatabaseSpinDrift) = [];
|
||||
GVAR(bulletDatabaseOccupiedIndices) = [];
|
||||
GVAR(bulletDatabaseFreeIndices) = [];
|
||||
|
||||
GVAR(WindInfo) = false;
|
||||
GVAR(WindInfoStart) = time;
|
||||
|
||||
GVAR(Protractor) = false;
|
||||
GVAR(ProtractorStart) = time;
|
||||
|
||||
// Those are only used in the pure sqf version (extension free PFH)
|
||||
GVAR(SimulationPrecision) = 2;
|
||||
GVAR(WindEnabled) = true;
|
||||
GVAR(SpinDriftEnabled) = true;
|
||||
GVAR(CoriolisEnabled) = true;
|
||||
GVAR(EoetvoesEnabled) = true;
|
||||
GVAR(AdvancedAirDragEnabled) = true;
|
||||
GVAR(TransonicRegionEnabled) = true;
|
||||
GVAR(AtmosphericDensitySimulationEnabled) = true;
|
||||
|
||||
GVAR(currentGrid) = 0;
|
||||
GVAR(INIT_MESSAGE_ENABLED) = false;
|
||||
|
||||
GVAR(extensionVersion) = ("ace_advanced_ballistics" callExtension "version");
|
||||
GVAR(extensionAvailable) = (GVAR(extensionVersion) == EXTENSION_REQUIRED_VERSION);
|
||||
if (!GVAR(extensionAvailable)) exitWith {
|
||||
if (GVAR(extensionVersion) == "") then {
|
||||
diag_log text "[ACE] ERROR: ace_advanced_ballistics.dll is missing";
|
||||
} else {
|
||||
diag_log text "[ACE] ERROR: ace_advanced_ballistics.dll is incompatible";
|
||||
};
|
||||
};
|
||||
|
||||
[] call FUNC(initializeTerrainExtension);
|
18
addons/advanced_ballistics/XEH_preInit.sqf
Normal file
18
addons/advanced_ballistics/XEH_preInit.sqf
Normal file
@ -0,0 +1,18 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(calculateAirDensity);
|
||||
PREP(calculateAmmoTemperatureVelocityShift);
|
||||
PREP(calculateAtmosphericCorrection);
|
||||
PREP(calculateBarrelLengthVelocityShift);
|
||||
PREP(calculateRetardation);
|
||||
PREP(calculateRoughnessLength);
|
||||
PREP(calculateStabilityFactor);
|
||||
PREP(calculateWindSpeed);
|
||||
PREP(displayProtractor);
|
||||
PREP(handleFired);
|
||||
PREP(initializeTerrainExtension);
|
||||
PREP(initModuleSettings);
|
||||
|
||||
ADDON = true;
|
18
addons/advanced_ballistics/config.cpp
Normal file
18
addons/advanced_ballistics/config.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_ballistics", "ace_weather", "ace_modules"};
|
||||
author[] = {"Ruthberg"};
|
||||
authorUrl = "https://github.com/ulteq";
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "RscTitles.hpp"
|
||||
#include "ACE_Settings.hpp"
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Displays a wind info (colored arrow) in the top left corner of the screen
|
||||
*
|
||||
* Arguments:
|
||||
* 0: temperature - degrees celcius <NUMBER>
|
||||
* 1: pressure - hPa <NUMBER>
|
||||
* 2: relativeHumidity - value between 0.0 and 1.0 <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* 0: density of air - kg * m^(-3) <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
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))
|
||||
};
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Calculates the ammo temperature induced muzzle velocity shift
|
||||
*
|
||||
* Arguments:
|
||||
* 0: ammo - classname <string>
|
||||
* 1: temperature - degrees celcius <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* 0: muzzle velocity shift - m/s <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_ammo", "_temperature", "_muzzleVelocityTable", "_muzzleVelocityShift", "_temperatureIndexA", "_temperatureIndexB", "_temperatureRatio"];
|
||||
_ammo = _this select 0;
|
||||
_temperature = _this select 1;
|
||||
|
||||
_muzzleVelocityTable = [];
|
||||
|
||||
if (isArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_ammoTempMuzzleVelocityShifts")) then {
|
||||
_muzzleVelocityTable = getArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_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
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Calculates the atmospherically corrected ballistic coefficient
|
||||
*
|
||||
* Arguments:
|
||||
* 0: ballistic coefficient - G1-G7 <NUMBER>
|
||||
* 1: temperature - degrees celcius <NUMBER>
|
||||
* 2: pressure - hPa <NUMBER>
|
||||
* 3: relativeHumidity - value between 0.0 and 1.0 <NUMBER>
|
||||
* 4: atmosphereModel - ICAO or ASM <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* corrected ballistic coefficient <NUMBER>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_ballisticCoefficient", "_temperature", "_pressure", "_relativeHumidity", "_atmosphereModel", "_airDensity"];
|
||||
_ballisticCoefficient = _this select 0;
|
||||
_temperature = _this select 1; // in C
|
||||
_pressure = _this select 2; // in hPa
|
||||
_relativeHumidity = _this select 3; // as ratio 0-1
|
||||
_atmosphereModel = _this select 4; // "ICAO" or "ASM"
|
||||
|
||||
_airDensity = [_temperature, _pressure, _relativeHumidity] call FUNC(calculateAirDensity);
|
||||
|
||||
if (_atmosphereModel == "ICAO") then {
|
||||
(STD_AIR_DENSITY_ICAO / _airDensity) * _ballisticCoefficient
|
||||
} else {
|
||||
(STD_AIR_DENSITY_ASM / _airDensity) * _ballisticCoefficient
|
||||
};
|
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Calculates the muzzle velocity shift caused by different barrel lengths
|
||||
*
|
||||
* Arguments:
|
||||
* 0: ammo - classname <string>
|
||||
* 0: weapon - classname <string>
|
||||
* 1: muzzle velocity - m/s <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* 0: muzzle velocity shift - m/s <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
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 >> "ACE_barrelLength");
|
||||
|
||||
if (_barrelLength == 0) exitWith { 0 };
|
||||
|
||||
_muzzleVelocityTable = [];
|
||||
_barrelLengthTable = [];
|
||||
|
||||
if (isArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_muzzleVelocities")) then {
|
||||
_muzzleVelocityTable = getArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_muzzleVelocities");
|
||||
};
|
||||
if (isArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_barrelLengths")) then {
|
||||
_barrelLengthTable = getArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_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
|
@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Calculates the retardation of the bullet
|
||||
*
|
||||
* Arguments:
|
||||
* 0: drag model - 1-7 <integer>
|
||||
* 1: drag coefficient - bc <NUMBER>
|
||||
* 2: velocity - m/s <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* 0: retardation - m/(s^2) <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
// Source: GNU Exterior Ballistics
|
||||
|
||||
private ["_dragModel", "_dragCoefficient", "_velocity", "_A", "_M", "_result"];
|
||||
_dragModel = _this select 0;
|
||||
_dragCoefficient = _this select 1;
|
||||
_velocity = (_this select 2) * 3.2808399;
|
||||
|
||||
_A = -1;
|
||||
_M = -1;
|
||||
_result = 0;
|
||||
|
||||
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
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Calculates the terrain roughness length at a given world position
|
||||
*
|
||||
* Arguments:
|
||||
* 0: _this - world position <posASL>
|
||||
*
|
||||
* Return Value:
|
||||
* 0: roughness length <NUMBER>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
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 ACE_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))
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Calculates the stability factor of a bullet
|
||||
*
|
||||
* Arguments:
|
||||
* 0: caliber - inches <NUMBER>
|
||||
* 1: bullet length - inches <NUMBER>
|
||||
* 2: bullet mass - grains <NUMBER>
|
||||
* 3: barrel twist - inches <NUMBER>
|
||||
* 4: muzzle velocity shift - m/s <NUMBER>
|
||||
* 5: temperature - degrees celcius <NUMBER>
|
||||
* 6: barometric Pressure - hPA <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* 0: stability factor <NUMBER>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
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
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Calculates the true wind speed at a given world position
|
||||
*
|
||||
* Arguments:
|
||||
* 0: _this - world position <posASL>
|
||||
*
|
||||
* Return Value:
|
||||
* 0: wind speed - m/s <NUMBER>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
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 ACE_wind;
|
||||
_windDir = (ACE_wind select 0) atan2 (ACE_wind select 1);
|
||||
|
||||
// Wind gradient
|
||||
if (_windSpeed > 0.05) then {
|
||||
_height = (ASLToATL _this) select 2;
|
||||
_height = 0 max _height min 20;
|
||||
if (_height < 20) then {
|
||||
_roughnessLength = _this call FUNC(calculateRoughnessLength);
|
||||
_windSpeed = _windSpeed * ln(_height / _roughnessLength) / ln(20 / _roughnessLength);
|
||||
};
|
||||
};
|
||||
|
||||
// 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
|
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
*
|
||||
* Displays a protractor in the top left corner of the screen
|
||||
*
|
||||
* Argument:
|
||||
* None
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define __dsp (uiNamespace getVariable "RscProtractor")
|
||||
#define __ctrl1 (__dsp displayCtrl 132950)
|
||||
#define __ctrl2 (__dsp displayCtrl 132951)
|
||||
|
||||
private ["_inclinationAngle", "_refPosition"];
|
||||
|
||||
if (GVAR(Protractor)) exitWith {
|
||||
GVAR(Protractor) = false;
|
||||
1 cutText ["", "PLAIN"];
|
||||
true
|
||||
};
|
||||
if (weaponLowered ACE_player) exitWith { false };
|
||||
if (vehicle ACE_player != ACE_player) exitWith { false };
|
||||
if (currentWeapon ACE_player != primaryWeapon ACE_player) exitWith { false };
|
||||
|
||||
2 cutText ["", "PLAIN"];
|
||||
EGVAR(weather,WindInfo) = false;
|
||||
0 cutText ["", "PLAIN"];
|
||||
GVAR(Protractor) = true;
|
||||
|
||||
[{
|
||||
if !(GVAR(Protractor) && !(weaponLowered ACE_player) && currentWeapon ACE_player == primaryWeapon ACE_player) exitWith {
|
||||
GVAR(Protractor) = false;
|
||||
1 cutText ["", "PLAIN"];
|
||||
[_this select 1] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
_refPosition = [SafeZoneX + 0.001, SafeZoneY + 0.001, 0.2, 0.2 * 4/3];
|
||||
|
||||
_inclinationAngle = asin((ACE_player weaponDirection currentWeapon ACE_player) select 2);
|
||||
_inclinationAngle = -58 max _inclinationAngle min 58;
|
||||
|
||||
1 cutRsc ["RscProtractor", "PLAIN", 1, false];
|
||||
|
||||
__ctrl1 ctrlSetScale 0.75;
|
||||
__ctrl1 ctrlCommit 0;
|
||||
__ctrl1 ctrlSetText QUOTE(PATHTOF(UI\protractor.paa));
|
||||
__ctrl1 ctrlSetTextColor [1, 1, 1, 1];
|
||||
|
||||
__ctrl2 ctrlSetScale 0.75;
|
||||
__ctrl2 ctrlSetPosition [(_refPosition select 0), (_refPosition select 1) - 0.0012 * _inclinationAngle, (_refPosition select 2), (_refPosition select 3)];
|
||||
__ctrl2 ctrlCommit 0;
|
||||
__ctrl2 ctrlSetText QUOTE(PATHTOF(UI\protractor_marker.paa));
|
||||
__ctrl2 ctrlSetTextColor [1, 1, 1, 1];
|
||||
|
||||
}, 0.1, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
true
|
383
addons/advanced_ballistics/functions/fnc_handleFired.sqf
Normal file
383
addons/advanced_ballistics/functions/fnc_handleFired.sqf
Normal file
@ -0,0 +1,383 @@
|
||||
/*
|
||||
* Author: Glowbal, Ruthberg
|
||||
*
|
||||
* Handles advanced ballistics for (BulletBase) projectiles
|
||||
*
|
||||
* Arguments:
|
||||
* 0: unit - Object the event handler is assigned to <OBJECT>
|
||||
* 1: weapon - Fired weapon <STRING>
|
||||
* 2: muzzle - Muzzle that was used <STRING>
|
||||
* 3: mode - Current mode of the fired weapon <STRING>
|
||||
* 4: ammo - Ammo used <STRING>
|
||||
* 5: magazine - magazine name which was used <STRING>
|
||||
* 6: projectile - Object of the projectile that was shot <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_weapon", "_mode", "_ammo", "_magazine", "_caliber", "_bullet", "_abort", "_index", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_atmosphereModel", "_bulletMass", "_bulletLength", "_airFriction", "_dragModel", "_muzzleVelocity", "_muzzleVelocityCoef", "_muzzleAccessory", "_initSpeedCoef", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_bulletWeight", "_barrelTwist", "_twistDirection", "_stabilityFactor", "_transonicStabilityCoef"];
|
||||
_unit = _this select 0;
|
||||
_weapon = _this select 1;
|
||||
_mode = _this select 3;
|
||||
_ammo = _this select 4;
|
||||
_magazine = _this select 5;
|
||||
_bullet = _this select 6;
|
||||
|
||||
_abort = false;
|
||||
if (!hasInterface) exitWith {};
|
||||
if (!alive _bullet) exitWith {};
|
||||
if (!GVAR(enabled)) exitWith {};
|
||||
if (!([_unit] call EFUNC(common,isPlayer))) exitWith {};
|
||||
if (underwater _unit) exitWith {};
|
||||
if (!(_ammo isKindOf "BulletBase")) exitWith {};
|
||||
if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {};
|
||||
if (GVAR(onlyActiveForLocalPlayers) && _unit != ACE_player) then { _abort = true; };
|
||||
//if (!GVAR(vehicleGunnerEnabled) && !(_unit isKindOf "Man")) then { _abort = true; }; // TODO: We currently do not have firedEHs on vehicles
|
||||
if (GVAR(disabledInFullAutoMode) && getNumber(configFile >> "cfgWeapons" >> _weapon >> _mode >> "autoFire") == 1) then { _abort = true; };
|
||||
|
||||
if (_abort && alwaysSimulateForSnipers) then {
|
||||
// The shooter is non local
|
||||
if (currentWeapon _unit == primaryWeapon _unit && count primaryWeaponItems _unit > 2) then {
|
||||
_opticsName = (primaryWeaponItems _unit) select 2;
|
||||
_opticType = getNumber(configFile >> "cfgWeapons" >> _opticsName >> "ItemInfo" >> "opticType");
|
||||
_abort = _opticType != 2; // We only abort if the non local shooter is not a sniper
|
||||
};
|
||||
};
|
||||
if (_abort || !(GVAR(extensionAvailable))) exitWith {
|
||||
[_bullet, getNumber(configFile >> "cfgAmmo" >> _ammo >> "airFriction")] call EFUNC(winddeflection,updateTrajectoryPFH);
|
||||
};
|
||||
|
||||
_airFriction = getNumber(configFile >> "cfgAmmo" >> _ammo >> "airFriction");
|
||||
_muzzleVelocity = getNumber(configFile >> "cfgMagazines" >> _magazine >> "initSpeed");
|
||||
_muzzleVelocityCoef = getNumber(configFile >> "cfgWeapons" >> _weapon >> "initSpeed");
|
||||
if (_muzzleVelocityCoef > 0) then {
|
||||
_muzzleVelocity = _muzzleVelocityCoef;
|
||||
};
|
||||
if (_muzzleVelocityCoef < 0) then {
|
||||
_muzzleVelocity = _muzzleVelocity * (-1 * _muzzleVelocityCoef);
|
||||
};
|
||||
|
||||
_muzzleAccessory = "";
|
||||
switch (currentWeapon _unit) do {
|
||||
case primaryWeapon _unit: { _muzzleAccessory = (primaryWeaponItems _unit) select 0; };
|
||||
case handgunWeapon _unit: { _muzzleAccessory = (handgunItems _unit) select 0; };
|
||||
};
|
||||
|
||||
if (_muzzleAccessory != "" && isNumber(configFile >> "cfgWeapons" >> _muzzleAccessory >> "ItemInfo" >> "MagazineCoef" >> "initSpeed")) then {
|
||||
_initSpeedCoef = getNumber(configFile >> "cfgWeapons" >> _muzzleAccessory >> "ItemInfo" >> "MagazineCoef" >> "initSpeed");
|
||||
_muzzleVelocity = _muzzleVelocity * _initSpeedCoef;
|
||||
};
|
||||
|
||||
if (GVAR(barrelLengthInfluenceEnabled)) then {
|
||||
_muzzleVelocityShift = [_ammo, _weapon, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift);
|
||||
if (_muzzleVelocityShift != 0) then {
|
||||
_bulletVelocity = velocity _bullet;
|
||||
_bulletSpeed = vectorMagnitude _bulletVelocity;
|
||||
_bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift * (_bulletSpeed / _muzzleVelocity)));
|
||||
_bullet setVelocity _bulletVelocity;
|
||||
_muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift;
|
||||
};
|
||||
};
|
||||
|
||||
if (GVAR(ammoTemperatureEnabled)) then {
|
||||
_temperature = GET_TEMPERATURE_AT_HEIGHT((getPosASL _unit) select 2);
|
||||
_muzzleVelocityShift = [_ammo, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift);
|
||||
if (_muzzleVelocityShift != 0) then {
|
||||
_bulletVelocity = velocity _bullet;
|
||||
_bulletSpeed = vectorMagnitude _bulletVelocity;
|
||||
_bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift * (_bulletSpeed / _muzzleVelocity)));
|
||||
_bullet setVelocity _bulletVelocity;
|
||||
_muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift;
|
||||
};
|
||||
};
|
||||
|
||||
_bulletTraceVisible = false;
|
||||
if (GVAR(bulletTraceEnabled) && cameraView == "GUNNER" && currentWeapon ACE_player == primaryWeapon ACE_player && count primaryWeaponItems ACE_player > 2) then {
|
||||
_opticsName = (primaryWeaponItems ACE_player) select 2;
|
||||
_opticType = getNumber(configFile >> "cfgWeapons" >> _opticsName >> "ItemInfo" >> "opticType");
|
||||
_bulletTraceVisible = (_opticType == 2 || currentWeapon ACE_player in ["ACE_Vector", "Binocular", "Rangefinder", "Laserdesignator"]);
|
||||
};
|
||||
|
||||
_caliber = getNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_caliber");
|
||||
_bulletLength = getNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_bulletLength");
|
||||
_bulletMass = getNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_bulletMass");
|
||||
_barrelTwist = getNumber(configFile >> "cfgWeapons" >> _weapon >> "ACE_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(-(EGVAR(weather,Altitude) + ((getPosASL _bullet) select 2)) / 7990) - 10 * overcast;
|
||||
_stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call FUNC(calculateStabilityFactor);
|
||||
};
|
||||
|
||||
_twistDirection = 1;
|
||||
if (isNumber(configFile >> "cfgWeapons" >> _weapon >> "ACE_twistDirection")) then {
|
||||
_twistDirection = getNumber(configFile >> "cfgWeapons" >> _weapon >> "ACE_twistDirection");
|
||||
if (_twistDirection != -1 && _twistDirection != 0 && _twistDirection != 1) then {
|
||||
_twistDirection = 1;
|
||||
};
|
||||
};
|
||||
|
||||
_transonicStabilityCoef = 0.5;
|
||||
if (isNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_transonicStabilityCoef")) then {
|
||||
_transonicStabilityCoef = getNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_transonicStabilityCoef");
|
||||
};
|
||||
|
||||
_dragModel = 1;
|
||||
_ballisticCoefficients = [];
|
||||
_velocityBoundaries = [];
|
||||
_atmosphereModel = "ICAO";
|
||||
if (GVAR(AdvancedAirDragEnabled)) then {
|
||||
if (isNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_dragModel")) then {
|
||||
_dragModel = getNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_dragModel");
|
||||
if (!(_dragModel in [1, 2, 5, 6, 7, 8])) then {
|
||||
_dragModel = 1;
|
||||
};
|
||||
};
|
||||
if (isArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_ballisticCoefficients")) then {
|
||||
_ballisticCoefficients = getArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_ballisticCoefficients");
|
||||
};
|
||||
if (isArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_velocityBoundaries")) then {
|
||||
_velocityBoundaries = getArray(configFile >> "cfgAmmo" >> _ammo >> "ACE_velocityBoundaries");
|
||||
};
|
||||
if (isText(configFile >> "cfgAmmo" >> _ammo >> "ACE_standardAtmosphere")) then {
|
||||
_atmosphereModel = getText(configFile >> "cfgAmmo" >> _ammo >> "ACE_standardAtmosphere");
|
||||
};
|
||||
};
|
||||
|
||||
#ifdef USE_ADVANCEDBALLISTICS_DLL
|
||||
GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000;
|
||||
|
||||
"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _bullet, EGVAR(weather,Latitude), EGVAR(weather,currentTemperature), EGVAR(weather,Altitude), EGVAR(weather,currentHumidity), overcast, floor(time), time - floor(time)];
|
||||
|
||||
[{
|
||||
private ["_index", "_bullet", "_caliber", "_bulletTraceVisible", "_bulletVelocity", "_bulletPosition"];
|
||||
EXPLODE_4_PVT(_this select 0,_bullet,_caliber,_bulletTraceVisible,_index);
|
||||
|
||||
_bulletVelocity = velocity _bullet;
|
||||
_bulletPosition = getPosASL _bullet;
|
||||
|
||||
_bulletSpeed = vectorMagnitude _bulletVelocity;
|
||||
|
||||
if (!alive _bullet || _bulletSpeed < 100) exitWith {
|
||||
[_this select 1] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
if (_bulletTraceVisible && _bulletSpeed > 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 ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, floor(time), time - floor(time)]);
|
||||
|
||||
}, GVAR(simulationInterval), [_bullet, _caliber, _bulletTraceVisible, GVAR(currentbulletID)]] call CBA_fnc_addPerFrameHandler;
|
||||
#else
|
||||
_index = count GVAR(bulletDatabase);
|
||||
if (count GVAR(bulletDatabaseFreeIndices) > 0) then {
|
||||
_index = GVAR(bulletDatabaseFreeIndices) select 0;
|
||||
GVAR(bulletDatabaseFreeIndices) = GVAR(bulletDatabaseFreeIndices) - [_index];
|
||||
};
|
||||
|
||||
GVAR(bulletDatabase) set[_index, [_bullet, _caliber, _airFriction, _muzzleVelocity, _stabilityFactor, _transonicStabilityCoef, _twistDirection, _unit, _bulletTraceVisible, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _index]];
|
||||
GVAR(bulletDatabaseStartTime) set[_index, time];
|
||||
GVAR(bulletDatabaseSpeed) set[_index, 0];
|
||||
GVAR(bulletDatabaseFrames) set[_index, 1];
|
||||
GVAR(bulletDatabaseLastFrame) set[_index, time];
|
||||
GVAR(bulletDatabaseHDeflect) set[_index, 0];
|
||||
GVAR(bulletDatabaseSpinDrift) set[_index, 0];
|
||||
|
||||
if ((GVAR(bulletDatabaseOccupiedIndices) pushBack _index) == 0) then {
|
||||
[{
|
||||
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", "_bulletDir", "_horizontalDeflection", "_horizontalDeflectionPartial", "_spinDrift", "_spinDriftPartial"];
|
||||
|
||||
{
|
||||
_bulletDatabaseEntry = (GVAR(bulletDatabase) select _x);
|
||||
if (!alive (_bulletDatabaseEntry select 0)) then {
|
||||
_index = _bulletDatabaseEntry select 13;
|
||||
GVAR(bulletDatabaseOccupiedIndices) = GVAR(bulletDatabaseOccupiedIndices) - [_index];
|
||||
GVAR(bulletDatabaseFreeIndices) pushBack _index;
|
||||
};
|
||||
true
|
||||
} count GVAR(bulletDatabaseOccupiedIndices);
|
||||
|
||||
if (count GVAR(bulletDatabaseOccupiedIndices) == 0) exitWith {
|
||||
GVAR(bulletDatabase) = [];
|
||||
GVAR(bulletDatabaseStartTime) = [];
|
||||
GVAR(bulletDatabaseSpeed) = [];
|
||||
GVAR(bulletDatabaseFrames) = [];
|
||||
GVAR(bulletDatabaseLastFrame) = [];
|
||||
GVAR(bulletDatabaseHDeflect) = [];
|
||||
GVAR(bulletDatabaseSpinDrift) = [];
|
||||
GVAR(bulletDatabaseOccupiedIndices) = [];
|
||||
GVAR(bulletDatabaseFreeIndices) = [];
|
||||
[_this select 1] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
{
|
||||
_bulletDatabaseEntry = GVAR(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 - (GVAR(bulletDatabaseStartTime) select _index);
|
||||
|
||||
_bulletVelocity = velocity _bullet;
|
||||
_bulletPosition = getPosASL _bullet;
|
||||
|
||||
_bulletSpeed = vectorMagnitude _bulletVelocity;
|
||||
_bulletDir = (_bulletVelocity select 0) atan2 (_bulletVelocity select 1);
|
||||
|
||||
_speed = (GVAR(bulletDatabaseSpeed) select _index);
|
||||
GVAR(bulletDatabaseSpeed) set[_index, _speed + _bulletSpeed];
|
||||
|
||||
_frames = (GVAR(bulletDatabaseFrames) select _index);
|
||||
GVAR(bulletDatabaseFrames) set[_index, _frames + 1];
|
||||
|
||||
_bulletSpeedAvg = (_speed / _frames);
|
||||
|
||||
if ((GVAR(SimulationPrecision) < 2) || {_frames % GVAR(SimulationPrecision) == _index % GVAR(SimulationPrecision)}) then {
|
||||
_deltaT = time - (GVAR(bulletDatabaseLastFrame) select _index);
|
||||
GVAR(bulletDatabaseLastFrame) set[_index, time];
|
||||
|
||||
_trueVelocity = _bulletVelocity;
|
||||
_trueSpeed = _bulletSpeed;
|
||||
_wind = [0, 0, 0];
|
||||
if (GVAR(WindEnabled) && (vectorMagnitude ACE_wind) > 0) then {
|
||||
_windSourceObstacle = _bulletPosition vectorDiff ((vectorNormalized ACE_wind) vectorMultiply 10);
|
||||
_windSourceTerrain = _bulletPosition vectorDiff ((vectorNormalized ACE_wind) vectorMultiply 100);
|
||||
|
||||
if (!(lineIntersects [_bulletPosition, _windSourceObstacle]) && !(terrainIntersectASL [_bulletPosition, _windSourceTerrain])) then {
|
||||
_wind = ACE_wind;
|
||||
_height = ASLToATL(_bulletPosition) select 2;
|
||||
_height = 0 max _height min 20;
|
||||
if (_height < 20) then {
|
||||
_roughnessLength = _bulletPosition call FUNC(calculateRoughnessLength);
|
||||
_wind = _wind vectorMultiply (ln(_height / _roughnessLength) / ln(20 / _roughnessLength));
|
||||
};
|
||||
|
||||
_trueVelocity = _bulletVelocity vectorDiff _wind;
|
||||
_trueSpeed = vectorMagnitude _trueVelocity;
|
||||
};
|
||||
};
|
||||
|
||||
_airFrictionRef = _airFriction;
|
||||
if (GVAR(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 (GVAR(AtmosphericDensitySimulationEnabled)) then {
|
||||
_pressure = 1013.25 * exp(-(EGVAR(weather,Altitude) + (_bulletPosition select 2)) / 7990) - 10 * overcast;
|
||||
_temperature = GET_TEMPERATURE_AT_HEIGHT(_bulletPosition select 2);
|
||||
_humidity = EGVAR(weather,currentHumidity);
|
||||
_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 FUNC(calculateRetardation));
|
||||
_accel = (vectorNormalized _trueVelocity) vectorMultiply (_drag);
|
||||
_bulletVelocity = _bulletVelocity vectorDiff _accel;
|
||||
} else {
|
||||
if (GVAR(AtmosphericDensitySimulationEnabled)) then {
|
||||
_pressureDeviation = 1013.25 * exp(-(EGVAR(weather,Altitude) + (_bulletPosition select 2)) / 7990) - 1013.25 - 10 * overcast;
|
||||
_temperature = GET_TEMPERATURE_AT_HEIGHT(_bulletPosition select 2);
|
||||
_humidity = EGVAR(weather,currentHumidity);
|
||||
_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 (GVAR(CoriolisEnabled) && _bulletSpeedAvg > 0) then {
|
||||
_horizontalDeflection = 0.0000729 * (_unit distanceSqr _bullet) * sin(EGVAR(weather,Latitude)) / _bulletSpeedAvg;
|
||||
_horizontalDeflectionPartial = _horizontalDeflection - (GVAR(bulletDatabaseHDeflect) select _index);
|
||||
GVAR(bulletDatabaseHDeflect) set[_index, _horizontalDeflection];
|
||||
_vect = [sin(_bulletDir + 90) * _horizontalDeflectionPartial, cos(_bulletDir + 90) * _horizontalDeflectionPartial, 0];
|
||||
|
||||
_bulletPosition = _bulletPosition vectorAdd _vect;
|
||||
};
|
||||
|
||||
/*
|
||||
// Negligible effect on the trajectory
|
||||
if (GVAR(EoetvoesEnabled)) then {
|
||||
_centripetalAccel = 2 * 0.0000729 * (_muzzleVelocity / -32.2) * cos(EGVAR(weather,Latitude)) * sin(_bulletDir);
|
||||
_accel = [0, 0, -(_centripetalAccel * _deltaT)];
|
||||
|
||||
_bulletVelocity = _bulletVelocity vectorAdd _accel;
|
||||
};
|
||||
//*/
|
||||
|
||||
if (GVAR(SpinDriftEnabled)) then {
|
||||
_spinDrift = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83;
|
||||
_spinDriftPartial = _spinDrift - (GVAR(bulletDatabaseSpinDrift) select _index);
|
||||
GVAR(bulletDatabaseSpinDrift) set[_index, _spinDrift];
|
||||
_vect = [sin(_bulletDir + 90) * _spinDriftPartial, cos(_bulletDir + 90) * _spinDriftPartial, 0];
|
||||
|
||||
_bulletPosition = _bulletPosition vectorAdd _vect;
|
||||
};
|
||||
};
|
||||
|
||||
if (GVAR(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 GVAR(bulletDatabaseOccupiedIndices);
|
||||
|
||||
}, GVAR(simulationInterval), []] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
#endif
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Author: Glowbal, Ruthberg
|
||||
* Module for adjusting the advanced ballistics settings
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The module logic <LOGIC>
|
||||
* 1: units <ARRAY>
|
||||
* 2: activated <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* None <NIL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_logic", "_units", "_activated"];
|
||||
_logic = _this select 0;
|
||||
_units = _this select 1;
|
||||
_activated = _this select 2;
|
||||
|
||||
if !(_activated) exitWith {};
|
||||
|
||||
[_logic, QGVAR(enabled), "enabled"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(ammoTemperatureEnabled), "ammoTemperatureEnabled"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(barrelLengthInfluenceEnabled), "barrelLengthInfluenceEnabled"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(bulletTraceEnabled), "bulletTraceEnabled"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(onlyActiveForLocalPlayers), "onlyActiveForLocalPlayers"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(disabledInFullAutoMode), "disabledInFullAutoMode"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(alwaysSimulateForSnipers), "alwaysSimulateForSnipers"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(simulationInterval), "simulationInterval"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(simulationRadius), "simulationRadius"] call EFUNC(common,readSettingFromModule);
|
||||
|
||||
GVAR(simulationInterval) = 0 max GVAR(simulationInterval) min 0.2;
|
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Initializes the advanced ballistics dll extension with terrain data
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
if (!GVAR(extensionAvailable)) exitWith {};
|
||||
|
||||
private ["_initStartTime", "_mapSize", "_mapGrids", "_gridCells", "_x", "_y", "_gridCenter", "_gridHeight", "_gridNumObjects", "_gridSurfaceIsWater"];
|
||||
|
||||
_initStartTime = time;
|
||||
_mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize");
|
||||
|
||||
if (("ace_advanced_ballistics" callExtension format["init:%1:%2", worldName, _mapSize]) == "Terrain already initialized") exitWith {
|
||||
if (GVAR(INIT_MESSAGE_ENABLED)) then {
|
||||
systemChat "AdvancedBallistics: Terrain already initialized";
|
||||
};
|
||||
};
|
||||
|
||||
_mapGrids = ceil(_mapSize / 50) + 1;
|
||||
_gridCells = _mapGrids * _mapGrids;
|
||||
|
||||
GVAR(currentGrid) = 0;
|
||||
|
||||
[{
|
||||
private ["_args", "_mapGrids", "_gridCells", "_initStartTime"];
|
||||
_args = _this select 0;
|
||||
_mapGrids = _args select 0;
|
||||
_gridCells = _args select 1;
|
||||
_initStartTime = _args select 2;
|
||||
|
||||
if (GVAR(currentGrid) >= _gridCells) exitWith {
|
||||
if (GVAR(INIT_MESSAGE_ENABLED)) then {
|
||||
systemChat format["AdvancedBallistics: Finished terrain initialization in %1 seconds", ceil(time - _initStartTime)];
|
||||
};
|
||||
[_this select 1] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
for "_i" from 1 to 50 do {
|
||||
_x = floor(GVAR(currentGrid) / _mapGrids) * 50;
|
||||
_y = (GVAR(currentGrid) - floor(GVAR(currentGrid) / _mapGrids) * _mapGrids) * 50;
|
||||
_gridCenter = [_x + 25, _y + 25];
|
||||
_gridHeight = round(getTerrainHeightASL _gridCenter);
|
||||
_gridNumObjects = count (_gridCenter nearObjects ["Building", 50]);
|
||||
_gridSurfaceIsWater = if (surfaceIsWater _gridCenter) then {1} else {0};
|
||||
"ace_advanced_ballistics" callExtension format["set:%1:%2:%3", _gridHeight, _gridNumObjects, _gridSurfaceIsWater];
|
||||
GVAR(currentGrid) = GVAR(currentGrid) + 1;
|
||||
if (GVAR(currentGrid) >= _gridCells) exitWith {};
|
||||
};
|
||||
|
||||
}, 0, [_mapGrids, _gridCells, _initStartTime]] call CBA_fnc_addPerFrameHandler
|
@ -0,0 +1 @@
|
||||
#include "\z\ace\addons\advanced_ballistics\script_component.hpp"
|
10
addons/advanced_ballistics/initKeybinds.sqf
Normal file
10
addons/advanced_ballistics/initKeybinds.sqf
Normal file
@ -0,0 +1,10 @@
|
||||
["ACE3", QGVAR(ProtractorKey), localize "STR_ACE_AdvancedBallistics_ProtractorKey",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
|
||||
// Statement
|
||||
[] call FUNC(displayProtractor);
|
||||
},
|
||||
{false},
|
||||
[37, [true, true, false]], false, 0] call CBA_fnc_addKeybind; // (CTRL + SHIFT + K)
|
28
addons/advanced_ballistics/script_component.hpp
Normal file
28
addons/advanced_ballistics/script_component.hpp
Normal file
@ -0,0 +1,28 @@
|
||||
#define COMPONENT advanced_ballistics
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
#define USE_ADVANCEDBALLISTICS_DLL
|
||||
|
||||
#ifdef DEBUG_ENABLED_ADVANCEDBALLISTICS
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_SETTINGS_ADVANCEDBALLISTICS
|
||||
#define DEBUG_SETTINGS DEBUG_SETTINGS_ADVANCEDBALLISTICS
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
||||
|
||||
#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) (EGVAR(weather,currentTemperature) - 0.0065 * (h))
|
||||
|
||||
#define EXTENSION_REQUIRED_VERSION "1.0"
|
24
addons/advanced_ballistics/stringtable.xml
Normal file
24
addons/advanced_ballistics/stringtable.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Edited with tabler. -->
|
||||
<Project name="ACE">
|
||||
<Package name="AdvancedBallistics">
|
||||
<Key ID="STR_ACE_AdvancedBallistics_WindInfoKey">
|
||||
<English>Show Wind Info</English>
|
||||
<Polish>Pokaż inf. o wietrze</Polish>
|
||||
<Italian>Mostra indicazioni del vento</Italian>
|
||||
<Russian>Показать информацию о ветре</Russian>
|
||||
<French>Afficher les info sur le vent</French>
|
||||
<Spanish>Mostrar información del viento</Spanish>
|
||||
<German>Windinformationen anzeigen</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_AdvancedBallistics_ProtractorKey">
|
||||
<English>Show Protractor</English>
|
||||
<Polish>Pokaż kątomierz</Polish>
|
||||
<Italian>Mostra il rapportatore</Italian>
|
||||
<Russian>Показать транспортир</Russian>
|
||||
<French>Afficher le rapporteur</French>
|
||||
<Spanish>Mostrar transportador</Spanish>
|
||||
<German>Winkelmesser anzeigen</German>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
@ -574,4 +574,198 @@ class CfgWeapons {
|
||||
maxRange = 1200; //1000;
|
||||
};
|
||||
};
|
||||
|
||||
// marksmen marksmen
|
||||
class DMR_03_base_F: Rifle_Long_Base_F {
|
||||
modes[] += {"ACE_Burst_far"};
|
||||
|
||||
class Single: Mode_SemiAuto {
|
||||
minRange = 120; // 2;
|
||||
minRangeProbab = 0.7; // 0.3;
|
||||
midRangeProbab = 0.3; // 0.7;
|
||||
};
|
||||
|
||||
class FullAuto;
|
||||
|
||||
class single_close_optics1: Single {
|
||||
minRange = 120; // 2;
|
||||
minRangeProbab = 0.8; // 0.05;
|
||||
midRangeProbab = 0.05; // 0.8;
|
||||
};
|
||||
|
||||
class single_medium_optics1: single_close_optics1 {
|
||||
minRangeProbab = 0.7; // 0.05;
|
||||
midRangeProbab = 0.05; // 0.7;
|
||||
};
|
||||
|
||||
class single_far_optics1: single_medium_optics1 {
|
||||
minRange = 400; // 300;
|
||||
minRangeProbab = 0.5; // 0.05;
|
||||
midRangeProbab = 0.05; // 0.5;
|
||||
};
|
||||
|
||||
class fullauto_medium: FullAuto {
|
||||
minRange = 20; // 2;
|
||||
maxRange = 150; // 100;
|
||||
burst = "3 + round random 5"; // 3;
|
||||
};
|
||||
|
||||
class ACE_Burst_far: fullauto_medium {
|
||||
aiRateOfFire = 2.0;
|
||||
aiRateOfFireDistance = 500;
|
||||
minRange = 400;
|
||||
minRangeProbab = 0.1;
|
||||
midRange = 500;
|
||||
midRangeProbab = 0.2;
|
||||
maxRange = 600;
|
||||
maxRangeProbab = 0.2;
|
||||
burst = "2 + round random 3";
|
||||
};
|
||||
};
|
||||
|
||||
class DMR_05_base_F: Rifle_Long_Base_F {
|
||||
modes[] += {"ACE_Burst_far"};
|
||||
|
||||
class Single: Mode_SemiAuto {
|
||||
minRange = 120; // 2;
|
||||
minRangeProbab = 0.7; // 0.3;
|
||||
midRangeProbab = 0.3; // 0.7;
|
||||
};
|
||||
|
||||
class FullAuto;
|
||||
|
||||
class single_close_optics1: Single {
|
||||
minRange = 120; // 2;
|
||||
minRangeProbab = 0.8; // 0.05;
|
||||
midRangeProbab = 0.05; // 0.8;
|
||||
};
|
||||
|
||||
class single_medium_optics1: single_close_optics1 {
|
||||
minRangeProbab = 0.7; // 0.05;
|
||||
midRangeProbab = 0.05; // 0.7;
|
||||
};
|
||||
|
||||
class single_far_optics1: single_medium_optics1 {
|
||||
minRange = 400; // 300;
|
||||
minRangeProbab = 0.5; // 0.05;
|
||||
midRangeProbab = 0.05; // 0.5;
|
||||
};
|
||||
|
||||
class fullauto_medium: FullAuto {
|
||||
minRange = 20; // 2;
|
||||
maxRange = 150; // 100;
|
||||
burst = "3 + round random 5"; // 3;
|
||||
};
|
||||
|
||||
class ACE_Burst_far: fullauto_medium {
|
||||
aiRateOfFire = 2.0;
|
||||
aiRateOfFireDistance = 500;
|
||||
minRange = 400;
|
||||
minRangeProbab = 0.1;
|
||||
midRange = 500;
|
||||
midRangeProbab = 0.2;
|
||||
maxRange = 600;
|
||||
maxRangeProbab = 0.2;
|
||||
burst = "2 + round random 3";
|
||||
};
|
||||
};
|
||||
|
||||
class DMR_06_base_F: Rifle_Long_Base_F {
|
||||
modes[] += {"ACE_Burst_far"};
|
||||
|
||||
class Single: Mode_SemiAuto {
|
||||
minRange = 120; // 2;
|
||||
minRangeProbab = 0.7; // 0.3;
|
||||
midRangeProbab = 0.3; // 0.7;
|
||||
};
|
||||
|
||||
class FullAuto;
|
||||
|
||||
class single_close_optics1: Single {
|
||||
minRange = 120; // 2;
|
||||
minRangeProbab = 0.8; // 0.05;
|
||||
midRangeProbab = 0.05; // 0.8;
|
||||
};
|
||||
|
||||
class single_medium_optics1: single_close_optics1 {
|
||||
minRangeProbab = 0.7; // 0.05;
|
||||
midRangeProbab = 0.05; // 0.7;
|
||||
};
|
||||
|
||||
class single_far_optics1: single_medium_optics1 {
|
||||
minRange = 400; // 300;
|
||||
minRangeProbab = 0.5; // 0.05;
|
||||
midRangeProbab = 0.05; // 0.5;
|
||||
};
|
||||
|
||||
class fullauto_medium: FullAuto {
|
||||
minRange = 20; // 2;
|
||||
maxRange = 150; // 100;
|
||||
burst = "3 + round random 5"; // 3;
|
||||
};
|
||||
|
||||
class ACE_Burst_far: fullauto_medium {
|
||||
aiRateOfFire = 2.0;
|
||||
aiRateOfFireDistance = 500;
|
||||
minRange = 400;
|
||||
minRangeProbab = 0.1;
|
||||
midRange = 500;
|
||||
midRangeProbab = 0.2;
|
||||
maxRange = 600;
|
||||
maxRangeProbab = 0.2;
|
||||
burst = "2 + round random 3";
|
||||
};
|
||||
};
|
||||
|
||||
// marksmen medium mg
|
||||
class MMG_01_base_F: Rifle_Long_Base_F {
|
||||
aiDispersionCoefY = 25.0;
|
||||
aiDispersionCoefX = 20.0;
|
||||
modes[] += {"ACE_Burst_far"};
|
||||
|
||||
class manual;
|
||||
class burst;
|
||||
class close;
|
||||
class short;
|
||||
class medium;
|
||||
class ACE_Burst_far: medium {
|
||||
aiRateOfFire = 6.0;
|
||||
aiRateOfFireDistance = 900;
|
||||
minRange = 700;
|
||||
minRangeProbab = 0.1;
|
||||
midRange = 900;
|
||||
midRangeProbab = 0.2;
|
||||
maxRange = 1100;
|
||||
maxRangeProbab = 0.2;
|
||||
burst = "3 + round random 5";
|
||||
};
|
||||
|
||||
class far_optic1;
|
||||
class far_optic2;
|
||||
};
|
||||
|
||||
class MMG_02_base_F: Rifle_Long_Base_F {
|
||||
aiDispersionCoefY = 20.0;
|
||||
aiDispersionCoefX = 15.0;
|
||||
modes[] += {"ACE_Burst_far"};
|
||||
|
||||
class manual;
|
||||
class close;
|
||||
class short;
|
||||
class medium;
|
||||
class ACE_Burst_far: medium {
|
||||
aiRateOfFire = 6.0;
|
||||
aiRateOfFireDistance = 900;
|
||||
minRange = 700;
|
||||
minRangeProbab = 0.1;
|
||||
midRange = 900;
|
||||
midRangeProbab = 0.2;
|
||||
maxRange = 1100;
|
||||
maxRangeProbab = 0.2;
|
||||
burst = "3 + round random 5";
|
||||
};
|
||||
|
||||
class far_optic1;
|
||||
class far_optic2;
|
||||
};
|
||||
};
|
||||
|
@ -2,7 +2,7 @@
|
||||
class CfgAmmo {
|
||||
class BulletBase;
|
||||
class B_20mm : BulletBase {
|
||||
hit = 80;
|
||||
hit = 80;
|
||||
indirectHit = 12;
|
||||
indirectHitRange = 2; //2;
|
||||
caliber = 1.4;
|
||||
@ -13,17 +13,17 @@ class CfgAmmo {
|
||||
tracerEndTime = 3.5;
|
||||
|
||||
CraterEffects = "ExploAmmoCrater";
|
||||
explosionEffects = "ExploAmmoExplosion";
|
||||
explosionEffects = "ExploAmmoExplosion";
|
||||
model = "\A3\Weapons_f\Data\bullettracer\tracer_red";
|
||||
};
|
||||
class ACE_20mm_HEDP : B_20mm {};
|
||||
class ACE_20mm_HE : B_20mm {};
|
||||
class ACE_20mm_AP : B_20mm {
|
||||
hit = 50;
|
||||
indirectHit = 12;
|
||||
indirectHitRange = 0.3; //2;
|
||||
explosive = 0;
|
||||
CraterEffects = "";
|
||||
explosionEffects = "";
|
||||
explosionEffects = "";
|
||||
};
|
||||
|
||||
// adjust minigun caliber and deflection to other ammo
|
||||
|
@ -10,7 +10,7 @@ class CfgMagazines {
|
||||
// an extended magazine for the comanche
|
||||
class 300Rnd_20mm_shells;
|
||||
class ACE_500Rnd_20mm_shells_Comanche: 300Rnd_20mm_shells {
|
||||
ammo = "ACE_20mm_HEDP";
|
||||
ammo = "ACE_20mm_HE";
|
||||
count = 500;
|
||||
};
|
||||
};
|
||||
|
@ -907,7 +907,7 @@ class Heli_Attack_01_base_F: Helicopter_Base_F {
|
||||
thermalMode[] = {0,1};
|
||||
gunnerOpticsColor[] = {0,0,0,1};
|
||||
directionStabilized = 1;
|
||||
horizontallyStabilized = 1;
|
||||
horizontallyStabilized = 1;
|
||||
gunnerOpticsModel = "\A3\Weapons_F_Beta\Reticle\Heli_Attack_01_Optics_Gunner_wide_F";
|
||||
};
|
||||
class Medium: Wide
|
||||
@ -918,7 +918,7 @@ class Heli_Attack_01_base_F: Helicopter_Base_F {
|
||||
maxFov = 0.093;
|
||||
gunnerOpticsColor[] = {0,0,0,1};
|
||||
directionStabilized = 1;
|
||||
horizontallyStabilized = 1;
|
||||
horizontallyStabilized = 1;
|
||||
gunnerOpticsModel = "\A3\Weapons_F_Beta\Reticle\Heli_Attack_01_Optics_Gunner_medium_F";
|
||||
};
|
||||
class Narrow: Wide
|
||||
@ -929,7 +929,7 @@ class Heli_Attack_01_base_F: Helicopter_Base_F {
|
||||
maxFov = 0.029;
|
||||
gunnerOpticsColor[] = {0,0,0,1};
|
||||
directionStabilized = 1;
|
||||
horizontallyStabilized = 1;
|
||||
horizontallyStabilized = 1;
|
||||
gunnerOpticsModel = "\A3\Weapons_F_Beta\Reticle\Heli_Attack_01_Optics_Gunner_narrow_F";
|
||||
|
||||
};
|
||||
@ -941,7 +941,7 @@ class Heli_Attack_01_base_F: Helicopter_Base_F {
|
||||
maxFov = 0.01;
|
||||
gunnerOpticsColor[] = {0,0,0,1};
|
||||
directionStabilized = 1;
|
||||
horizontallyStabilized = 1;
|
||||
horizontallyStabilized = 1;
|
||||
gunnerOpticsModel = "\A3\Weapons_F_Beta\Reticle\Heli_Attack_01_Optics_Gunner_narrow_F";
|
||||
|
||||
};
|
||||
|
@ -1,50 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Edited with tabler - 2014-12-12 -->
|
||||
<Project name="ACE">
|
||||
<Package name="Aircraft">
|
||||
<Key ID="STR_ACE_Aircraft_CMFlareLauncher_Burst_Name">
|
||||
<English>Burst</English>
|
||||
<German>Feuerstoß</German>
|
||||
<Spanish>Ráfaga</Spanish>
|
||||
<Polish>Seria</Polish>
|
||||
<Czech>Dávka</Czech>
|
||||
<French>Rafale</French>
|
||||
<Russian>Очередь</Russian>
|
||||
<Hungarian>Sorozat</Hungarian>
|
||||
<Portuguese>Rajada</Portuguese>
|
||||
<Italian>Raffica</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Aircraft_gatling_20mm_Name">
|
||||
<English>XM301</English>
|
||||
<German>XM301</German>
|
||||
<Spanish>XM301</Spanish>
|
||||
<Polish>XM301</Polish>
|
||||
<Czech>XM301</Czech>
|
||||
<French>XM301</French>
|
||||
<Russian>XM301</Russian>
|
||||
<Hungarian>XM301</Hungarian>
|
||||
<Portuguese>XM301</Portuguese>
|
||||
<Italian>XM301</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Aircraft_OpenCargoRamp">
|
||||
<English>Open Cargo Door</English>
|
||||
<German>Laderampe öffnen</German>
|
||||
<Spanish>Abrir compuerta de carga</Spanish>
|
||||
<French>Ourvir Rampe Cargo</French>
|
||||
<Polish>Otwórz drzwi ładowni</Polish>
|
||||
<Czech>Otevřít nákladní prostor</Czech>
|
||||
<Hungarian>Rámpát kinyitni</Hungarian>
|
||||
<Russian>Открыть грузовой отсек</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Aircraft_CloseCargoRamp">
|
||||
<English>Close Cargo Door</English>
|
||||
<German>Laderampe schließen</German>
|
||||
<Spanish>Cerrar compuerta de carga</Spanish>
|
||||
<French>Fermer Rampe Cargo</French>
|
||||
<Polish>Zamknij drzwi ładowni</Polish>
|
||||
<Czech>Zavřít nákladní prostor</Czech>
|
||||
<Hungarian>Rámpát zárni</Hungarian>
|
||||
<Russian>Закрыть грузовой отсек</Russian>
|
||||
</Key>
|
||||
</Package>
|
||||
<Package name="Aircraft">
|
||||
<Key ID="STR_ACE_Aircraft_CMFlareLauncher_Burst_Name">
|
||||
<English>Burst</English>
|
||||
<German>Feuerstoß</German>
|
||||
<Spanish>Ráfaga</Spanish>
|
||||
<Polish>Seria</Polish>
|
||||
<Czech>Dávka</Czech>
|
||||
<French>Contre mesure</French>
|
||||
<Russian>Очередь</Russian>
|
||||
<Hungarian>Sorozat</Hungarian>
|
||||
<Portuguese>Rajada</Portuguese>
|
||||
<Italian>Raffica</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Aircraft_gatling_20mm_Name">
|
||||
<English>XM301</English>
|
||||
<German>XM301</German>
|
||||
<Spanish>XM301</Spanish>
|
||||
<Polish>XM301</Polish>
|
||||
<Czech>XM301</Czech>
|
||||
<French>XM301</French>
|
||||
<Russian>XM301</Russian>
|
||||
<Hungarian>XM301</Hungarian>
|
||||
<Portuguese>XM301</Portuguese>
|
||||
<Italian>XM301</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Aircraft_OpenCargoRamp">
|
||||
<English>Open Cargo Door</English>
|
||||
<German>Laderampe öffnen</German>
|
||||
<Spanish>Abrir compuerta de carga</Spanish>
|
||||
<French>Ourvir rampe cargo</French>
|
||||
<Polish>Otwórz drzwi ładowni</Polish>
|
||||
<Czech>Otevřít nákladní prostor</Czech>
|
||||
<Hungarian>Rakodórámpa nyitása</Hungarian>
|
||||
<Russian>Открыть грузовой отсек</Russian>
|
||||
<Italian>Apri la porta del cargo</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Aircraft_CloseCargoRamp">
|
||||
<English>Close Cargo Door</English>
|
||||
<German>Laderampe schließen</German>
|
||||
<Spanish>Cerrar compuerta de carga</Spanish>
|
||||
<French>Fermer rampe cargo</French>
|
||||
<Polish>Zamknij drzwi ładowni</Polish>
|
||||
<Czech>Zavřít nákladní prostor</Czech>
|
||||
<Hungarian>Rakodórámpa zárása</Hungarian>
|
||||
<Russian>Закрыть грузовой отсек</Russian>
|
||||
<Italian>Chiudi la porta del cargo</Italian>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
|
11
addons/atragmx/CfgEventHandlers.hpp
Normal file
11
addons/atragmx/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE( call COMPILE_FILE(XEH_preInit) );
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE( call COMPILE_FILE(XEH_postInit) );
|
||||
};
|
||||
};
|
40
addons/atragmx/CfgVehicles.hpp
Normal file
40
addons/atragmx/CfgVehicles.hpp
Normal file
@ -0,0 +1,40 @@
|
||||
class CfgVehicles {
|
||||
class Man;
|
||||
class CAManBase: Man {
|
||||
class ACE_SelfActions {
|
||||
class ACE_Equipment {
|
||||
class GVAR(open) {
|
||||
displayName = "$STR_ACE_ATragMX_OpenATragMXDialog";
|
||||
condition = QUOTE(call FUNC(can_show));
|
||||
statement = QUOTE(call FUNC(create_dialog));
|
||||
showDisabled = 0;
|
||||
priority = 2;
|
||||
icon = PATHTOF(UI\ATRAG_Icon.paa);
|
||||
exceptions[] = {"notOnMap", "isNotInside"};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Item_Base_F;
|
||||
class ACE_Item_ATragMX: Item_Base_F {
|
||||
author = "Ruthberg";
|
||||
scope = 2;
|
||||
scopeCurator = 2;
|
||||
displayName = "ATragMX";
|
||||
vehicleClass = "Items";
|
||||
class TransportItems {
|
||||
class ACE_ATragMX {
|
||||
name = "ACE_ATragMX";
|
||||
count = 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Box_NATO_Support_F;
|
||||
class ACE_Box_Misc: Box_NATO_Support_F {
|
||||
class TransportItems {
|
||||
MACRO_ADDITEM(ACE_ATragMX,6);
|
||||
};
|
||||
};
|
||||
};
|
20
addons/atragmx/CfgWeapons.hpp
Normal file
20
addons/atragmx/CfgWeapons.hpp
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
class CfgWeapons {
|
||||
class ACE_ItemCore;
|
||||
class InventoryItem_Base_F;
|
||||
|
||||
class ACE_ATragMX: ACE_ItemCore {
|
||||
author = "Ruthberg";
|
||||
scope = 2;
|
||||
displayName = "$STR_ACE_ATragMX_Name";
|
||||
descriptionShort = "$STR_ACE_ATragMX_Description";
|
||||
model = PATHTOF(data\tdsrecon.p3d);
|
||||
picture = PATHTOF(UI\ATRAG_Icon.paa);
|
||||
icon = "iconObject_circle";
|
||||
mapSize = 0.034;
|
||||
|
||||
class ItemInfo: InventoryItem_Base_F {
|
||||
mass = 2;
|
||||
};
|
||||
};
|
||||
};
|
10
addons/atragmx/README.md
Normal file
10
addons/atragmx/README.md
Normal file
@ -0,0 +1,10 @@
|
||||
ace_atragmx
|
||||
===============
|
||||
|
||||
ATragMX - Handheld ballistics calculator
|
||||
|
||||
## Maintainers
|
||||
|
||||
The people responsible for merging changes to this component or answering potential questions.
|
||||
|
||||
- [Ruthberg] (http://github.com/Ulteq)
|
1345
addons/atragmx/RscTitles.hpp
Normal file
1345
addons/atragmx/RscTitles.hpp
Normal file
File diff suppressed because it is too large
Load Diff
BIN
addons/atragmx/UI/ATRAG.paa
Normal file
BIN
addons/atragmx/UI/ATRAG.paa
Normal file
Binary file not shown.
BIN
addons/atragmx/UI/ATRAG_Icon.paa
Normal file
BIN
addons/atragmx/UI/ATRAG_Icon.paa
Normal file
Binary file not shown.
49
addons/atragmx/XEH_postInit.sqf
Normal file
49
addons/atragmx/XEH_postInit.sqf
Normal file
@ -0,0 +1,49 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#include "initKeybinds.sqf"
|
||||
|
||||
if ((profileNamespace getVariable ["ACE_ATragMX_profileNamespaceVersion", 0]) == ATRAGMX_PROFILE_NAMESPACE_VERSION && count (profileNamespace getVariable ["ACE_ATragMX_gunList", []]) > 0) then {
|
||||
GVAR(gunList) = profileNamespace getVariable "ACE_ATragMX_gunList";
|
||||
} else {
|
||||
// Profile Name, Muzzle Velocity, Zero Range, Scope Base Angle, AirFriction, Bore Height, Scope Unit, Scope Click Unit, Scope Click Number, Maximum Elevation, Dialed Elevation, Dialed Windage, Mass, Bullet Diameter, Rifle Twist, BC, Drag Model, Atmosphere Model
|
||||
GVAR(gunList) = [["12.7x108mm" , 820, 100, 0.0659, -0.0008600, 3.81, 0, 2, 10, 120, 0, 0, 48.28, 12.7, 38.10, 0.630, 1, "ASM" ],
|
||||
|
||||
["12.7x99mm AMAX" , 860, 100, 0.0612, -0.0008600, 3.81, 0, 2, 10, 120, 0, 0, 48.60, 12.7, 38.10, 1.050, 1, "ASM" ],
|
||||
["12.7x99mm" , 853, 100, 0.0623, -0.0008600, 3.81, 0, 2, 10, 120, 0, 0, 41.92, 12.7, 38.10, 0.670, 1, "ASM" ],
|
||||
|
||||
["12.7x54mm" , 300, 100, 0.3394, -0.0014000, 3.81, 0, 2, 10, 120, 0, 0, 48.60, 12.7, 24.13, 1.050, 1, "ASM" ],
|
||||
|
||||
[".408 Chey Tac" , 910, 100, 0.0569, -0.0004800, 3.81, 0, 2, 10, 120, 0, 0, 27.15, 10.4, 33.02, 0.970, 1, "ASM" ],
|
||||
|
||||
["9.3×64mm" , 870, 100, 0.0619, -0.0007500, 3.81, 0, 2, 10, 120, 0, 0, 14.90, 9.30, 35.56, 0.368, 1, "ASM" ],
|
||||
|
||||
[".338LM 250gr" , 880, 100, 0.0598, -0.0006060, 3.81, 0, 2, 10, 120, 0, 0, 16.20, 8.58, 25.40, 0.322, 7, "ICAO"],
|
||||
[".338LM 300gr" , 800, 100, 0.0677, -0.0005350, 3.81, 0, 2, 10, 120, 0, 0, 19.44, 8.58, 25.40, 0.381, 7, "ICAO"],
|
||||
[".338LM API526" , 880, 100, 0.0601, -0.0006730, 3.81, 0, 2, 10, 120, 0, 0, 16.39, 8.58, 25.40, 0.290, 7, "ICAO"],
|
||||
|
||||
[".300WM Mk248 Mod 0", 900, 100, 0.0584, -0.0008300, 3.81, 0, 2, 10, 120, 0, 0, 13.31, 7.80, 25.40, 0.268, 7, "ICAO"],
|
||||
[".300WM Mk248 Mod 1", 867, 100, 0.0611, -0.0008150, 3.81, 0, 2, 10, 120, 0, 0, 14.26, 7.80, 25.40, 0.310, 7, "ICAO"],
|
||||
[".300WM Berger OTM" , 853, 100, 0.0622, -0.0007600, 3.81, 0, 2, 10, 120, 0, 0, 14.90, 7.80, 25.40, 0.368, 7, "ICAO"],
|
||||
|
||||
["7.62x54mmR" , 800, 100, 0.0692, -0.0010230, 3.81, 0, 2, 10, 120, 0, 0, 9.849, 7.92, 24.13, 0.400, 1, "ICAO"],
|
||||
|
||||
["7.62x51mm M80" , 810, 100, 0.0679, -0.0010350, 3.81, 0, 2, 10, 120, 0, 0, 9.525, 7.82, 25.40, 0.200, 7, "ICAO"],
|
||||
["7.62x51mm M118LR" , 820, 100, 0.0662, -0.0008525, 3.81, 0, 2, 10, 120, 0, 0, 11.34, 7.82, 25.40, 0.243, 7, "ICAO"],
|
||||
["7.62x51mm Mk319" , 820, 100, 0.0670, -0.0010300, 3.81, 0, 2, 10, 120, 0, 0, 8.424, 7.82, 25.40, 0.377, 1, "ICAO"],
|
||||
["7.62x51mm Subsonic", 320, 100, 0.3060, -0.0004910, 3.81, 0, 2, 10, 120, 0, 0, 12.96, 7.82, 25.40, 0.235, 7, "ICAO"],
|
||||
|
||||
["6.5x39mm" , 800, 100, 0.0683, -0.0007850, 3.81, 0, 2, 10, 120, 0, 0, 7.970, 6.71, 22.86, 0.263, 7, "ICAO"],
|
||||
["6.5x47mm Lapua" , 800, 100, 0.0682, -0.0007710, 3.81, 0, 2, 10, 120, 0, 0, 9.007, 6.71, 22.86, 0.290, 7, "ICAO"],
|
||||
|
||||
["5.56x45mm M855" , 870, 100, 0.0626, -0.0012650, 3.81, 0, 2, 10, 120, 0, 0, 4.018, 5.70, 17.78, 0.151, 7, "ASM" ],
|
||||
["5.56x45mm Mk262" , 820, 100, 0.0671, -0.0011250, 3.81, 0, 2, 10, 120, 0, 0, 4.990, 5.70, 17.78, 0.361, 1, "ASM" ],
|
||||
["5.56x45mm Mk318" , 880, 100, 0.0616, -0.0011200, 3.81, 0, 2, 10, 120, 0, 0, 4.018, 5.70, 17.78, 0.307, 1, "ASM" ]];
|
||||
|
||||
[] call FUNC(clear_user_data);
|
||||
profileNamespace setVariable ["ACE_ATragMX_gunList", GVAR(gunList)];
|
||||
};
|
||||
|
||||
[] call FUNC(init);
|
||||
[] call FUNC(restore_user_data);
|
||||
|
||||
["RangerfinderData", {_this call FUNC(sord)}] call EFUNC(common,addEventHandler);
|
68
addons/atragmx/XEH_preInit.sqf
Normal file
68
addons/atragmx/XEH_preInit.sqf
Normal file
@ -0,0 +1,68 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(add_new_gun);
|
||||
PREP(calculate_range_card);
|
||||
PREP(calculate_scope_base_angle);
|
||||
PREP(calculate_solution);
|
||||
PREP(calculate_target_range_assist);
|
||||
PREP(calculate_target_solution);
|
||||
PREP(calculate_target_speed_assist);
|
||||
PREP(can_show);
|
||||
PREP(change_gun);
|
||||
PREP(change_target_slot);
|
||||
PREP(clear_user_data);
|
||||
PREP(create_dialog);
|
||||
PREP(cycle_gun_list);
|
||||
PREP(cycle_image_size_units);
|
||||
PREP(cycle_num_ticks_units);
|
||||
PREP(cycle_range_card_columns);
|
||||
PREP(cycle_scope_unit);
|
||||
PREP(cycle_target_size_units);
|
||||
PREP(delete_gun);
|
||||
PREP(init);
|
||||
PREP(parse_input);
|
||||
PREP(reset_relative_click_memory);
|
||||
PREP(restore_atmo_default);
|
||||
PREP(restore_user_data);
|
||||
PREP(save_gun);
|
||||
PREP(show_add_new_gun);
|
||||
PREP(show_atmo_env_data);
|
||||
PREP(show_gun_ammo_data);
|
||||
PREP(show_gun_list);
|
||||
PREP(show_main_page);
|
||||
PREP(show_range_card);
|
||||
PREP(show_range_card_setup);
|
||||
PREP(show_target_data);
|
||||
PREP(show_target_range_assist);
|
||||
PREP(show_target_speed_assist);
|
||||
PREP(show_target_speed_assist_timer);
|
||||
PREP(sord);
|
||||
PREP(store_user_data);
|
||||
PREP(target_speed_assist_timer);
|
||||
PREP(toggle_atmo_env_data);
|
||||
PREP(toggle_gun_ammo_data);
|
||||
PREP(toggle_gun_list);
|
||||
PREP(toggle_range_card);
|
||||
PREP(toggle_range_card_setup);
|
||||
PREP(toggle_target_data);
|
||||
PREP(toggle_target_range_assist);
|
||||
PREP(toggle_target_speed_assist);
|
||||
PREP(update_atmosphere);
|
||||
PREP(update_atmo_env_data);
|
||||
PREP(update_atmo_selection);
|
||||
PREP(update_gun);
|
||||
PREP(update_gun_ammo_data);
|
||||
PREP(update_inclination_angle);
|
||||
PREP(update_range_card);
|
||||
PREP(update_relative_click_memory);
|
||||
PREP(update_result);
|
||||
PREP(update_scope_unit);
|
||||
PREP(update_target);
|
||||
PREP(update_target_data);
|
||||
PREP(update_target_selection);
|
||||
PREP(update_unit_selection);
|
||||
PREP(update_zero_range);
|
||||
|
||||
ADDON = true;
|
17
addons/atragmx/config.cpp
Normal file
17
addons/atragmx/config.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
units[] = {"ACE_Item_ATragMX"};
|
||||
weapons[] = {"ACE_ATragMX"};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ACE_common", "ACE_weather"};
|
||||
author = "Ruthberg";
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgWeapons.hpp"
|
||||
#include "RscTitles.hpp"
|
BIN
addons/atragmx/data/tdsrecon.p3d
Normal file
BIN
addons/atragmx/data/tdsrecon.p3d
Normal file
Binary file not shown.
69
addons/atragmx/data/tdsrecon.rvmat
Normal file
69
addons/atragmx/data/tdsrecon.rvmat
Normal file
@ -0,0 +1,69 @@
|
||||
class StageTI {
|
||||
texture="a3\data_f\default_ti_ca.paa";
|
||||
};
|
||||
ambient[]={1,1,1,1};
|
||||
diffuse[]={1,1,1,1};
|
||||
forcedDiffuse[]={0,0,0,0};
|
||||
emmisive[]={0,0,0,1};
|
||||
specular[]={0.05000001,0.05000001,0.05000001,1};
|
||||
specularPower=50;
|
||||
PixelShaderID="Super";
|
||||
VertexShaderID="Super";
|
||||
class Stage1 {
|
||||
texture="z\ace\addons\atragmx\data\tdsrecon_nohq.paa";
|
||||
uvSource="tex";
|
||||
class uvTransform {
|
||||
aside[]={1,0,0};
|
||||
up[]={0,1,0};
|
||||
dir[]={0,0,0};
|
||||
pos[]={0,0,0};
|
||||
};
|
||||
};
|
||||
class Stage2 {
|
||||
texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)";
|
||||
uvSource="tex";
|
||||
class uvTransform {
|
||||
aside[]={0,9,0};
|
||||
up[]={4.5,0,0};
|
||||
dir[]={0,0,0};
|
||||
pos[]={0,0,0};
|
||||
};
|
||||
};
|
||||
class Stage3 {
|
||||
texture="#(argb,8,8,3)color(0,0,0,0)";
|
||||
uvSource="tex";
|
||||
class uvTransform {
|
||||
aside[]={1,0,0};
|
||||
up[]={0,1,0};
|
||||
dir[]={0,0,0};
|
||||
pos[]={0,0,0};
|
||||
};
|
||||
};
|
||||
class Stage4 {
|
||||
texture="#(argb,8,8,3)color(1,1,1,1,AS)";
|
||||
uvSource="tex";
|
||||
class uvTransform {
|
||||
aside[]={1,0,0};
|
||||
up[]={0,1,0};
|
||||
dir[]={0,0,0};
|
||||
pos[]={0,0,0};
|
||||
};
|
||||
};
|
||||
class Stage5 {
|
||||
texture="#(argb,8,8,3)color(1,1,1,1,SMDI)";
|
||||
uvSource="tex";
|
||||
class uvTransform {
|
||||
aside[]={1,0,0};
|
||||
up[]={0,1,0};
|
||||
dir[]={0,0,0};
|
||||
pos[]={0,0,0};
|
||||
};
|
||||
};
|
||||
class Stage6 {
|
||||
texture="#(ai,64,64,1)fresnel(1.5,1.22)";
|
||||
uvSource="none";
|
||||
};
|
||||
class Stage7 {
|
||||
texture="a3\data_f\env_land_co.paa";
|
||||
uvSource="none";
|
||||
};
|
BIN
addons/atragmx/data/tdsrecon_co.paa
Normal file
BIN
addons/atragmx/data/tdsrecon_co.paa
Normal file
Binary file not shown.
BIN
addons/atragmx/data/tdsrecon_nohq.paa
Normal file
BIN
addons/atragmx/data/tdsrecon_nohq.paa
Normal file
Binary file not shown.
29
addons/atragmx/functions/fnc_add_new_gun.sqf
Normal file
29
addons/atragmx/functions/fnc_add_new_gun.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Adds a new (default) gun profile to the profileNamespace
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_add_new_gun
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#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"];
|
||||
|
||||
GVAR(gunList) = GVAR(gunList) + [_gunProfileEntry];
|
||||
|
||||
lbAdd [6000, _gunProfileEntry select 0];
|
||||
|
||||
profileNamespace setVariable ["ACE_ATragMX_gunList", GVAR(gunList)];
|
||||
};
|
80
addons/atragmx/functions/fnc_calculate_range_card.sqf
Normal file
80
addons/atragmx/functions/fnc_calculate_range_card.sqf
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Calculates the range card output based on the current data set
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_calculate_range_card
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
[] call FUNC(parse_input);
|
||||
|
||||
private ["_scopeBaseAngle"];
|
||||
_scopeBaseAngle = (GVAR(workingMemory) select 3);
|
||||
|
||||
private ["_bulletMass", "_bulletDiameter", "_boreHeight", "_airFriction", "_barrelTwist", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel", "_twistDirection"];
|
||||
_bulletMass = GVAR(workingMemory) select 12;
|
||||
_bulletDiameter = GVAR(workingMemory) select 13;
|
||||
_boreHeight = GVAR(workingMemory) select 5;
|
||||
_airFriction = GVAR(workingMemory) select 4;
|
||||
_barrelTwist = GVAR(workingMemory) select 14;
|
||||
_muzzleVelocity = GVAR(workingMemory) select 1;
|
||||
_bc = GVAR(workingMemory) select 15;
|
||||
_dragModel = GVAR(workingMemory) select 16;
|
||||
_atmosphereModel = GVAR(workingMemory) select 17;
|
||||
|
||||
_twistDirection = 0;
|
||||
if (_barrelTwist > 0) then {
|
||||
_twistDirection = 1;
|
||||
} else {
|
||||
if (_barrelTwist < 0) then {
|
||||
_twistDirection = -1;
|
||||
};
|
||||
};
|
||||
_barrelTwist = abs(_barrelTwist);
|
||||
|
||||
private ["_altitude", "_temperature", "_barometricPressure", "_relativeHumidity"];
|
||||
_altitude = GVAR(altitude);
|
||||
_temperature = GVAR(temperature);
|
||||
_barometricPressure = GVAR(barometricPressure);
|
||||
_relativeHumidity = GVAR(relativeHumidity);
|
||||
if (!GVAR(atmosphereModeTBH)) then {
|
||||
_barometricPressure = 1013.25 * exp(-(_altitude) / 7990);
|
||||
_relativeHumidity = 50;
|
||||
};
|
||||
|
||||
private ["_bulletLength", "_stabilityFactor"];
|
||||
_bulletLength = 1.8;
|
||||
_stabilityFactor = 1.5;
|
||||
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false])) then {
|
||||
if (_bulletDiameter > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then {
|
||||
_stabilityFactor = [_bulletDiameter / 10 / 2.54, _bulletLength, _bulletMass * 15.4323584, _barrelTwist / 2.54, _muzzleVelocity, _temperature, _barometricPressure] call EFUNC(advanced_ballistics,calculateStabilityFactor);
|
||||
};
|
||||
};
|
||||
|
||||
private ["_latitude", "_directionOfFire", "_windSpeed1", "_windSpeed2", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange"];
|
||||
_latitude = GVAR(latitude) select GVAR(currentTarget);
|
||||
_directionOfFire = GVAR(directionOfFire) select GVAR(currentTarget);
|
||||
_windSpeed1 = (GVAR(windSpeed1) select GVAR(currentTarget));
|
||||
_windSpeed2 = (GVAR(windSpeed2) select GVAR(currentTarget));
|
||||
_windDirection = (GVAR(windDirection) select GVAR(currentTarget));
|
||||
_inclinationAngle = (GVAR(inclinationAngle) select GVAR(currentTarget));
|
||||
_targetSpeed = (GVAR(targetSpeed) select GVAR(currentTarget));
|
||||
_targetRange = GVAR(rangeCardEndRange);
|
||||
if (GVAR(currentUnit) == 1) then {
|
||||
_targetRange = _targetRange / 1.0936133;
|
||||
};
|
||||
|
||||
GVAR(rangeCardData) = [];
|
||||
|
||||
private ["_result"];
|
||||
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000,
|
||||
[_windSpeed1, _windSpeed2], _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, true, _stabilityFactor, _twistDirection, _latitude, _directionOfFire] call FUNC(calculate_solution);
|
40
addons/atragmx/functions/fnc_calculate_scope_base_angle.sqf
Normal file
40
addons/atragmx/functions/fnc_calculate_scope_base_angle.sqf
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Calculates a new scope base angle
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Bullet mass <NUMBER>
|
||||
* 1: Bore height <NUMBER>
|
||||
* 2: air friction <NUMBER>
|
||||
* 3: muzzle velocity <NUMBER>
|
||||
* 4: zero range <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* scope base angle <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_calculate_scope_base_angle
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#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;
|
||||
|
||||
private ["_result"];
|
||||
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, [0, 0], 0, 0, 0, _zeroRange, _airFriction, 1, "ICAO", false, 1.5, 0, 0, 0] call FUNC(calculate_solution);
|
||||
|
||||
_scopeBaseAngle + (_result select 0) / 60
|
239
addons/atragmx/functions/fnc_calculate_solution.sqf
Normal file
239
addons/atragmx/functions/fnc_calculate_solution.sqf
Normal file
@ -0,0 +1,239 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Calculates the fireing solution
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Scope base angle <NUMBER>
|
||||
* 1: Bullet mass <NUMBER>
|
||||
* 2: Bore height <NUMBER>
|
||||
* 3: air friction <NUMBER>
|
||||
* 4: muzzle velocity <NUMBER>
|
||||
* 5: temperature <NUMBER>
|
||||
* 6: barometric pressure <NUMBER>
|
||||
* 7: relative humidity <NUMBER>
|
||||
* 8: simulation steps <NUMBER>
|
||||
* 9: wind speed <ARRAY>
|
||||
* 10: wind direction <NUMBER>
|
||||
* 11: inclination angle <NUMBER>
|
||||
* 12: target speed <NUMBER>
|
||||
* 13: target range <NUMBER>
|
||||
* 14: ballistic coefficient <NUMBER>
|
||||
* 15: drag model <NUMBER>
|
||||
* 16: atmosphere model <STRING>
|
||||
* 17: Store range card data? <BOOL>
|
||||
* 18: Stability factor <NUMBER>
|
||||
* 19: Twist Direction <NUMBER>
|
||||
* 20: Latitude <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* 0: Elevation (MOA) <NUMBER>
|
||||
* 1: Windage (MOA) <ARRAY>
|
||||
* 2: Lead (MOA) <NUMBER>
|
||||
* 3: Time of fligth (SECONDS) <NUMBER>
|
||||
* 4: Remaining velocity (m/s) <NUMBER>
|
||||
* 5: Remaining kinetic energy (ft·lb) <NUMBER>
|
||||
* 6: Vertical coriolis drift (MOA) <NUMBER>
|
||||
* 7: Horizontal coriolis drift (MOA) <NUMBER>
|
||||
* 8: Spin drift (MOA) <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_calculate_target_range_assist
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_scopeBaseAngle", "_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_temperature", "_barometricPressure", "_relativeHumidity", "_simSteps", "_windSpeed1", "_windSpeed2", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange", "_drag", "_bc", "_dragModel", "_atmosphereModel", "_storeRangeCardData", "_stabilityFactor", "_twistDirection", "_latitude", "_directionOfFire"];
|
||||
_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;
|
||||
_windSpeed1 = (_this select 9) select 0;
|
||||
_windSpeed2 = (_this select 9) select 1;
|
||||
_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;
|
||||
_stabilityFactor = _this select 18;
|
||||
_twistDirection = _this select 19;
|
||||
_latitude = _this select 20;
|
||||
_directionOfFire = _this select 21;
|
||||
|
||||
private ["_bulletPos", "_bulletVelocity", "_bulletAccel", "_bulletSpeed", "_gravity", "_deltaT"];
|
||||
_bulletPos = [0, 0, 0];
|
||||
_bulletVelocity = [0, 0, 0];
|
||||
_bulletAccel = [0, 0, 0];
|
||||
_bulletSpeed = 0;
|
||||
_gravity = [0, sin(_scopeBaseAngle + _inclinationAngle) * -9.80665, cos(_scopeBaseAngle + _inclinationAngle) * -9.80665];
|
||||
_deltaT = 1 / _simSteps;
|
||||
|
||||
private ["_elevation", "_windage1", "_windage2", "_lead", "_TOF", "_trueVelocity", "_trueSpeed", "_kineticEnergy", "_verticalCoriolis", "_verticalDeflection", "_horizontalCoriolis", "_horizontalDeflection", "_spinDrift", "_spinDeflection"];
|
||||
_elevation = 0;
|
||||
_windage1 = 0;
|
||||
_windage2 = 0;
|
||||
_lead = 0;
|
||||
_TOF = 0;
|
||||
_trueVelocity = [0, 0, 0];
|
||||
_trueSpeed = 0;
|
||||
_verticalCoriolis = 0;
|
||||
_verticalDeflection = 0;
|
||||
_horizontalCoriolis = 0;
|
||||
_horizontalDeflection = 0;
|
||||
_spinDrift = 0;
|
||||
_spinDeflection = 0;
|
||||
|
||||
private ["_n", "_range", "_rangeFactor"];
|
||||
_n = 0;
|
||||
_range = 0;
|
||||
_rangeFactor = 1;
|
||||
if (_storeRangeCardData) then {
|
||||
if (GVAR(currentUnit) == 1) then {
|
||||
_rangeFactor = 1.0936133;
|
||||
};
|
||||
GVAR(rangeCardData) = [];
|
||||
};
|
||||
|
||||
private ["_wind1", "_wind2", "_windDrift"];
|
||||
_wind1 = [cos(270 - _windDirection * 30) * _windSpeed1, sin(270 - _windDirection * 30) * _windSpeed1, 0];
|
||||
_wind2 = [cos(270 - _windDirection * 30) * _windSpeed2, sin(270 - _windDirection * 30) * _windSpeed2, 0];
|
||||
_windDrift = 0;
|
||||
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then {
|
||||
_bc = [_bc, _temperature, _barometricPressure, _relativeHumidity, _atmosphereModel] call EFUNC(advanced_ballistics,calculateAtmosphericCorrection);
|
||||
};
|
||||
|
||||
private ["_speedTotal", "_stepsTotal", "_speedAverage"];
|
||||
_speedTotal = 0;
|
||||
_stepsTotal = 0;
|
||||
_speedAverage = 0;
|
||||
|
||||
private ["_eoetvoesMultiplier"];
|
||||
_eoetvoesMultiplier = 0;
|
||||
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,EoetvoesEnabled), false]) then {
|
||||
_eoetvoesMultiplier = 2 * (0.0000729 * _muzzleVelocity / -9.80665) * cos(_latitude) * sin(_directionOfFire);
|
||||
};
|
||||
|
||||
_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;
|
||||
|
||||
_speedTotal = _speedTotal + _bulletSpeed;
|
||||
_stepsTotal = _stepsTotal + 1;
|
||||
_speedAverage = (_speedTotal / _stepsTotal);
|
||||
|
||||
_trueVelocity = _bulletVelocity vectorDiff _wind1;
|
||||
_trueSpeed = vectorMagnitude _trueVelocity;
|
||||
|
||||
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
|
||||
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false]) then {
|
||||
_drag = if (missionNamespace getVariable [QEGVAR(advanced_ballistics,extensionAvailable), false]) then {
|
||||
parseNumber(("ace_advanced_ballistics" callExtension format["retard:%1:%2:%3", _dragModel, _bc, _trueSpeed]))
|
||||
} else {
|
||||
([_dragModel, _bc, _trueSpeed] call EFUNC(advanced_ballistics,calculateRetardation))
|
||||
};
|
||||
_bulletAccel = (vectorNormalized _trueVelocity) vectorMultiply (-1 * _drag);
|
||||
};
|
||||
} else {
|
||||
_bulletAccel = _trueVelocity vectorMultiply (_trueSpeed * _airFriction);
|
||||
};
|
||||
|
||||
_bulletAccel = _bulletAccel vectorAdd _gravity;
|
||||
|
||||
_bulletVelocity = _bulletVelocity vectorAdd (_bulletAccel vectorMultiply _deltaT);
|
||||
_bulletPos = _bulletPos vectorAdd (_bulletVelocity vectorMultiply _deltaT);
|
||||
|
||||
_TOF = _TOF + _deltaT;
|
||||
|
||||
if (_storeRangeCardData) then {
|
||||
_range = GVAR(rangeCardStartRange) + _n * GVAR(rangeCardIncrement);
|
||||
if ((_bulletPos select 1) * _rangeFactor >= _range && _range <= GVAR(rangeCardEndRange)) then {
|
||||
if ((_bulletPos select 1) > 0) then {
|
||||
_elevation = - atan((_bulletPos select 2) / (_bulletPos select 1));
|
||||
_windage1 = - atan((_bulletPos select 0) / (_bulletPos select 1));
|
||||
_windDrift = (_wind2 select 0) * (_TOF - (_range / _rangeFactor) / _muzzleVelocity);
|
||||
_windage2 = - atan(_windDrift / (_bulletPos select 1));
|
||||
};
|
||||
if (_range != 0) then {
|
||||
_lead = (_targetSpeed * _TOF) / (Tan(3.38 / 60) * _range);
|
||||
};
|
||||
_kineticEnergy = 0.5 * (_bulletMass / 1000 * (_bulletSpeed ^ 2));
|
||||
_kineticEnergy = _kineticEnergy * 0.737562149;
|
||||
|
||||
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (_bulletPos select 1) > 0) then {
|
||||
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,CoriolisEnabled), false]) then {
|
||||
_horizontalDeflection = 0.0000729 * ((_bulletPos select 1) ^ 2) * sin(_latitude) / _speedAverage;
|
||||
_horizontalCoriolis = - atan(_horizontalDeflection / (_bulletPos select 1));
|
||||
_windage1 = _windage1 + _horizontalCoriolis;
|
||||
_windage2 = _windage2 + _horizontalCoriolis;
|
||||
};
|
||||
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,EoetvoesEnabled), false]) then {
|
||||
_verticalDeflection = (_bulletPos select 2) * _eoetvoesMultiplier;
|
||||
_verticalCoriolis = - atan(_verticalDeflection / (_bulletPos select 1));
|
||||
_elevation = _elevation + _verticalCoriolis;
|
||||
};
|
||||
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false]) then {
|
||||
_spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83;
|
||||
_spinDrift = - atan(_spinDeflection / (_bulletPos select 1));
|
||||
_windage1 = _windage1 + _spinDrift;
|
||||
_windage2 = _windage2 + _spinDrift;
|
||||
};
|
||||
};
|
||||
|
||||
GVAR(rangeCardData) set [_n, [_range, _elevation * 60, [_windage1 * 60, _windage2 * 60], _lead, _TOF, _bulletSpeed, _kineticEnergy]];
|
||||
_n = _n + 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if ((_bulletPos select 1) > 0) then {
|
||||
_elevation = - atan((_bulletPos select 2) / (_bulletPos select 1));
|
||||
_windage1 = - atan((_bulletPos select 0) / (_bulletPos select 1));
|
||||
_windDrift = (_wind2 select 0) * (_TOF - _targetRange / _muzzleVelocity);
|
||||
_windage2 = - atan(_windDrift / (_bulletPos select 1));
|
||||
};
|
||||
|
||||
if (_targetRange != 0) then {
|
||||
_lead = (_targetSpeed * _TOF) / (Tan(3.38 / 60) * _targetRange);
|
||||
};
|
||||
|
||||
_kineticEnergy = 0.5 * (_bulletMass / 1000 * (_bulletSpeed ^ 2));
|
||||
_kineticEnergy = _kineticEnergy * 0.737562149;
|
||||
|
||||
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (_bulletPos select 1) > 0) then {
|
||||
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,CoriolisEnabled), false]) then {
|
||||
_horizontalDeflection = 0.0000729 * ((_bulletPos select 1) ^ 2) * sin(_latitude) / _speedAverage;
|
||||
_horizontalCoriolis = - atan(_horizontalDeflection / (_bulletPos select 1));
|
||||
_windage1 = _windage1 + _horizontalCoriolis;
|
||||
_windage2 = _windage2 + _horizontalCoriolis;
|
||||
};
|
||||
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,EoetvoesEnabled), false]) then {
|
||||
_verticalDeflection = (_bulletPos select 2) * _eoetvoesMultiplier;
|
||||
_verticalCoriolis = - atan(_verticalDeflection / (_bulletPos select 1));
|
||||
_elevation = _elevation + _verticalCoriolis;
|
||||
};
|
||||
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false]) then {
|
||||
_spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83;
|
||||
_spinDrift = - atan(_spinDeflection / (_bulletPos select 1));
|
||||
_windage1 = _windage1 + _spinDrift;
|
||||
_windage2 = _windage2 + _spinDrift;
|
||||
};
|
||||
};
|
||||
|
||||
[_elevation * 60, [_windage1 * 60, _windage2 * 60], _lead, _TOF, _bulletSpeed, _kineticEnergy, _verticalCoriolis * 60, _horizontalCoriolis * 60, _spinDrift * 60]
|
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Calculates the target range and updates the output fields
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_calculate_target_range_assist
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_targetSize", "_imageSize", "_angle", "_estRange"];
|
||||
|
||||
_angle = parseNumber(ctrlText 7012);
|
||||
_targetSize = parseNumber(ctrlText 7010);
|
||||
if (GVAR(rangeAssistUseTargetHeight)) then {
|
||||
_targetSize = _targetSize * cos(_angle);
|
||||
};
|
||||
switch (GVAR(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 (GVAR(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 (GVAR(currentUnit) == 1) then {
|
||||
_estRange = _estRange / 1.0936133;
|
||||
};
|
||||
|
||||
switch (_this) do {
|
||||
case 0: {
|
||||
_targetSize = tan(_imageSize) * _estRange;
|
||||
|
||||
if (GVAR(rangeAssistUseTargetHeight)) then {
|
||||
_targetSize = _targetSize / cos(_angle);
|
||||
};
|
||||
|
||||
switch (GVAR(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 (GVAR(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))];
|
||||
};
|
||||
};
|
84
addons/atragmx/functions/fnc_calculate_target_solution.sqf
Normal file
84
addons/atragmx/functions/fnc_calculate_target_solution.sqf
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Calculates the fireing solution and updates the result input/output fields
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_calculate_target_solution
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
[] call FUNC(parse_input);
|
||||
|
||||
private ["_scopeBaseAngle"];
|
||||
_scopeBaseAngle = (GVAR(workingMemory) select 3);
|
||||
|
||||
private ["_bulletMass", "_bulletDiameter", "_boreHeight", "_airFriction", "_barrelTwist", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel", "_twistDirection"];
|
||||
_bulletMass = GVAR(workingMemory) select 12;
|
||||
_bulletDiameter = GVAR(workingMemory) select 13;
|
||||
_boreHeight = GVAR(workingMemory) select 5;
|
||||
_airFriction = GVAR(workingMemory) select 4;
|
||||
_barrelTwist = GVAR(workingMemory) select 14;
|
||||
_muzzleVelocity = GVAR(workingMemory) select 1;
|
||||
_bc = GVAR(workingMemory) select 15;
|
||||
_dragModel = GVAR(workingMemory) select 16;
|
||||
_atmosphereModel = GVAR(workingMemory) select 17;
|
||||
|
||||
_twistDirection = 0;
|
||||
if (_barrelTwist > 0) then {
|
||||
_twistDirection = 1;
|
||||
} else {
|
||||
if (_barrelTwist < 0) then {
|
||||
_twistDirection = -1;
|
||||
};
|
||||
};
|
||||
_barrelTwist = abs(_barrelTwist);
|
||||
|
||||
private ["_altitude", "_temperature", "_barometricPressure", "_relativeHumidity"];
|
||||
_altitude = GVAR(altitude);
|
||||
_temperature = GVAR(temperature);
|
||||
_barometricPressure = GVAR(barometricPressure);
|
||||
_relativeHumidity = GVAR(relativeHumidity);
|
||||
if (!GVAR(atmosphereModeTBH)) then {
|
||||
_barometricPressure = 1013.25 * exp(-(_altitude) / 7990);
|
||||
_relativeHumidity = 50;
|
||||
};
|
||||
|
||||
private ["_bulletLength", "_stabilityFactor"];
|
||||
_bulletLength = 1.8;
|
||||
_stabilityFactor = 1.5;
|
||||
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false])) then {
|
||||
if (_bulletDiameter > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then {
|
||||
_stabilityFactor = [_bulletDiameter / 10 / 2.54, _bulletLength, _bulletMass * 15.4323584, _barrelTwist / 2.54, _muzzleVelocity, _temperature, _barometricPressure] call EFUNC(advanced_ballistics,calculateStabilityFactor);
|
||||
};
|
||||
};
|
||||
|
||||
private ["_latitude", "_directionOfFire", "_windSpeed1", "_windSpeed2", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange"];
|
||||
_latitude = GVAR(latitude) select GVAR(currentTarget);
|
||||
_directionOfFire = GVAR(directionOfFire) select GVAR(currentTarget);
|
||||
_windSpeed1 = GVAR(windSpeed1) select GVAR(currentTarget);
|
||||
_windSpeed2 = GVAR(windSpeed2) select GVAR(currentTarget);
|
||||
_windDirection = GVAR(windDirection) select GVAR(currentTarget);
|
||||
_inclinationAngle = GVAR(inclinationAngle) select GVAR(currentTarget);
|
||||
_targetSpeed = GVAR(targetSpeed) select GVAR(currentTarget);
|
||||
_targetRange = GVAR(targetRange) select GVAR(currentTarget);
|
||||
|
||||
private ["_result"];
|
||||
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000,
|
||||
[_windSpeed1, _windSpeed2], _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, false, _stabilityFactor, _twistDirection, _latitude, _directionOfFire] call FUNC(calculate_solution);
|
||||
|
||||
GVAR(elevationOutput) set [GVAR(currentTarget), _result select 0];
|
||||
GVAR(windage1Output) set [GVAR(currentTarget), (_result select 1) select 0];
|
||||
GVAR(windage2Output) set [GVAR(currentTarget), (_result select 1) select 1];
|
||||
GVAR(leadOutput) set [GVAR(currentTarget), _result select 2];
|
||||
GVAR(tofOutput) set [GVAR(currentTarget), _result select 3];
|
||||
GVAR(velocityOutput) set [GVAR(currentTarget), _result select 4];
|
||||
|
||||
[] call FUNC(update_result);
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Calculates the target speed and updates the output fields
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_calculate_target_speed_assist
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_targetRange", "_numTicks", "_timeSecs", "_estSpeed"];
|
||||
|
||||
_targetRange = parseNumber(ctrlText 8004);
|
||||
_numTicks = parseNumber(ctrlText 8005);
|
||||
_timeSecs = parseNumber(ctrlText 8006);
|
||||
_estSpeed = 0;
|
||||
|
||||
if (GVAR(currentUnit) == 1) then {
|
||||
_targetRange = _targetRange / 1.0936133;
|
||||
};
|
||||
|
||||
switch (GVAR(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 (GVAR(currentUnit) != 2) then {
|
||||
_estSpeed = _estSpeed * 2.23693629;
|
||||
};
|
||||
|
||||
ctrlSetText [8007, Str(Round(_estSpeed * 10) / 10)];
|
18
addons/atragmx/functions/fnc_can_show.sqf
Normal file
18
addons/atragmx/functions/fnc_can_show.sqf
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Authors: Ruthberg
|
||||
* Tests if the ATragMX dialog can be shown
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* can_show <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_can_show
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
(("ACE_ATragMX" in (uniformItems ACE_player)) || ("ACE_ATragMX" in (vestItems ACE_player))) && !(underwater ACE_player);
|
54
addons/atragmx/functions/fnc_change_gun.sqf
Normal file
54
addons/atragmx/functions/fnc_change_gun.sqf
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Selects a new gun profile and updates the gun column and the result input/output fields
|
||||
*
|
||||
* Arguments:
|
||||
* gunID <number>
|
||||
* restore workingMemory from gunList <BOOL>
|
||||
* update display <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_change_gun
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_gunID", "_restoreMemory", "_updateDisplay"];
|
||||
_gunID = _this select 0;
|
||||
_restoreMemory = _this select 1;
|
||||
_updateDisplay = _this select 2;
|
||||
|
||||
if (_gunID < 0 || _gunID > (count GVAR(gunList)) - 1) exitWith {};
|
||||
|
||||
if (_restoreMemory) then {
|
||||
GVAR(workingMemory) = +(GVAR(gunList) select _gunID);
|
||||
};
|
||||
GVAR(currentGun) = _gunID;
|
||||
|
||||
if (_updateDisplay) then {
|
||||
lbSetCurSel [6000, GVAR(currentGun)];
|
||||
};
|
||||
|
||||
GVAR(currentScopeUnit) = 0 max (GVAR(workingMemory) select 6) min 3;
|
||||
GVAR(currentScopeClickUnit) = 0 max (GVAR(workingMemory) select 7) min 2;
|
||||
GVAR(currentScopeClickNumber) = 1 max (GVAR(workingMemory) select 8) min 10;
|
||||
|
||||
if (_updateDisplay) then {
|
||||
[] call FUNC(update_gun);
|
||||
[] call FUNC(update_gun_ammo_data);
|
||||
};
|
||||
|
||||
GVAR(elevationOutput) set [GVAR(currentTarget), 0];
|
||||
GVAR(windage1Output) set [GVAR(currentTarget), 0];
|
||||
GVAR(windage2Output) set [GVAR(currentTarget), 0];
|
||||
GVAR(leadOutput) set [GVAR(currentTarget), 0];
|
||||
GVAR(tofOutput) set [GVAR(currentTarget), 0];
|
||||
GVAR(velocityOutput) set [GVAR(currentTarget), 0];
|
||||
|
||||
if (_updateDisplay) then {
|
||||
[] call FUNC(calculate_target_solution);
|
||||
};
|
26
addons/atragmx/functions/fnc_change_target_slot.sqf
Normal file
26
addons/atragmx/functions/fnc_change_target_slot.sqf
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Selects a target slot (A, B, C or D)
|
||||
*
|
||||
* Arguments:
|
||||
* target <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* 2 call ace_atragmx_fnc_change_target_slot
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_target"];
|
||||
_target = 0 max _this min 3;
|
||||
|
||||
call FUNC(parse_input);
|
||||
|
||||
GVAR(currentTarget) = _target;
|
||||
call FUNC(update_target_selection);
|
||||
|
||||
[] call FUNC(calculate_target_solution);
|
44
addons/atragmx/functions/fnc_clear_user_data.sqf
Normal file
44
addons/atragmx/functions/fnc_clear_user_data.sqf
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Removes all user data from the profileNamespace
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_clear_user_data
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
profileNamespace setVariable ["ACE_ATragMX_gunList", nil];
|
||||
|
||||
profileNamespace setVariable ["ACE_ATragMX_currentUnit", nil];
|
||||
profileNamespace setVariable ["ACE_ATragMX_currentGun", nil];
|
||||
profileNamespace setVariable ["ACE_ATragMX_currentTarget", nil];
|
||||
profileNamespace setVariable ["ACE_ATragMX_currentScopeUnit", nil];
|
||||
|
||||
profileNamespace setVariable ["ACE_ATragMX_atmosphereModeTBH", nil];
|
||||
profileNamespace setVariable ["ACE_ATragMX_altitude", nil];
|
||||
profileNamespace setVariable ["ACE_ATragMX_temperature", nil];
|
||||
profileNamespace setVariable ["ACE_ATragMX_barometricPressure", nil];
|
||||
profileNamespace setVariable ["ACE_ATragMX_relativeHumidity", nil];
|
||||
|
||||
profileNamespace setVariable ["ACE_ATragMX_showWind2", nil];
|
||||
profileNamespace setVariable ["ACE_ATragMX_latitude", nil];
|
||||
profileNamespace setVariable ["ACE_ATragMX_directionOfFire", nil];
|
||||
profileNamespace setVariable ["ACE_ATragMX_windSpeed1", nil];
|
||||
profileNamespace setVariable ["ACE_ATragMX_windSpeed2", nil];
|
||||
profileNamespace setVariable ["ACE_ATragMX_windDirection", nil];
|
||||
profileNamespace setVariable ["ACE_ATragMX_inclinationAngle", nil];
|
||||
profileNamespace setVariable ["ACE_ATragMX_targetSpeed", nil];
|
||||
profileNamespace setVariable ["ACE_ATragMX_targetRange", nil];
|
||||
|
||||
profileNamespace setVariable ["ACE_ATragMX_rangeCardStartRange", nil];
|
||||
profileNamespace setVariable ["ACE_ATragMX_rangeCardEndRange", nil];
|
||||
profileNamespace setVariable ["ACE_ATragMX_rangeCardIncrement", nil];
|
||||
profileNamespace setVariable ["ACE_ATragMX_rangeCardCurrentColumn", nil];
|
49
addons/atragmx/functions/fnc_create_dialog.sqf
Normal file
49
addons/atragmx/functions/fnc_create_dialog.sqf
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Creates the ATragMX dialog
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_create_dialog
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
//if (dialog) exitWith { false };
|
||||
if (underwater ACE_player) exitWith { false };
|
||||
if (!("ACE_ATragMX" in (uniformItems ACE_player)) && !("ACE_ATragMX" in (vestItems ACE_player))) exitWith { false };
|
||||
|
||||
createDialog 'ATragMX_Display';
|
||||
|
||||
call FUNC(update_target_selection);
|
||||
|
||||
GVAR(showMainPage) call FUNC(show_main_page);
|
||||
|
||||
GVAR(showAddNewGun) call FUNC(show_add_new_gun);
|
||||
GVAR(showAtmoEnvData) call FUNC(show_atmo_env_data);
|
||||
GVAR(showGunAmmoData) call FUNC(show_gun_ammo_data);
|
||||
GVAR(showGunList) call FUNC(show_gun_list);
|
||||
GVAR(showRangeCard) call FUNC(show_range_card);
|
||||
if (GVAR(showRangeCard)) then {
|
||||
ctrlSetFocus ((uiNamespace getVariable "ATragMX_Display") displayCtrl 5001);
|
||||
[] call FUNC(update_range_card);
|
||||
};
|
||||
GVAR(showRangeCardSetup) call FUNC(show_range_card_setup);
|
||||
GVAR(showTargetData) call FUNC(show_target_data);
|
||||
GVAR(showTargetRangeAssist) call FUNC(show_target_range_assist);
|
||||
GVAR(showTargetSpeedAssist) call FUNC(show_target_speed_assist);
|
||||
GVAR(showTargetSpeedAssistTimer) call FUNC(show_target_speed_assist_timer);
|
||||
|
||||
[GVAR(currentGun), false, true] call FUNC(change_gun);
|
||||
|
||||
{
|
||||
lbAdd [6000, _x select 0];
|
||||
} forEach GVAR(gunList);
|
||||
|
||||
true
|
20
addons/atragmx/functions/fnc_cycle_gun_list.sqf
Normal file
20
addons/atragmx/functions/fnc_cycle_gun_list.sqf
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Cycles through the gun list
|
||||
*
|
||||
* Arguments:
|
||||
* step <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_cycle_scope_unit
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!(GVAR(showMainPage) || GVAR(showGunList))) exitWith {};
|
||||
|
||||
[(GVAR(currentGun) + (count GVAR(gunList)) + _this) % (count GVAR(gunList)), true, true] call FUNC(change_gun);
|
19
addons/atragmx/functions/fnc_cycle_image_size_units.sqf
Normal file
19
addons/atragmx/functions/fnc_cycle_image_size_units.sqf
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Cycles through the image size units
|
||||
*
|
||||
* Arguments:
|
||||
* step <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_cycle_image_size_units
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(rangeAssistImageSizeUnit) = (GVAR(rangeAssistImageSizeUnit) + 1) % (count GVAR(rangeAssistImageSizeUnits));
|
||||
ctrlSetText [7015, GVAR(rangeAssistImageSizeUnits) select GVAR(rangeAssistImageSizeUnit)];
|
20
addons/atragmx/functions/fnc_cycle_num_ticks_units.sqf
Normal file
20
addons/atragmx/functions/fnc_cycle_num_ticks_units.sqf
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Cycles through the num ticks units
|
||||
*
|
||||
* Arguments:
|
||||
* step <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_cycle_num_ticks_units
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(speedAssistNumTicksUnit) = (GVAR(speedAssistNumTicksUnit) + 1) % (count GVAR(speedAssistNumTicksUnits));
|
||||
ctrlSetText [8009, GVAR(speedAssistNumTicksUnits) select GVAR(speedAssistNumTicksUnit)];
|
||||
call FUNC(calculate_target_speed_assist);
|
22
addons/atragmx/functions/fnc_cycle_range_card_columns.sqf
Normal file
22
addons/atragmx/functions/fnc_cycle_range_card_columns.sqf
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Cycles through the range card columns
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_cycle_range_card_columns
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(rangeCardCurrentColumn) = (GVAR(rangeCardCurrentColumn) + 1) % (count GVAR(rangeCardLastColumns));
|
||||
|
||||
ctrlSetText [5006, (GVAR(rangeCardLastColumns) select GVAR(rangeCardCurrentColumn))];
|
||||
|
||||
[] call FUNC(update_range_card);
|
23
addons/atragmx/functions/fnc_cycle_scope_unit.sqf
Normal file
23
addons/atragmx/functions/fnc_cycle_scope_unit.sqf
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Cycles through the scope units
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_cycle_scope_unit
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
[] call FUNC(parse_input);
|
||||
|
||||
GVAR(currentScopeUnit) = (GVAR(currentScopeUnit) + 1) % (count GVAR(scopeUnits));
|
||||
|
||||
[] call FUNC(update_scope_unit);
|
||||
[] call FUNC(update_result);
|
19
addons/atragmx/functions/fnc_cycle_target_size_units.sqf
Normal file
19
addons/atragmx/functions/fnc_cycle_target_size_units.sqf
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Cycles through the target size units
|
||||
*
|
||||
* Arguments:
|
||||
* step <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_cycle_target_size_units
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(rangeAssistTargetSizeUnit) = (GVAR(rangeAssistTargetSizeUnit) + 1) % (count GVAR(rangeAssistTargetSizeUnits));
|
||||
ctrlSetText [7014, GVAR(rangeAssistTargetSizeUnits) select GVAR(rangeAssistTargetSizeUnit)];
|
32
addons/atragmx/functions/fnc_delete_gun.sqf
Normal file
32
addons/atragmx/functions/fnc_delete_gun.sqf
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Deletes the currently selected gun profile from the profileNamespace
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_delete_gun
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_index"];
|
||||
_index = lbCurSel 6000;
|
||||
|
||||
if (_index == -1) exitWith {};
|
||||
|
||||
if (GVAR(currentGun) > _index) then {
|
||||
GVAR(currentGun) = GVAR(currentGun) - 1;
|
||||
};
|
||||
|
||||
GVAR(gunList) set [_index, 0];
|
||||
GVAR(gunList) = GVAR(gunList) - [0];
|
||||
|
||||
lbDelete [6000, _index];
|
||||
|
||||
profileNamespace setVariable ["ACE_ATragMX_gunList", GVAR(gunList)];
|
80
addons/atragmx/functions/fnc_init.sqf
Normal file
80
addons/atragmx/functions/fnc_init.sqf
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Inits all global variables with the default values
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_init
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(workingMemory) = +(GVAR(gunList) select 0);
|
||||
|
||||
GVAR(scopeUnits) = ["MILs", "TMOA", "SMOA", "Clicks"];
|
||||
GVAR(scopeClickUnits) = ["TMOA", "SMOA", "MILs"];
|
||||
|
||||
GVAR(rangeCardStartRange) = 200;
|
||||
GVAR(rangeCardEndRange) = 2000;
|
||||
GVAR(rangeCardIncrement) = 50;
|
||||
GVAR(rangeCardLastColumns) = ["Lead", "RemV", "RemE", "TmFlt"];
|
||||
GVAR(rangeCardCurrentColumn) = 3;
|
||||
GVAR(rangeCardData) = [];
|
||||
|
||||
GVAR(rangeAssistTargetSizeUnits) = ["in", "ft", "cm", "m"];
|
||||
GVAR(rangeAssistTargetSizeUnit) = 2;
|
||||
GVAR(rangeAssistImageSizeUnits) = ["MIL", "TMOA", "IOA"];
|
||||
GVAR(rangeAssistImageSizeUnit) = 0;
|
||||
GVAR(rangeAssistUseTargetHeight) = true;
|
||||
|
||||
GVAR(speedAssistNumTicksUnits) = ["MIL", "TMOA", "IOA"];
|
||||
GVAR(speedAssistNumTicksUnit) = 0;
|
||||
GVAR(speedAssistTimer) = true;
|
||||
|
||||
GVAR(currentUnit) = 2;
|
||||
GVAR(currentGun) = 0;
|
||||
GVAR(currentTarget) = 0;
|
||||
GVAR(currentScopeUnit) = 0;
|
||||
GVAR(currentScopeClickUnit) = 2;
|
||||
GVAR(currentScopeClickNumber) = 10;
|
||||
|
||||
GVAR(atmosphereModeTBH) = true;
|
||||
GVAR(altitude) = 0;
|
||||
GVAR(temperature) = 15;
|
||||
GVAR(barometricPressure) = 1013.25;
|
||||
GVAR(relativeHumidity) = 0.5;
|
||||
|
||||
GVAR(latitude) = [38, 38, 38, 38];
|
||||
GVAR(directionOfFire) = [0, 0, 0, 0];
|
||||
GVAR(windSpeed1) = [0, 0, 0, 0];
|
||||
GVAR(windSpeed2) = [0, 0, 0, 0];
|
||||
GVAR(windDirection) = [12, 12, 12, 12];
|
||||
GVAR(inclinationAngle) = [0, 0, 0, 0];
|
||||
GVAR(targetSpeed) = [0, 0, 0, 0];
|
||||
GVAR(targetRange) = [0, 0, 0, 0];
|
||||
|
||||
GVAR(showWind2) = false;
|
||||
GVAR(elevationOutput) = [0, 0, 0, 0];
|
||||
GVAR(windage1Output) = [0, 0, 0, 0];
|
||||
GVAR(windage2Output) = [0, 0, 0, 0];
|
||||
GVAR(leadOutput) = [0, 0, 0, 0];
|
||||
GVAR(tofOutput) = [0, 0, 0, 0];
|
||||
GVAR(velocityOutput) = [0, 0, 0, 0];
|
||||
|
||||
GVAR(showMainPage) = true;
|
||||
GVAR(showAddNewGun) = false;
|
||||
GVAR(showAtmoEnvData) = false;
|
||||
GVAR(showGunAmmoData) = false;
|
||||
GVAR(showGunList) = false;
|
||||
GVAR(showRangeCard) = false;
|
||||
GVAR(showRangeCardSetup) = false;
|
||||
GVAR(showTargetData) = false;
|
||||
GVAR(showTargetRangeAssist) = false;
|
||||
GVAR(showTargetSpeedAssist) = false;
|
||||
GVAR(showTargetSpeedAssistTimer) = false;
|
125
addons/atragmx/functions/fnc_parse_input.sqf
Normal file
125
addons/atragmx/functions/fnc_parse_input.sqf
Normal file
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Parses all input fields in the gun, atmosphere and target column and the result input fields
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_parse_input
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(altitude) = -1000 max parseNumber(ctrlText 130030) min 20000;
|
||||
GVAR(temperature) = -50 max parseNumber(ctrlText 130040) min 160;
|
||||
GVAR(barometricPressure) = 10 max parseNumber(ctrlText 130050) min 1350;
|
||||
GVAR(relativeHumidity) = (0 max parseNumber(ctrlText 130060) min 100) / 100;
|
||||
if (GVAR(currentUnit) != 2) then {
|
||||
GVAR(altitude) = GVAR(altitude) * 0.3048;
|
||||
GVAR(temperature) = (GVAR(temperature) - 32) / 1.8;
|
||||
GVAR(barometricPressure) = GVAR(barometricPressure) * 33.86389;
|
||||
};
|
||||
|
||||
private ["_inclinationAngleCosine", "_inclinationAngleDegree"];
|
||||
GVAR(latitude) set [GVAR(currentTarget), -90 max Round(parseNumber(ctrlText 140000)) min 90];
|
||||
GVAR(directionOfFire) set [GVAR(currentTarget), 0 max abs(Round(parseNumber(ctrlText 140010))) min 359];
|
||||
GVAR(windSpeed1) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 140020)) min 50];
|
||||
GVAR(windSpeed2) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 140021)) min 50];
|
||||
GVAR(windDirection) set [GVAR(currentTarget), 1 max Round(parseNumber(ctrlText 140030)) min 12];
|
||||
_inclinationAngleCosine = 0.5 max parseNumber(ctrlText 140041) min 1;
|
||||
_inclinationAngleDegree = -60 max round(parseNumber(ctrlText 140040)) min 60;
|
||||
if (_inclinationAngleDegree != GVAR(inclinationAngle) select GVAR(currentTarget)) then {
|
||||
GVAR(inclinationAngle) set [GVAR(currentTarget), _inclinationAngleDegree];
|
||||
} else {
|
||||
if (_inclinationAngleCosine != Round(cos(GVAR(inclinationAngle) select GVAR(currentTarget)) * 100) / 100) then {
|
||||
GVAR(inclinationAngle) set [GVAR(currentTarget), round(acos(_inclinationAngleCosine))];
|
||||
};
|
||||
};
|
||||
GVAR(targetSpeed) set [GVAR(currentTarget), -50 max abs(parseNumber(ctrlText 140050)) min 50];
|
||||
GVAR(targetRange) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 140060)) min 4000];
|
||||
if (GVAR(currentUnit) != 2) then {
|
||||
GVAR(windSpeed1) set [GVAR(currentTarget), (GVAR(windSpeed1) select GVAR(currentTarget)) * 0.44704];
|
||||
GVAR(windSpeed2) set [GVAR(currentTarget), (GVAR(windSpeed2) select GVAR(currentTarget)) * 0.44704];
|
||||
GVAR(targetSpeed) set [GVAR(currentTarget), (GVAR(targetSpeed) select GVAR(currentTarget)) * 0.44704];
|
||||
};
|
||||
if (GVAR(currentUnit) == 1) then {
|
||||
GVAR(targetRange) set [GVAR(currentTarget), (GVAR(targetRange) select GVAR(currentTarget)) * 0.9144];
|
||||
};
|
||||
|
||||
private ["_boreHeight", "_bulletMass", "_bulletDiameter", "_airFriction", "_rifleTwist", "_muzzleVelocity", "_zeroRange"];
|
||||
_boreHeight = parseNumber(ctrlText 120000);
|
||||
_bulletMass = parseNumber(ctrlText 120010);
|
||||
_bulletDiameter = parseNumber(ctrlText 120020);
|
||||
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then {
|
||||
_airFriction = 0.1 max parseNumber(ctrlText 120030) min 2;
|
||||
} else {
|
||||
_airFriction = parseNumber(ctrlText 120030) / -1000;
|
||||
};
|
||||
_rifleTwist = parseNumber(ctrlText 120040);
|
||||
_muzzleVelocity = parseNumber(ctrlText 120050);
|
||||
_zeroRange = parseNumber (ctrlText 120060);
|
||||
if (GVAR(currentUnit) != 2) then {
|
||||
_boreHeight = _boreHeight * 2.54;
|
||||
_bulletMass = _bulletMass * 0.06479891;
|
||||
_bulletDiameter = _bulletDiameter * 10 * 2.54;
|
||||
_rifleTwist = _rifleTwist * 2.54;
|
||||
_muzzleVelocity = _muzzleVelocity / 3.2808399;
|
||||
};
|
||||
if (GVAR(currentUnit) == 1) then {
|
||||
_zeroRange = _zeroRange / 1.0936133;
|
||||
};
|
||||
_boreHeight = 0.1 max _boreHeight min 10;
|
||||
_bulletMass = 1 max _bulletMass min 100;
|
||||
_bulletDiameter = 1 max _bulletDiameter min 25;
|
||||
_muzzleVelocity = 100 max _muzzleVelocity min 1400;
|
||||
_zeroRange = 0 max _zeroRange min 1000;
|
||||
GVAR(workingMemory) set [5, _boreHeight];
|
||||
GVAR(workingMemory) set [12, _bulletMass];
|
||||
GVAR(workingMemory) set [13, _bulletDiameter];
|
||||
GVAR(workingMemory) set [14, _rifleTwist];
|
||||
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then {
|
||||
GVAR(workingMemory) set [15, _airFriction];
|
||||
} else {
|
||||
GVAR(workingMemory) set [4, _airFriction];
|
||||
};
|
||||
GVAR(workingMemory) set [1, _muzzleVelocity];
|
||||
GVAR(workingMemory) set [2, _zeroRange];
|
||||
|
||||
private ["_elevationCur", "_windageCur", "_elevationScopeStep", "_windageScopeStep"];
|
||||
_elevationCur = parseNumber(ctrlText 402);
|
||||
_windageCur = parseNumber(ctrlText 412);
|
||||
|
||||
switch (GVAR(currentScopeUnit)) do {
|
||||
case 0: {
|
||||
_elevationCur = _elevationCur * 3.38;
|
||||
_windageCur = _windageCur * 3.38;
|
||||
};
|
||||
case 2: {
|
||||
_elevationCur = _elevationCur / 1.047;
|
||||
_windageCur = _windageCur / 1.047;
|
||||
};
|
||||
case 3: {
|
||||
_elevationScopeStep = (GVAR(workingMemory) select 7);
|
||||
_windageScopeStep = (GVAR(workingMemory) select 8);
|
||||
|
||||
_elevationCur = _elevationCur * _elevationScopeStep;
|
||||
_windageCur = _windageCur * _windageScopeStep;
|
||||
};
|
||||
};
|
||||
|
||||
GVAR(workingMemory) set [10, _elevationCur];
|
||||
GVAR(workingMemory) set [11, _windageCur];
|
||||
|
||||
[] call FUNC(update_gun);
|
||||
[] call FUNC(update_gun_ammo_data);
|
||||
[] call FUNC(update_atmosphere);
|
||||
[] call FUNC(update_atmo_env_data);
|
||||
[] call FUNC(update_target);
|
||||
[] call FUNC(update_target_data);
|
||||
|
||||
[] call FUNC(store_user_data);
|
21
addons/atragmx/functions/fnc_reset_relative_click_memory.sqf
Normal file
21
addons/atragmx/functions/fnc_reset_relative_click_memory.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Resets the relative click memory and updates the result input/output fields
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_reset_relative_click_memory
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(workingMemory) set [10, 0];
|
||||
GVAR(workingMemory) set [11, 0];
|
||||
|
||||
[] call FUNC(update_result);
|
25
addons/atragmx/functions/fnc_restore_atmo_default.sqf
Normal file
25
addons/atragmx/functions/fnc_restore_atmo_default.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Restores the atmospheric data defaults
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_restore_atmo_default
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(atmosphereModeTBH) = true;
|
||||
GVAR(altitude) = 0;
|
||||
GVAR(temperature) = 15;
|
||||
GVAR(barometricPressure) = 1013.25;
|
||||
GVAR(relativeHumidity) = 0.5;
|
||||
|
||||
[] call FUNC(update_atmo_selection);
|
||||
[] call FUNC(update_atmosphere);
|
42
addons/atragmx/functions/fnc_restore_user_data.sqf
Normal file
42
addons/atragmx/functions/fnc_restore_user_data.sqf
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Reads user data from profileNamespace
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_restore_user_data
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(currentUnit) = 0 max (profileNamespace getVariable ["ACE_ATragMX_currentUnit", 2]) min 2;
|
||||
[(profileNamespace getVariable ["ACE_ATragMX_currentGun", 0]), true, false] call FUNC(change_gun);
|
||||
GVAR(currentTarget) = 0 max (profileNamespace getVariable ["ACE_ATragMX_currentTarget", 0]) min 3;
|
||||
GVAR(currentScopeUnit) = 0 max (profileNamespace getVariable ["ACE_ATragMX_currentScopeUnit", 0]) min 3;
|
||||
|
||||
GVAR(atmosphereModeTBH) = profileNamespace getVariable ["ACE_ATragMX_atmosphereModeTBH", true];
|
||||
GVAR(altitude) = -1000 max (profileNamespace getVariable ["ACE_ATragMX_altitude", 0]) min 20000;
|
||||
GVAR(temperature) = -50 max (profileNamespace getVariable ["ACE_ATragMX_temperature", 15]) min 160;
|
||||
GVAR(barometricPressure) = 340 max (profileNamespace getVariable ["ACE_ATragMX_barometricPressure", 1013.25]) min 1350;
|
||||
GVAR(relativeHumidity) = 0 max (profileNamespace getVariable ["ACE_ATragMX_relativeHumidity", 0.5]) min 1;
|
||||
|
||||
GVAR(showWind2) = profileNamespace getVariable ["ACE_ATragMX_showWind2", false];
|
||||
GVAR(latitude) = profileNamespace getVariable ["ACE_ATragMX_latitude", [38, 38, 38, 38]];
|
||||
GVAR(directionOfFire) = profileNamespace getVariable ["ACE_ATragMX_directionOfFire", [0, 0, 0, 0]];
|
||||
GVAR(windSpeed1) = profileNamespace getVariable ["ACE_ATragMX_windSpeed1", [0, 0, 0, 0]];
|
||||
GVAR(windSpeed2) = profileNamespace getVariable ["ACE_ATragMX_windSpeed2", [0, 0, 0, 0]];
|
||||
GVAR(windDirection) = profileNamespace getVariable ["ACE_ATragMX_windDirection", [12, 12, 12, 12]];
|
||||
GVAR(inclinationAngle) = profileNamespace getVariable ["ACE_ATragMX_inclinationAngle", [0, 0, 0, 0]];
|
||||
GVAR(targetSpeed) = profileNamespace getVariable ["ACE_ATragMX_targetSpeed", [0, 0, 0, 0]];
|
||||
GVAR(targetRange) = profileNamespace getVariable ["ACE_ATragMX_targetRange", [0, 0, 0, 0]];
|
||||
|
||||
GVAR(rangeCardStartRange) = 0 max (profileNamespace getVariable ["ACE_ATragMX_rangeCardStartRange", 200]) min 3000;
|
||||
GVAR(rangeCardEndRange) = 0 max (profileNamespace getVariable ["ACE_ATragMX_rangeCardEndRange", 2000]) min 3000;
|
||||
GVAR(rangeCardIncrement) = 1 max (profileNamespace getVariable ["ACE_ATragMX_rangeCardIncrement", 50]) min 3000;
|
||||
GVAR(rangeCardCurrentColumn) = 0 max (profileNamespace getVariable ["ACE_ATragMX_rangeCardCurrentColumn", 3]) min 3;
|
28
addons/atragmx/functions/fnc_save_gun.sqf
Normal file
28
addons/atragmx/functions/fnc_save_gun.sqf
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Saves the currently select gun profile into the profileNamespace
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_save_gun
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_index"];
|
||||
_index = 0 max (lbCurSel 6000);
|
||||
|
||||
GVAR(gunList) set [_index, +GVAR(workingMemory)];
|
||||
|
||||
lbClear 6000;
|
||||
{
|
||||
lbAdd [6000, _x select 0];
|
||||
} forEach GVAR(gunList);
|
||||
|
||||
profileNamespace setVariable ["ACE_ATragMX_gunList", GVAR(gunList)];
|
20
addons/atragmx/functions/fnc_show_add_new_gun.sqf
Normal file
20
addons/atragmx/functions/fnc_show_add_new_gun.sqf
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Shows/Hides add new gun controls
|
||||
*
|
||||
* Arguments:
|
||||
* visible - <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_show_add_new_gun
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(showAddNewGun) = _this;
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [11000, 11001, 11002, 11003];
|
25
addons/atragmx/functions/fnc_show_atmo_env_data.sqf
Normal file
25
addons/atragmx/functions/fnc_show_atmo_env_data.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Shows/Hides the atmosphere and environmental data controls
|
||||
*
|
||||
* Arguments:
|
||||
* visible - <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* false call ace_atragmx_fnc_show_atmo_env_data
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(showAtmoEnvData) = _this;
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [13000, 13001, 13002, 13003, 130030, 13004, 130040, 13005, 130050, 13006, 130060, 13007, 13008, 13009, 13010, 13011];
|
||||
|
||||
if (_this) then {
|
||||
[] call FUNC(update_atmo_selection);
|
||||
[] call FUNC(update_atmo_env_data);
|
||||
};
|
24
addons/atragmx/functions/fnc_show_gun_ammo_data.sqf
Normal file
24
addons/atragmx/functions/fnc_show_gun_ammo_data.sqf
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Shows/Hides the gun ammo data controls
|
||||
*
|
||||
* Arguments:
|
||||
* visible - <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* false call ace_atragmx_fnc_show_gun_ammo_data
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(showGunAmmoData) = _this;
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [12000, 120000, 12001, 120010, 12002, 120020, 12003, 120030, 12004, 120040, 12005, 120050, 12006, 120060, 12007, 12008, 12009, 12010, 12011];
|
||||
|
||||
if (_this) then {
|
||||
[] call FUNC(update_gun_ammo_data);
|
||||
};
|
26
addons/atragmx/functions/fnc_show_gun_list.sqf
Normal file
26
addons/atragmx/functions/fnc_show_gun_list.sqf
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Shows/Hides the gun list controls
|
||||
*
|
||||
* Arguments:
|
||||
* visible - <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_show_gun_list
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(showGunList) = _this;
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [6000, 6001, 6002, 6003, 6004, 6005, 6006, 6007];
|
||||
|
||||
if (_this) then {
|
||||
ctrlSetFocus ((uiNamespace getVariable "ATragMX_Display") displayCtrl 6002);
|
||||
|
||||
lbSetCurSel [6000, GVAR(currentGun)];
|
||||
};
|
29
addons/atragmx/functions/fnc_show_main_page.sqf
Normal file
29
addons/atragmx/functions/fnc_show_main_page.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Shows/Hides the main menu controls
|
||||
*
|
||||
* Arguments:
|
||||
* visible - <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_show_main_page
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(showMainPage) = _this;
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [10, 100, 11, 110, 12, 120, 13, 130, 14, 140, 20, 200, 21, 210, 22, 220, 23, 230, 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, 1001, 1002, 1003, 1004, 2000, 3000, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008];
|
||||
|
||||
if (_this) then {
|
||||
if (GVAR(atmosphereModeTBH)) then {
|
||||
{ctrlShow [_x, false]} forEach [23, 230];
|
||||
} else {
|
||||
{ctrlShow [_x, false]} forEach [21, 210, 22, 220];
|
||||
};
|
||||
};
|
20
addons/atragmx/functions/fnc_show_range_card.sqf
Normal file
20
addons/atragmx/functions/fnc_show_range_card.sqf
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Shows/Hides the range card controls
|
||||
*
|
||||
* Arguments:
|
||||
* visible - <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_show_range_card
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(showRangeCard) = _this;
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [5000, 5001, 5002, 5003, 5004, 5005, 5006, 5007];
|
28
addons/atragmx/functions/fnc_show_range_card_setup.sqf
Normal file
28
addons/atragmx/functions/fnc_show_range_card_setup.sqf
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Shows/Hides the range card setup controls
|
||||
*
|
||||
* Arguments:
|
||||
* visible - <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_show_range_card_setup
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(showRangeCardSetup) = _this;
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [10000, 10001, 10002, 10003, 10004, 10005, 10006, 10007, 10008, 10009];
|
||||
|
||||
if (_this) then {
|
||||
ctrlSetFocus ((uiNamespace getVariable "ATragMX_Display") displayCtrl 10006);
|
||||
|
||||
ctrlSetText [10003, Str(Round(GVAR(rangeCardStartRange)))];
|
||||
ctrlSetText [10004, Str(Round(GVAR(rangeCardEndRange)))];
|
||||
ctrlSetText [10005, Str(Round(GVAR(rangeCardIncrement)))];
|
||||
};
|
24
addons/atragmx/functions/fnc_show_target_data.sqf
Normal file
24
addons/atragmx/functions/fnc_show_target_data.sqf
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Shows/Hides the target data controls
|
||||
*
|
||||
* Arguments:
|
||||
* visible - <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* false call ace_atragmx_fnc_show_target_data
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(showTargetData) = _this;
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [14000, 140000, 14001, 140010, 14002, 141020, 140020, 141021, 140021, 14003, 140030, 14004, 140040, 141040, 141041, 140041, 14005, 140050, 14006, 140060, 14007, 14008, 14009, 14010, 14011];
|
||||
|
||||
if (_this) then {
|
||||
[] call FUNC(update_target_data);
|
||||
};
|
33
addons/atragmx/functions/fnc_show_target_range_assist.sqf
Normal file
33
addons/atragmx/functions/fnc_show_target_range_assist.sqf
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Shows/Hides the target range assist controls
|
||||
*
|
||||
* Arguments:
|
||||
* visible - <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_show_target_range_assist
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(showTargetRangeAssist) = _this;
|
||||
|
||||
{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];
|
||||
|
||||
if (_this) then {
|
||||
ctrlSetFocus ((uiNamespace getVariable "ATragMX_Display") displayCtrl 7018);
|
||||
|
||||
ctrlSetText [7012, Str(parseNumber(ctrlText 320))];
|
||||
ctrlSetText [7013, Str(parseNumber(ctrlText 340))];
|
||||
|
||||
if (GVAR(currentUnit) == 1) then {
|
||||
ctrlSetText [7016, "Yards"];
|
||||
} else {
|
||||
ctrlSetText [7016, "Meters"];
|
||||
};
|
||||
};
|
38
addons/atragmx/functions/fnc_show_target_speed_assist.sqf
Normal file
38
addons/atragmx/functions/fnc_show_target_speed_assist.sqf
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Shows/Hides the target speed assist controls
|
||||
*
|
||||
* Arguments:
|
||||
* visible - <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_show_target_speed_assist
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(showTargetSpeedAssist) = _this;
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009, 8010, 8011, 8012, 8013, 8014, 8015];
|
||||
|
||||
if (_this) then {
|
||||
ctrlSetFocus ((uiNamespace getVariable "ATragMX_Display") displayCtrl 8012);
|
||||
|
||||
ctrlSetText [8004, Str(Round((GVAR(targetRange) select GVAR(currentTarget))))];
|
||||
|
||||
if (GVAR(currentUnit) == 1) then {
|
||||
ctrlSetText [8008, "Yards"];
|
||||
} else {
|
||||
ctrlSetText [8008, "Meters"];
|
||||
};
|
||||
|
||||
if (GVAR(currentUnit) == 2) then {
|
||||
ctrlSetText [8011, "m/s"];
|
||||
} else {
|
||||
ctrlSetText [8011, "mph"];
|
||||
};
|
||||
};
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Shows/Hides the target speed assist timer controls
|
||||
*
|
||||
* Arguments:
|
||||
* visible - <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_show_target_speed_assist_timer
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(showTargetSpeedAssistTimer) = _this;
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [9000, 9001, 9002];
|
27
addons/atragmx/functions/fnc_sord.sqf
Normal file
27
addons/atragmx/functions/fnc_sord.sqf
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Handles incoming data packets from the Vectronix Vector LRF
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Slope distance (Meters) <NUMBER>
|
||||
* 1: Azimuth (Degrees) <NUMBER>
|
||||
* 2: Inclination (Degrees) <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [1000, 45, 1] call ace_microdagr_fnc_recieveRangefinderData
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_slopeDistance", "_azimuth", "_inclination"];
|
||||
_slopeDistance = _this select 0;
|
||||
_azimuth = _this select 1;
|
||||
_inclination = _this select 2;
|
||||
|
||||
GVAR(inclinationAngle) set [GVAR(currentTarget), round(_inclination)];
|
||||
GVAR(directionOfFire) set [GVAR(currentTarget), round(_azimuth)];
|
||||
GVAR(targetRange) set [GVAR(currentTarget), round(_slopeDistance)];
|
44
addons/atragmx/functions/fnc_store_user_data.sqf
Normal file
44
addons/atragmx/functions/fnc_store_user_data.sqf
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Saves user data into profileNamespace
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_store_user_data
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
profileNamespace setVariable ["ACE_ATragMX_profileNamespaceVersion", ATRAGMX_PROFILE_NAMESPACE_VERSION];
|
||||
|
||||
profileNamespace setVariable ["ACE_ATragMX_currentUnit", GVAR(currentUnit)];
|
||||
profileNamespace setVariable ["ACE_ATragMX_currentGun", GVAR(currentGun)];
|
||||
profileNamespace setVariable ["ACE_ATragMX_currentTarget", GVAR(currentTarget)];
|
||||
profileNamespace setVariable ["ACE_ATragMX_currentScopeUnit", GVAR(currentScopeUnit)];
|
||||
|
||||
profileNamespace setVariable ["ACE_ATragMX_atmosphereModeTBH", GVAR(atmosphereModeTBH)];
|
||||
profileNamespace setVariable ["ACE_ATragMX_altitude", GVAR(altitude)];
|
||||
profileNamespace setVariable ["ACE_ATragMX_temperature", GVAR(temperature)];
|
||||
profileNamespace setVariable ["ACE_ATragMX_barometricPressure", GVAR(barometricPressure)];
|
||||
profileNamespace setVariable ["ACE_ATragMX_relativeHumidity", GVAR(relativeHumidity)];
|
||||
|
||||
profileNamespace setVariable ["ACE_ATragMX_showWind2", GVAR(showWind2)];
|
||||
profileNamespace setVariable ["ACE_ATragMX_latitude", GVAR(latitude)];
|
||||
profileNamespace setVariable ["ACE_ATragMX_directionOfFire", GVAR(directionOfFire)];
|
||||
profileNamespace setVariable ["ACE_ATragMX_windSpeed1", GVAR(windSpeed1)];
|
||||
profileNamespace setVariable ["ACE_ATragMX_windSpeed2", GVAR(windSpeed2)];
|
||||
profileNamespace setVariable ["ACE_ATragMX_windDirection", GVAR(windDirection)];
|
||||
profileNamespace setVariable ["ACE_ATragMX_inclinationAngle", GVAR(inclinationAngle)];
|
||||
profileNamespace setVariable ["ACE_ATragMX_targetSpeed", GVAR(targetSpeed)];
|
||||
profileNamespace setVariable ["ACE_ATragMX_targetRange", GVAR(targetRange)];
|
||||
|
||||
profileNamespace setVariable ["ACE_ATragMX_rangeCardStartRange", GVAR(rangeCardStartRange)];
|
||||
profileNamespace setVariable ["ACE_ATragMX_rangeCardEndRange", GVAR(rangeCardEndRange)];
|
||||
profileNamespace setVariable ["ACE_ATragMX_rangeCardIncrement", GVAR(rangeCardIncrement)];
|
||||
profileNamespace setVariable ["ACE_ATragMX_rangeCardCurrentColumn", GVAR(rangeCardCurrentColumn)];
|
46
addons/atragmx/functions/fnc_target_speed_assist_timer.sqf
Normal file
46
addons/atragmx/functions/fnc_target_speed_assist_timer.sqf
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Shows and starts the target speed assist timer
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_target_speed_assist_timer
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if !(ctrlVisible 9000) then {
|
||||
|
||||
false call FUNC(show_target_speed_assist);
|
||||
true call FUNC(show_target_speed_assist_timer);
|
||||
|
||||
ctrlSetFocus ((uiNamespace getVariable "ATragMX_Display") displayCtrl 9002);
|
||||
|
||||
[{
|
||||
private ["_args", "_startTime"];
|
||||
_args = _this select 0;
|
||||
_startTime = _args select 0;
|
||||
|
||||
if (!(GVAR(speedAssistTimer))) exitWith {
|
||||
GVAR(speedAssistTimer) = true;
|
||||
|
||||
ctrlSetText [8006, Str(Round((time - _startTime) * 10) / 10)];
|
||||
|
||||
[] call FUNC(calculate_target_speed_assist);
|
||||
|
||||
false call FUNC(show_target_speed_assist_timer);
|
||||
true call FUNC(show_target_speed_assist);
|
||||
|
||||
[_this select 1] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
ctrlSetText [9001, Str(Round((time - _startTime) * 10) / 10)];
|
||||
|
||||
}, 0.1, [time]] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
28
addons/atragmx/functions/fnc_toggle_atmo_env_data.sqf
Normal file
28
addons/atragmx/functions/fnc_toggle_atmo_env_data.sqf
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Toggles the atmospheric data screen on/off
|
||||
*
|
||||
* Arguments:
|
||||
* Apply new data? <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* 1 call ace_atragmx_fnc_toggle_atmo_env_data
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (ctrlVisible 13000) then {
|
||||
false call FUNC(show_atmo_env_data);
|
||||
true call FUNC(show_main_page);
|
||||
|
||||
if (_this == 1) then {
|
||||
call FUNC(calculate_target_solution);
|
||||
};
|
||||
} else {
|
||||
true call FUNC(show_atmo_env_data);
|
||||
false call FUNC(show_main_page);
|
||||
};
|
29
addons/atragmx/functions/fnc_toggle_gun_ammo_data.sqf
Normal file
29
addons/atragmx/functions/fnc_toggle_gun_ammo_data.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Toggles the gun ammo data screen on/off
|
||||
*
|
||||
* Arguments:
|
||||
* Apply new data? <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* 1 call ace_atragmx_fnc_toggle_gun_ammo_data
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (ctrlVisible 12000) then {
|
||||
false call FUNC(show_gun_ammo_data);
|
||||
true call FUNC(show_main_page);
|
||||
|
||||
if (_this == 1) then {
|
||||
call FUNC(update_zero_range);
|
||||
call FUNC(calculate_target_solution);
|
||||
};
|
||||
} else {
|
||||
true call FUNC(show_gun_ammo_data);
|
||||
false call FUNC(show_main_page);
|
||||
};
|
28
addons/atragmx/functions/fnc_toggle_gun_list.sqf
Normal file
28
addons/atragmx/functions/fnc_toggle_gun_list.sqf
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Toggles the gun list screen on/off
|
||||
*
|
||||
* Arguments:
|
||||
* change gun? <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* false call ace_atragmx_fnc_toggle_gun_list
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (ctrlVisible 6000) then {
|
||||
false call FUNC(show_gun_list);
|
||||
true call FUNC(show_main_page);
|
||||
|
||||
if (_this) then {
|
||||
[lbCurSel 6000, true, true] call FUNC(change_gun);
|
||||
};
|
||||
} else {
|
||||
false call FUNC(show_main_page);
|
||||
true call FUNC(show_gun_list);
|
||||
};
|
29
addons/atragmx/functions/fnc_toggle_range_card.sqf
Normal file
29
addons/atragmx/functions/fnc_toggle_range_card.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Toggles the range card screen on/off
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_toggle_range_card
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (ctrlVisible 5006) then {
|
||||
false call FUNC(show_range_card);
|
||||
true call FUNC(show_main_page);
|
||||
} else {
|
||||
false call FUNC(show_main_page);
|
||||
true call FUNC(show_range_card);
|
||||
|
||||
ctrlSetFocus ((uiNamespace getVariable "ATragMX_Display") displayCtrl 5001);
|
||||
|
||||
[] call FUNC(calculate_range_card);
|
||||
[] call FUNC(update_range_card);
|
||||
};
|
33
addons/atragmx/functions/fnc_toggle_range_card_setup.sqf
Normal file
33
addons/atragmx/functions/fnc_toggle_range_card_setup.sqf
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Toggles the range card setup screen on/off
|
||||
*
|
||||
* Arguments:
|
||||
* Apply new range card settings <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* 1 call ace_atragmx_fnc_toggle_range_card_setup
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (ctrlVisible 10000) then {
|
||||
false call FUNC(show_range_card_setup);
|
||||
true call FUNC(show_range_card);
|
||||
|
||||
if (_this == 1) then {
|
||||
GVAR(rangeCardStartRange) = 0 max Round(parseNumber(ctrlText 10003)) min 3000;
|
||||
GVAR(rangeCardEndRange) = 0 max Round(parseNumber(ctrlText 10004)) min 3000;
|
||||
GVAR(rangeCardIncrement) = 1 max Round(parseNumber(ctrlText 10005)) min 3000;
|
||||
|
||||
[] call FUNC(calculate_range_card);
|
||||
[] call FUNC(update_range_card);
|
||||
};
|
||||
} else {
|
||||
false call FUNC(show_range_card);
|
||||
true call FUNC(show_range_card_setup);
|
||||
};
|
28
addons/atragmx/functions/fnc_toggle_target_data.sqf
Normal file
28
addons/atragmx/functions/fnc_toggle_target_data.sqf
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Toggles the target data screen on/off
|
||||
*
|
||||
* Arguments:
|
||||
* Apply new data? <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* 1 call ace_atragmx_fnc_toggle_target_data
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (ctrlVisible 14000) then {
|
||||
false call FUNC(show_target_data);
|
||||
true call FUNC(show_main_page);
|
||||
|
||||
if (_this == 1) then {
|
||||
call FUNC(calculate_target_solution);
|
||||
};
|
||||
} else {
|
||||
true call FUNC(show_target_data);
|
||||
false call FUNC(show_main_page);
|
||||
};
|
32
addons/atragmx/functions/fnc_toggle_target_range_assist.sqf
Normal file
32
addons/atragmx/functions/fnc_toggle_target_range_assist.sqf
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Toggles the target range assist screen on/off
|
||||
*
|
||||
* Arguments:
|
||||
* update range? <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* 1 call ace_atragmx_fnc_toggle_target_range_assist
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (ctrlVisible 7000) then {
|
||||
false call FUNC(show_target_range_assist);
|
||||
true call FUNC(show_main_page);
|
||||
|
||||
if (_this == 1) then {
|
||||
ctrlSetText [320, Str(parseNumber(ctrlText 7012))];
|
||||
ctrlSetText [140040, Str(parseNumber(ctrlText 7012))];
|
||||
ctrlSetText [340, Str(parseNumber(ctrlText 7013))];
|
||||
ctrlSetText [140060, Str(parseNumber(ctrlText 7013))];
|
||||
[] call FUNC(calculate_target_solution);
|
||||
};
|
||||
} else {
|
||||
false call FUNC(show_main_page);
|
||||
true call FUNC(show_target_range_assist);
|
||||
};
|
35
addons/atragmx/functions/fnc_toggle_target_speed_assist.sqf
Normal file
35
addons/atragmx/functions/fnc_toggle_target_speed_assist.sqf
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Toggles the target speed assist screen on/off
|
||||
*
|
||||
* Arguments:
|
||||
* update speed? <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* 1 call ace_atragmx_fnc_toggle_target_speed_assist
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (ctrlVisible 8000) then {
|
||||
false call FUNC(show_target_speed_assist);
|
||||
true call FUNC(show_main_page);
|
||||
|
||||
if (_this == 1) then {
|
||||
[] call FUNC(calculate_target_speed_assist);
|
||||
private ["_targetSpeed"];
|
||||
_targetSpeed = parseNumber(ctrlText 8007);
|
||||
if (_targetSpeed != 0) then {
|
||||
ctrlSetText [330, Str(_targetSpeed)];
|
||||
ctrlSetText [140050, Str(_targetSpeed)];
|
||||
[] call FUNC(calculate_target_solution);
|
||||
};
|
||||
};
|
||||
} else {
|
||||
false call FUNC(show_main_page);
|
||||
true call FUNC(show_target_speed_assist);
|
||||
};
|
45
addons/atragmx/functions/fnc_update_atmo_env_data.sqf
Normal file
45
addons/atragmx/functions/fnc_update_atmo_env_data.sqf
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Updates the atmospheric data fields
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_update_atmo_env_data
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
ctrlSetFocus ((uiNamespace getVariable "ATragMX_Display") displayCtrl 13007);
|
||||
|
||||
if (GVAR(currentUnit) == 2) then {
|
||||
ctrlSetText [130040, Str(Round(GVAR(temperature) * 10) / 10)];
|
||||
} else {
|
||||
ctrlSetText [130040, Str(Round((GVAR(temperature) * 1.8 + 32) * 10) / 10)];
|
||||
};
|
||||
if (GVAR(currentUnit) == 2) then {
|
||||
ctrlSetText [130050, Str(Round(GVAR(barometricPressure)))];
|
||||
} else {
|
||||
ctrlSetText [130050, Str(Round(GVAR(barometricPressure) / 33.8638866667 * 100) / 100)];
|
||||
};
|
||||
ctrlSetText [130060, Str(Round(GVAR(relativeHumidity) * 100 * 10) / 10)];
|
||||
if (GVAR(currentUnit) == 2) then {
|
||||
ctrlSetText [130030, Str(Round(GVAR(altitude)))];
|
||||
} else {
|
||||
ctrlSetText [130030, Str(Round(GVAR(altitude) * 3.2808399))];
|
||||
};
|
||||
|
||||
if (GVAR(currentUnit) == 2) then {
|
||||
ctrlSetText [13003, "Altitude (m)"];
|
||||
ctrlSetText [13004, "temperature (C)"];
|
||||
ctrlSetText [13005, "Barom Pres (milibars)"];
|
||||
} else {
|
||||
ctrlSetText [13003, "Altitude (ft)"];
|
||||
ctrlSetText [13004, "temperature (F)"];
|
||||
ctrlSetText [13005, "Barom Pres (in.merc.)"];
|
||||
};
|
31
addons/atragmx/functions/fnc_update_atmo_selection.sqf
Normal file
31
addons/atragmx/functions/fnc_update_atmo_selection.sqf
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Updates the atmospheric data input method
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_update_atmo_selection
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
((uiNamespace getVariable "ATragMX_Display") displayCtrl 13001) ctrlEnable true;
|
||||
((uiNamespace getVariable "ATragMX_Display") displayCtrl 13002) ctrlEnable true;
|
||||
|
||||
if (GVAR(atmosphereModeTBH)) then {
|
||||
((uiNamespace getVariable "ATragMX_Display") displayCtrl 13002) ctrlEnable false;
|
||||
{ctrlShow [_x, false]} forEach [13003, 130030];
|
||||
{ctrlShow [_x, true]} forEach [13005, 130050, 13006, 130060];
|
||||
} else {
|
||||
((uiNamespace getVariable "ATragMX_Display") displayCtrl 13001) ctrlEnable false;
|
||||
{ctrlShow [_x, false]} forEach [13005, 130050, 13006, 130060];
|
||||
{ctrlShow [_x, true]} forEach [13003, 130030];
|
||||
};
|
||||
|
||||
[] call FUNC(update_atmo_env_data);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user