mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Initial merge of the ATragMX - Ballistics calculator WIP)
This commit is contained in:
parent
26fb06f774
commit
1320176c12
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) );
|
||||
};
|
||||
};
|
38
addons/atragmx/CfgVehicles.hpp
Normal file
38
addons/atragmx/CfgVehicles.hpp
Normal file
@ -0,0 +1,38 @@
|
||||
class CfgVehicles {
|
||||
class Man;
|
||||
class CAManBase: Man {
|
||||
class ACE_SelfActions {
|
||||
class ACE_OpenATragMX {
|
||||
displayName = "$STR_ACE_ATragMX_OpenATragMXDialog";
|
||||
condition = QUOTE('ACE_ATragMX' in items _player && {!GVAR(ATragMX)});
|
||||
statement = QUOTE(call FUNC(createATragMXDialog));
|
||||
showDisabled = 0;
|
||||
priority = 2;
|
||||
icon = PATHTOF(UI\ATRAG_Icon.paa);
|
||||
hotkey = "K";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
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 = "";
|
||||
picture = PATHTOF(UI\ATRAG.paa);
|
||||
icon = "iconObject_circle";
|
||||
mapSize = 0.034;
|
||||
|
||||
class ItemInfo: InventoryItem_Base_F {
|
||||
mass = 2;
|
||||
};
|
||||
};
|
||||
};
|
11
addons/atragmx/README.md
Normal file
11
addons/atragmx/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
ace_winddeflection
|
||||
===============
|
||||
|
||||
Wind deflection for projectiles/bullets.
|
||||
|
||||
## Maintainers
|
||||
|
||||
The people responsible for merging changes to this component or answering potential questions.
|
||||
|
||||
- [Glowbal](https://github.com/Glowbal)
|
||||
- [Ruthberg] (http://github.com/Ulteq)
|
1201
addons/atragmx/RscTitles.hpp
Normal file
1201
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.
21
addons/atragmx/XEH_postInit.sqf
Normal file
21
addons/atragmx/XEH_postInit.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#include "initKeybinds.sqf"
|
||||
|
||||
if (count (profileNamespace getVariable ["GVAR(ATragMX_gunList)", []]) > 0) then {
|
||||
GVAR(ATragMX_gunList) = profileNamespace getVariable "GVAR(ATragMX_gunList)";
|
||||
} else {
|
||||
// Profile Name, Muzzle Velocity, Zero Range, Scope Base Angle, AirFriction, Bore Height, Scope Unit, Elevation Scope Step, Windage Scope Step, Maximum Elevation, Dialed Elevation, Dialed Windage, Mass, Ammo Class Name, Magazine Class Name, BC, Drag Model, Atmosphere Model
|
||||
GVAR(ATragMX_gunList) = [["12.7x108mm" , 820, 500, 0.255, -0.0005600, 3.81, 0, 0.338, 0.338, 120, 0, 0, 48.28, "B_127x108_Ball" , "5Rnd_127x108_Mag" , 0.700, 1, "ASM" ],
|
||||
["12.7x99mm" , 880, 500, 0.202, -0.0005600, 3.81, 0, 0.338, 0.338, 120, 0, 0, 41.92, "B_127x99_Ball" , "5Rnd_mas_127x99_Stanag" , 0.670, 1, "ASM" ],
|
||||
["10.4x77mm" , 910, 500, 0.200, -0.0004800, 3.81, 0, 0.338, 0.338, 120, 0, 0, 27.15, "B_408_Ball" , "7Rnd_408_Mag" , 0.970, 1, "ASM" ],
|
||||
["7.62x51mm" , 850, 500, 0.280, -0.0010000, 3.81, 0, 0.338, 0.338, 120, 0, 0, 9.460, "B_762x51_Ball" , "20Rnd_762x51_Mag" , 0.393, 1, "ICAO"],
|
||||
["6.5x39mm" , 800, 500, 0.304, -0.0009000, 3.81, 0, 0.338, 0.338, 120, 0, 0, 7.776, "B_65x39_Caseless", "30Rnd_65x39_caseless_mag", 0.263, 1, "ICAO"],
|
||||
["5.56x45mm" , 920, 500, 0.259, -0.0012000, 3.81, 0, 0.338, 0.338, 120, 0, 0, 4.000, "B_556x45_Ball" , "30Rnd_556x45_Stanag" , 0.304, 1, "ASM" ],
|
||||
["5.56x45mm Mk262" , 850, 500, 0.294, -0.0011250, 3.81, 0, 0.338, 0.338, 120, 0, 0, 4.990, "RH_556x45_Mk262" , "RH_30Rnd_556x45_Mk262" , 0.361, 1, "ASM" ]];
|
||||
|
||||
profileNamespace setVariable ["GVAR(ATragMX_gunList)", GVAR(ATragMX_gunList)];
|
||||
};
|
||||
|
||||
[] call FUNC(init);
|
||||
//[] call FUNC(sord); // Connection to Vector
|
47
addons/atragmx/XEH_preInit.sqf
Normal file
47
addons/atragmx/XEH_preInit.sqf
Normal file
@ -0,0 +1,47 @@
|
||||
#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(change_gun);
|
||||
prep(create_dialog);
|
||||
prep(cycle_range_card_columns);
|
||||
prep(cycle_scope_unit);
|
||||
prep(delete_gun);
|
||||
prep(init);
|
||||
prep(parse_input);
|
||||
prep(reset_relative_click_memory);
|
||||
prep(save_gun);
|
||||
prep(show_add_new_gun);
|
||||
prep(show_gun_list);
|
||||
prep(show_main_page);
|
||||
prep(show_range_card);
|
||||
prep(show_range_card_setup);
|
||||
prep(show_target_range_assist);
|
||||
prep(show_target_speed_assist);
|
||||
prep(show_target_speed_assist_timer);
|
||||
prep(sord);
|
||||
prep(target_speed_assist_timer);
|
||||
prep(toggle_gun_list);
|
||||
prep(toggle_range_card);
|
||||
prep(toggle_range_card_setup);
|
||||
prep(toggle_target_range_assist);
|
||||
prep(toggle_target_speed_assist);
|
||||
prep(update_atmosphere);
|
||||
prep(update_gun);
|
||||
prep(update_range_card);
|
||||
prep(update_relative_click_memory);
|
||||
prep(update_result);
|
||||
prep(update_scope_unit);
|
||||
prep(update_target);
|
||||
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[] = {$STR_ACE_Common_ACETeam, "Ruthberg"};
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgWeapons.hpp"
|
||||
#include "RscTitles.hpp"
|
1
addons/atragmx/functions/defines.h
Normal file
1
addons/atragmx/functions/defines.h
Normal file
@ -0,0 +1 @@
|
||||
#define GET_TEMPERATURE_AT_HEIGHT(h) (EGVAR(weather,currentTemperature) - 0.0065 * (h))
|
14
addons/atragmx/functions/fnc_add_new_gun.sqf
Normal file
14
addons/atragmx/functions/fnc_add_new_gun.sqf
Normal file
@ -0,0 +1,14 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_gunName", "_gunProfileEntry"];
|
||||
|
||||
_gunName = ctrlText 11001;
|
||||
if (_gunName != "") then {
|
||||
_gunProfileEntry = [_gunName, 850, 500, 0.280, -0.0010000, 3.81, 0, 0.338, 0.338, 120, 0, 0, 9.460, "", "", 0.393, 1, "ICAO"];
|
||||
|
||||
GVAR(ATragMX_gunList) = GVAR(ATragMX_gunList) + [_gunProfileEntry];
|
||||
|
||||
lbAdd [6000, _gunProfileEntry select 0];
|
||||
|
||||
profileNamespace setVariable ["GVAR(ATragMX_gunList)", GVAR(ATragMX_gunList)];
|
||||
};
|
48
addons/atragmx/functions/fnc_calculate_range_card.sqf
Normal file
48
addons/atragmx/functions/fnc_calculate_range_card.sqf
Normal file
@ -0,0 +1,48 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
call compile preprocessFile ("\atragmx\fnc_parse_input.sqf");
|
||||
|
||||
private ["_scopeBaseAngle"];
|
||||
_scopeBaseAngle = ((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 3);
|
||||
|
||||
private ["_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel"];
|
||||
_bulletMass = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 12;
|
||||
_boreHeight = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 5;
|
||||
_airFriction = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 4;
|
||||
_muzzleVelocity = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 1;
|
||||
_bc = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 15;
|
||||
_dragModel = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 16;
|
||||
_atmosphereModel = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 17;
|
||||
|
||||
private ["_temperature", "_barometricPressure", "_relativeHumidity"];
|
||||
_temperature = (GVAR(ATragMX_temperature) select GVAR(ATragMX_currentTarget));
|
||||
_barometricPressure = (GVAR(ATragMX_barometricPressure) select GVAR(ATragMX_currentTarget));
|
||||
_relativeHumidity = (GVAR(ATragMX_relativeHumidity) select GVAR(ATragMX_currentTarget));
|
||||
if (GVAR(ATragMX_currentUnit) == 1) then
|
||||
{
|
||||
_temperature = (_temperature - 32) / 1.8;
|
||||
_barometricPressure = _barometricPressure * 33.8638866667;
|
||||
};
|
||||
|
||||
private ["_windSpeed", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange"];
|
||||
_windSpeed = (GVAR(ATragMX_windSpeed) select GVAR(ATragMX_currentTarget));
|
||||
_windDirection = (GVAR(ATragMX_windDirection) select GVAR(ATragMX_currentTarget));
|
||||
_inclinationAngle = (GVAR(ATragMX_inclinationAngle) select GVAR(ATragMX_currentTarget));
|
||||
_targetSpeed = (GVAR(ATragMX_targetSpeed) select GVAR(ATragMX_currentTarget));
|
||||
_targetRange = GVAR(ATragMX_rangeCardEndRange);
|
||||
if (GVAR(ATragMX_currentUnit) != 2) then
|
||||
{
|
||||
_targetRange = _targetRange / 1.0936133;
|
||||
};
|
||||
if (GVAR(ATragMX_currentUnit) == 1) then
|
||||
{
|
||||
_windSpeed = _windSpeed / 2.23693629;
|
||||
_targetSpeed = _targetSpeed / 2.23693629;
|
||||
};
|
||||
|
||||
GVAR(ATragMX_rangeCardData) = [];
|
||||
|
||||
private ["_result"];
|
||||
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000,
|
||||
_windSpeed, _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, true] call FUNC(calculate_solution);
|
||||
|
20
addons/atragmx/functions/fnc_calculate_scope_base_angle.sqf
Normal file
20
addons/atragmx/functions/fnc_calculate_scope_base_angle.sqf
Normal file
@ -0,0 +1,20 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_zeroRange"];
|
||||
_bulletMass = _this select 0;
|
||||
_boreHeight = _this select 1;
|
||||
_airFriction = _this select 2;
|
||||
_muzzleVelocity = _this select 3;
|
||||
_zeroRange = _this select 4;
|
||||
|
||||
private ["_scopeBaseAngle"];
|
||||
_scopeBaseAngle = 0;
|
||||
|
||||
private ["_temperature", "_barometricPressure", "_relativeHumidity"];
|
||||
_temperature = 15;
|
||||
_barometricPressure = 1013.25;
|
||||
_relativeHumidity = 0;
|
||||
|
||||
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, 0, 0, 0, 0, _zeroRange, _airFriction, 1, "ICAO", false] call FUNC(calculate_solution);
|
||||
|
||||
_scopeBaseAngle + (_result select 0) / 60
|
122
addons/atragmx/functions/fnc_calculate_solution.sqf
Normal file
122
addons/atragmx/functions/fnc_calculate_solution.sqf
Normal file
@ -0,0 +1,122 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_scopeBaseAngle", "_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_temperature", "_barometricPressure", "_relativeHumidity", "_simSteps", "_windSpeed", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange", "_bc", "_dragModel", "_atmosphereModel", "_storeRangeCardData"];
|
||||
_scopeBaseAngle = _this select 0;
|
||||
_bulletMass = _this select 1;
|
||||
_boreHeight = _this select 2;
|
||||
_airFriction = _this select 3;
|
||||
_muzzleVelocity = _this select 4;
|
||||
_temperature = _this select 5;
|
||||
_barometricPressure = _this select 6;
|
||||
_relativeHumidity = _this select 7;
|
||||
_simSteps = _this select 8;
|
||||
_windSpeed = _this select 9;
|
||||
_windDirection = _this select 10;
|
||||
_inclinationAngle = _this select 11;
|
||||
_targetSpeed = _this select 12;
|
||||
_targetRange = _this select 13;
|
||||
_bc = _this select 14;
|
||||
_dragModel = _this select 15;
|
||||
_atmosphereModel = _this select 16;
|
||||
_storeRangeCardData = _this select 17;
|
||||
|
||||
private ["_bulletPos", "_bulletVelocity", "_bulletSpeed", "_bulletAccel", "_gravity", "_deltaT"];
|
||||
_bulletPos = [0, 0, 0];
|
||||
_bulletVelocity = [0, 0, 0];
|
||||
_bulletAccel = [0, 0, 0];
|
||||
_gravity = [0, sin(_scopeBaseAngle + _inclinationAngle) * -9.80665, cos(_scopeBaseAngle + _inclinationAngle) * -9.80665];
|
||||
_deltaT = 1 / _simSteps;
|
||||
|
||||
private ["_elevation", "_windage", "_lead", "_TOF", "_trueVelocity", "_trueSpeed", "_kineticEnergy"];
|
||||
_elevation = 0;
|
||||
_windage = 0;
|
||||
_lead = 0;
|
||||
_TOF = 0;
|
||||
_trueVelocity = [0, 0, 0];
|
||||
_trueSpeed = 0;
|
||||
|
||||
private ["_n", "_range", "_rangeFactor"];
|
||||
_n = 0;
|
||||
_range = 0;
|
||||
_rangeFactor = 1;
|
||||
if (_storeRangeCardData) then {
|
||||
if (GVAR(ATragMX_currentUnit) != 2) then {
|
||||
_rangeFactor = 1.0936133;
|
||||
};
|
||||
GVAR(ATragMX_rangeCardData) = [];
|
||||
};
|
||||
|
||||
private ["_wind"];
|
||||
_wind = [cos(270 - _windDirection * 30) * _windSpeed, sin(270 - _windDirection * 30) * _windSpeed, 0];
|
||||
if (AdvancedBallistics) then {
|
||||
if (AB_AdvancedAirDragEnabled) then {
|
||||
_bc = [_bc, _temperature, _barometricPressure, _relativeHumidity, _atmosphereModel] call ab_fnc_calculate_atmospheric_correction;
|
||||
};
|
||||
};
|
||||
|
||||
_TOF = 0;
|
||||
|
||||
_bulletPos set [0, 0];
|
||||
_bulletPos set [1, 0];
|
||||
_bulletPos set [2, -(_boreHeight / 100)];
|
||||
|
||||
_bulletVelocity set [0, 0];
|
||||
_bulletVelocity set [1, Cos(_scopeBaseAngle) * _muzzleVelocity];
|
||||
_bulletVelocity set [2, Sin(_scopeBaseAngle) * _muzzleVelocity];
|
||||
|
||||
while {_TOF < 15 && (_bulletPos select 1) < _targetRange} do
|
||||
{
|
||||
_bulletSpeed = vectorMagnitude _bulletVelocity;
|
||||
|
||||
_trueVelocity = _bulletVelocity vectorDiff _wind;
|
||||
_trueSpeed = vectorMagnitude _trueVelocity;
|
||||
|
||||
if (AdvancedBallistics) then {
|
||||
if (AB_AdvancedAirDragEnabled) then {
|
||||
private ["_drag"];
|
||||
_drag = -1 * ([_dragModel, _bc, _trueSpeed] call ab_fnc_calculate_retardation);
|
||||
_bulletAccel = (vectorNormalized _trueVelocity) vectorMultiply (_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(ATragMX_rangeCardStartRange) + _n * GVAR(ATragMX_rangeCardIncrement);
|
||||
if ((_bulletPos select 1) * _rangeFactor >= _range && _range <= GVAR(ATragMX_rangeCardEndRange)) then {
|
||||
if ((_bulletPos select 1) > 0) then {
|
||||
_elevation = - atan((_bulletPos select 2) / (_bulletPos select 1));
|
||||
_windage = - atan((_bulletPos select 0) / (_bulletPos select 1));
|
||||
};
|
||||
if (_range != 0) then {
|
||||
_lead = (_targetSpeed * _TOF) / (Tan(3.38 / 60) * _range);
|
||||
};
|
||||
_kineticEnergy = 0.5 * (_bulletMass / 1000 * (_bulletSpeed ^ 2));
|
||||
_kineticEnergy = _kineticEnergy * 0.737562149;
|
||||
|
||||
GVAR(ATragMX_rangeCardData) set [_n, [_range, _elevation * 60, _windage * 60, _lead, _TOF, _bulletSpeed, _kineticEnergy]];
|
||||
_n = _n + 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if ((_bulletPos select 1) > 0) then {
|
||||
_elevation = - atan((_bulletPos select 2) / (_bulletPos select 1));
|
||||
_windage = - atan((_bulletPos select 0) / (_bulletPos select 1));
|
||||
};
|
||||
|
||||
if (_targetRange != 0) then {
|
||||
_lead = (_targetSpeed * _TOF) / (Tan(3.38 / 60) * _targetRange);
|
||||
};
|
||||
|
||||
_kineticEnergy = 0.5 * (_bulletMass / 1000 * (_bulletSpeed ^ 2));
|
||||
_kineticEnergy = _kineticEnergy * 0.737562149;
|
||||
|
||||
[_elevation * 60, _windage * 60, _lead, _TOF, _bulletSpeed, _kineticEnergy]
|
105
addons/atragmx/functions/fnc_calculate_target_range_assist.sqf
Normal file
105
addons/atragmx/functions/fnc_calculate_target_range_assist.sqf
Normal file
@ -0,0 +1,105 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_targetSize", "_imageSize", "_angle", "_estRange"];
|
||||
|
||||
_angle = parseNumber(ctrlText 7012);
|
||||
_targetSize = parseNumber(ctrlText 7010);
|
||||
if (GVAR(ATragMX_rangeAssistUseTargetHeight)) then
|
||||
{
|
||||
_targetSize = _targetSize * cos(_angle);
|
||||
};
|
||||
switch (GVAR(ATragMX_rangeAssistTargetSizeUnit)) do
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
_targetSize = _targetSize * 0.0254;
|
||||
};
|
||||
case 1:
|
||||
{
|
||||
_targetSize = _targetSize * 0.3048;
|
||||
};
|
||||
case 2:
|
||||
{
|
||||
_targetSize = _targetSize * 0.01;
|
||||
};
|
||||
};
|
||||
_imageSize = parseNumber(ctrlText 7011);
|
||||
switch (GVAR(ATragMX_rangeAssistImageSizeUnit)) do
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
_imageSize = _imageSize / 6400 * 360;
|
||||
};
|
||||
case 1:
|
||||
{
|
||||
_imageSize = _imageSize / 60;
|
||||
};
|
||||
case 2:
|
||||
{
|
||||
_imageSize = _imageSize / 60 / 1.047;
|
||||
};
|
||||
};
|
||||
_estRange = parseNumber(ctrlText 7013);
|
||||
if (GVAR(ATragMX_currentUnit) != 2) then
|
||||
{
|
||||
_estRange = _estRange / 1.0936133;
|
||||
};
|
||||
|
||||
switch (_this) do
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
_targetSize = tan(_imageSize) * _estRange;
|
||||
|
||||
if (GVAR(ATragMX_rangeAssistUseTargetHeight)) then
|
||||
{
|
||||
_targetSize = _targetSize / cos(_angle);
|
||||
};
|
||||
|
||||
switch (GVAR(ATragMX_rangeAssistTargetSizeUnit)) do
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
_targetSize = _targetSize / 0.0254;
|
||||
};
|
||||
case 1:
|
||||
{
|
||||
_targetSize = _targetSize / 0.3048;
|
||||
};
|
||||
case 2:
|
||||
{
|
||||
_targetSize = _targetSize / 0.01;
|
||||
};
|
||||
};
|
||||
|
||||
ctrlSetText [7010, Str(Round(_targetSize * 100) / 100)];
|
||||
};
|
||||
case 1:
|
||||
{
|
||||
_imageSize = atan(_targetSize / _estRange);
|
||||
|
||||
switch (GVAR(ATragMX_rangeAssistImageSizeUnit)) do
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
_imageSize = _imageSize * 6400 / 360;
|
||||
};
|
||||
case 1:
|
||||
{
|
||||
_imageSize = _imageSize * 60;
|
||||
};
|
||||
case 2:
|
||||
{
|
||||
_imageSize = _imageSize * 60 * 1.047;
|
||||
};
|
||||
};
|
||||
|
||||
ctrlSetText [7011, Str(Round(_imageSize * 100) / 100)];
|
||||
};
|
||||
case 2:
|
||||
{
|
||||
_estRange = _targetSize / tan(_imageSize);
|
||||
|
||||
ctrlSetText [7013, Str(Round(_estRange))];
|
||||
};
|
||||
};
|
52
addons/atragmx/functions/fnc_calculate_target_solution.sqf
Normal file
52
addons/atragmx/functions/fnc_calculate_target_solution.sqf
Normal file
@ -0,0 +1,52 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
call compile preprocessFile ("\atragmx\fnc_parse_input.sqf");
|
||||
|
||||
private ["_scopeBaseAngle"];
|
||||
_scopeBaseAngle = ((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 3);
|
||||
|
||||
private ["_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel"];
|
||||
_bulletMass = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 12;
|
||||
_boreHeight = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 5;
|
||||
_airFriction = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 4;
|
||||
_muzzleVelocity = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 1;
|
||||
_bc = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 15;
|
||||
_dragModel = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 16;
|
||||
_atmosphereModel = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 17;
|
||||
|
||||
private ["_temperature", "_barometricPressure", "_relativeHumidity"];
|
||||
_temperature = (GVAR(ATragMX_temperature) select GVAR(ATragMX_currentTarget));
|
||||
_barometricPressure = (GVAR(ATragMX_barometricPressure) select GVAR(ATragMX_currentTarget));
|
||||
_relativeHumidity = (GVAR(ATragMX_relativeHumidity) select GVAR(ATragMX_currentTarget));
|
||||
if (GVAR(ATragMX_currentUnit) == 1) then
|
||||
{
|
||||
_temperature = (_temperature - 32) / 1.8;
|
||||
_barometricPressure = _barometricPressure * 33.8638866667;
|
||||
};
|
||||
|
||||
private ["_windSpeed", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange"];
|
||||
_windSpeed = (GVAR(ATragMX_windSpeed) select GVAR(ATragMX_currentTarget));
|
||||
_windDirection = (GVAR(ATragMX_windDirection) select GVAR(ATragMX_currentTarget));
|
||||
_inclinationAngle = (GVAR(ATragMX_inclinationAngle) select GVAR(ATragMX_currentTarget));
|
||||
_targetSpeed = (GVAR(ATragMX_targetSpeed) select GVAR(ATragMX_currentTarget));
|
||||
_targetRange = (GVAR(ATragMX_targetRange) select GVAR(ATragMX_currentTarget));
|
||||
if (GVAR(ATragMX_currentUnit) != 2) then
|
||||
{
|
||||
_targetRange = _targetRange / 1.0936133;
|
||||
};
|
||||
if (GVAR(ATragMX_currentUnit) == 1) then
|
||||
{
|
||||
_windSpeed = _windSpeed / 2.23693629;
|
||||
_targetSpeed = _targetSpeed / 2.23693629;
|
||||
};
|
||||
|
||||
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000,
|
||||
_windSpeed, _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, false] call FUNC(calculate_solution);
|
||||
|
||||
GVAR(ATragMX_elevationOutput) set [GVAR(ATragMX_currentTarget), _result select 0];
|
||||
GVAR(ATragMX_windageOutput) set [GVAR(ATragMX_currentTarget), _result select 1];
|
||||
GVAR(ATragMX_leadOutput) set [GVAR(ATragMX_currentTarget), _result select 2];
|
||||
GVAR(ATragMX_tofOutput) set [GVAR(ATragMX_currentTarget), _result select 3];
|
||||
GVAR(ATragMX_velocityOutput) set [GVAR(ATragMX_currentTarget), _result select 4];
|
||||
|
||||
call compile preprocessFile ("\atragmx\fnc_update_result.sqf");
|
@ -0,0 +1,41 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_targetRange", "_numTicks", "_timeSecs", "_estSpeed"];
|
||||
|
||||
_targetRange = parseNumber(ctrlText 8004);
|
||||
_numTicks = parseNumber(ctrlText 8005);
|
||||
_timeSecs = parseNumber(ctrlText 8006);
|
||||
_estSpeed = 0;
|
||||
|
||||
if (GVAR(ATragMX_currentUnit) != 2) then
|
||||
{
|
||||
_targetRange = _targetRange / 1.0936133;
|
||||
};
|
||||
|
||||
switch (GVAR(ATragMX_rangeAssistImageSizeUnit)) do
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
_numTicks = _numTicks / 6400 * 360;
|
||||
};
|
||||
case 1:
|
||||
{
|
||||
_numTicks = _numTicks / 60;
|
||||
};
|
||||
case 2:
|
||||
{
|
||||
_numTicks = _numTicks / 60 / 1.047;
|
||||
};
|
||||
};
|
||||
|
||||
if (_timeSecs > 0) then
|
||||
{
|
||||
_estSpeed = tan(_numTicks) * _targetRange / _timeSecs;
|
||||
};
|
||||
|
||||
if (GVAR(ATragMX_currentUnit) == 1) then
|
||||
{
|
||||
_estSpeed = _estSpeed * 2.23693629;
|
||||
};
|
||||
|
||||
ctrlSetText [8007, Str(Round(_estSpeed * 10) / 10)];
|
23
addons/atragmx/functions/fnc_change_gun.sqf
Normal file
23
addons/atragmx/functions/fnc_change_gun.sqf
Normal file
@ -0,0 +1,23 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (_this < 0 || _this > (count GVAR(ATragMX_gunList)) - 1) exitWith {};
|
||||
|
||||
GVAR(ATragMX_workingMemory) set [GVAR(ATragMX_currentTarget), +(GVAR(ATragMX_gunList) select _this)];
|
||||
GVAR(ATragMX_currentGun) set [GVAR(ATragMX_currentTarget), _this];
|
||||
|
||||
lbSetCurSel [6000, (GVAR(ATragMX_currentGun) select GVAR(ATragMX_currentTarget))];
|
||||
|
||||
if ((GVAR(ATragMX_scopeUnits) select (GVAR(ATragMX_currentScopeUnit) select GVAR(ATragMX_currentTarget))) != "Clicks") then
|
||||
{
|
||||
GVAR(ATragMX_currentScopeUnit) set [GVAR(ATragMX_currentTarget), (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 6];
|
||||
};
|
||||
|
||||
call compile preprocessFile ("\atragmx\fnc_update_gun.sqf");
|
||||
|
||||
GVAR(ATragMX_elevationOutput) set [GVAR(ATragMX_currentTarget), 0];
|
||||
GVAR(ATragMX_windageOutput) set [GVAR(ATragMX_currentTarget), 0];
|
||||
GVAR(ATragMX_leadOutput) set [GVAR(ATragMX_currentTarget), 0];
|
||||
GVAR(ATragMX_tofOutput) set [GVAR(ATragMX_currentTarget), 0];
|
||||
GVAR(ATragMX_velocityOutput) set [GVAR(ATragMX_currentTarget), 0];
|
||||
|
||||
call compile preprocessFile ("\atragmx\fnc_update_result.sqf");
|
25
addons/atragmx/functions/fnc_create_dialog.sqf
Normal file
25
addons/atragmx/functions/fnc_create_dialog.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (dialog) exitWith { false };
|
||||
if (underwater player) exitWith { false };
|
||||
if (!("ATragMX" in (uniformItems player)) && !("ATragMX" in (vestItems player))) exitWith { false };
|
||||
|
||||
execVM "\atragmx\fnc_update_target_selection.sqf";
|
||||
|
||||
createDialog 'ATragMX_Display';
|
||||
|
||||
true execVM "\atragmx\fnc_show_main_page.sqf";
|
||||
|
||||
false execVM "\atragmx\fnc_show_add_new_gun.sqf";
|
||||
false execVM "\atragmx\fnc_show_gun_list.sqf";
|
||||
false execVM "\atragmx\fnc_show_range_card.sqf";
|
||||
false execVM "\atragmx\fnc_show_range_card_setup.sqf";
|
||||
false execVM "\atragmx\fnc_show_target_range_assist.sqf";
|
||||
false execVM "\atragmx\fnc_show_target_speed_assist.sqf";
|
||||
false execVM "\atragmx\fnc_show_target_speed_assist_timer.sqf";
|
||||
|
||||
{
|
||||
lbAdd [6000, _x select 0];
|
||||
} forEach GVAR(ATragMX_gunList);
|
||||
|
||||
true
|
@ -0,0 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(ATragMX_rangeCardCurrentColumn) = (GVAR(ATragMX_rangeCardCurrentColumn) + 1) % (count GVAR(ATragMX_rangeCardLastColumns));
|
||||
|
||||
ctrlSetText [5006, (GVAR(ATragMX_rangeCardLastColumns) select GVAR(ATragMX_rangeCardCurrentColumn))];
|
||||
|
||||
call compile preprocessFile ("\atragmx\fnc_update_range_card.sqf");
|
8
addons/atragmx/functions/fnc_cycle_scope_unit.sqf
Normal file
8
addons/atragmx/functions/fnc_cycle_scope_unit.sqf
Normal file
@ -0,0 +1,8 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
call compile preprocessFile ("\atragmx\fnc_parse_input.sqf");
|
||||
|
||||
GVAR(ATragMX_currentScopeUnit) set [GVAR(ATragMX_currentTarget), ((GVAR(ATragMX_currentScopeUnit) select GVAR(ATragMX_currentTarget)) + 1) % (count GVAR(ATragMX_scopeUnits))];
|
||||
|
||||
call compile preprocessFile ("\atragmx\fnc_update_scope_unit.sqf");
|
||||
call compile preprocessFile ("\atragmx\fnc_update_result.sqf");
|
19
addons/atragmx/functions/fnc_delete_gun.sqf
Normal file
19
addons/atragmx/functions/fnc_delete_gun.sqf
Normal file
@ -0,0 +1,19 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_index"];
|
||||
_index = lbCurSel 6000;
|
||||
|
||||
if (_index == -1) exitWith {};
|
||||
|
||||
for "_i" from 0 to (count GVAR(ATragMX_currentGun)) - 1 do {
|
||||
if ((GVAR(ATragMX_currentGun) select _i) > _index) then {
|
||||
GVAR(ATragMX_currentGun) set [_i, (GVAR(ATragMX_currentGun) select _i) - 1];
|
||||
};
|
||||
};
|
||||
|
||||
GVAR(ATragMX_gunList) set [_index, 0];
|
||||
GVAR(ATragMX_gunList) = GVAR(ATragMX_gunList) - [0];
|
||||
|
||||
lbDelete [6000, _index];
|
||||
|
||||
profileNamespace setVariable ["GVAR(ATragMX_gunList)", GVAR(ATragMX_gunList)];
|
46
addons/atragmx/functions/fnc_init.sqf
Normal file
46
addons/atragmx/functions/fnc_init.sqf
Normal file
@ -0,0 +1,46 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isNil QUOTE(EGVAR(advanced_ballistics, AdvancedBallistics))) then { EGVAR(advanced_ballistics, AdvancedBallistics) = false; };
|
||||
if (isNil QUOTE(EGVAR(advanced_ballistics, AdvancedAirDragEnabled))) then { EGVAR(advanced_ballistics, AdvancedAirDragEnabled) = false; };
|
||||
|
||||
GVAR(ATragMX_workingMemory) = [+(GVAR(ATragMX_gunList) select 0), +(GVAR(ATragMX_gunList) select 0), +(GVAR(ATragMX_gunList) select 0), +(GVAR(ATragMX_gunList) select 0)];
|
||||
|
||||
GVAR(ATragMX_scopeUnits) = ["MILs", "TMOA", "SMOA", "Clicks"];
|
||||
|
||||
GVAR(ATragMX_rangeCardStartRange) = 200;
|
||||
GVAR(ATragMX_rangeCardEndRange) = 2000;
|
||||
GVAR(ATragMX_rangeCardIncrement) = 50;
|
||||
GVAR(ATragMX_rangeCardLastColumns) = ["Lead", "RemV", "RemE", "TmFlt"];
|
||||
GVAR(ATragMX_rangeCardCurrentColumn) = 3;
|
||||
GVAR(ATragMX_rangeCardData) = [];
|
||||
|
||||
GVAR(GVAR(ATragMX_rangeAssistTargetSizeUnit)s) = ["in", "ft", "cm", "m"];
|
||||
GVAR(ATragMX_rangeAssistTargetSizeUnit) = 2;
|
||||
GVAR(ATragMX_rangeAssistImageSizeUnits) = ["MIL", "TMOA", "IOA"];
|
||||
GVAR(ATragMX_rangeAssistImageSizeUnit) = 0;
|
||||
GVAR(ATragMX_rangeAssistUseTargetHeight) = true;
|
||||
|
||||
GVAR(ATragMX_speedAssistNumTicksUnits) = ["MIL", "TMOA", "IOA"];
|
||||
GVAR(ATragMX_speedAssistNumTicksUnit) = 0;
|
||||
GVAR(ATragMX_speedAssistTimer) = true;
|
||||
|
||||
GVAR(ATragMX_currentUnit) = 2;
|
||||
GVAR(ATragMX_currentGun) = [0, 0, 0, 0];
|
||||
GVAR(ATragMX_currentTarget) = 0;
|
||||
GVAR(ATragMX_currentScopeUnit) = [0, 0, 0, 0];
|
||||
|
||||
GVAR(ATragMX_temperature) = [15, 15, 15, 15];
|
||||
GVAR(ATragMX_barometricPressure) = [1013.25, 1013.25, 1013.25, 1013.25];
|
||||
GVAR(ATragMX_relativeHumidity) = [0.5, 0.5, 0.5, 0.5];
|
||||
|
||||
GVAR(ATragMX_windSpeed) = [0, 0, 0, 0];
|
||||
GVAR(ATragMX_windDirection) = [12, 12, 12, 12];
|
||||
GVAR(ATragMX_inclinationAngle) = [0, 0, 0, 0];
|
||||
GVAR(ATragMX_targetSpeed) = [0, 0, 0, 0];
|
||||
GVAR(ATragMX_targetRange) = [0, 0, 0, 0];
|
||||
|
||||
GVAR(ATragMX_elevationOutput) = [0, 0, 0, 0];
|
||||
GVAR(ATragMX_windageOutput) = [0, 0, 0, 0];
|
||||
GVAR(ATragMX_leadOutput) = [0, 0, 0, 0];
|
||||
GVAR(ATragMX_tofOutput) = [0, 0, 0, 0];
|
||||
GVAR(ATragMX_velocityOutput) = [0, 0, 0, 0];
|
74
addons/atragmx/functions/fnc_parse_input.sqf
Normal file
74
addons/atragmx/functions/fnc_parse_input.sqf
Normal file
@ -0,0 +1,74 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(ATragMX_temperature) set [GVAR(ATragMX_currentTarget), parseNumber(ctrlText 200)];
|
||||
GVAR(ATragMX_barometricPressure) set [GVAR(ATragMX_currentTarget), 0 max parseNumber(ctrlText 210)];
|
||||
GVAR(ATragMX_relativeHumidity) set [GVAR(ATragMX_currentTarget), (0 max parseNumber(ctrlText 220) min 100) / 100];
|
||||
|
||||
GVAR(ATragMX_windSpeed) set [GVAR(ATragMX_currentTarget), 0 max abs(parseNumber(ctrlText 300)) min 50];
|
||||
GVAR(ATragMX_windDirection) set [GVAR(ATragMX_currentTarget), 1 max Round(parseNumber(ctrlText 310)) min 12];
|
||||
GVAR(ATragMX_inclinationAngle) set [GVAR(ATragMX_currentTarget), -60 max parseNumber(ctrlText 320) min 60];
|
||||
GVAR(ATragMX_targetSpeed) set [GVAR(ATragMX_currentTarget), 0 max abs(parseNumber(ctrlText 330)) min 50];
|
||||
GVAR(ATragMX_targetRange) set [GVAR(ATragMX_currentTarget), 0 max abs(parseNumber(ctrlText 340)) min 4000];
|
||||
|
||||
private ["_boreHeight", "_bulletMass", "_airFriction", "_muzzleVelocity"];
|
||||
_boreHeight = parseNumber(ctrlText 100);
|
||||
_bulletMass = parseNumber(ctrlText 110);
|
||||
if (AdvancedBallistics && AB_AdvancedAirDragEnabled) then {
|
||||
_airFriction = 0.1 max parseNumber(ctrlText 120) min 2;
|
||||
} else {
|
||||
_airFriction = parseNumber(ctrlText 120) / -1000;
|
||||
};
|
||||
_muzzleVelocity = parseNumber(ctrlText 130);
|
||||
if (GVAR(ATragMX_currentUnit) == 1) then
|
||||
{
|
||||
_boreHeight = _boreHeight * 2.54;
|
||||
_bulletMass = _bulletMass * 0.06479891;
|
||||
_muzzleVelocity = _muzzleVelocity / 3.2808399;
|
||||
};
|
||||
_boreHeight = 0.1 max _boreHeight min 10;
|
||||
_bulletMass = 1 max _bulletMass min 100;
|
||||
_muzzleVelocity = 100 max _muzzleVelocity min 1400;
|
||||
|
||||
(GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) set [5, _boreHeight];
|
||||
(GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) set [12, _bulletMass];
|
||||
if (AdvancedBallistics && AB_AdvancedAirDragEnabled) then {
|
||||
(GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) set [15, _airFriction];
|
||||
} else {
|
||||
(GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) set [4, _airFriction];
|
||||
};
|
||||
(GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) set [1, _muzzleVelocity];
|
||||
|
||||
private ["_elevationCur", "_elevationCur", "_elevationScopeStep", "_windageScopeStep"];
|
||||
_elevationCur = parseNumber(ctrlText 402);
|
||||
_windageCur = parseNumber(ctrlText 412);
|
||||
|
||||
switch ((GVAR(ATragMX_currentScopeUnit) select GVAR(ATragMX_currentTarget))) do
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
_elevationCur = _elevationCur * 3.38;
|
||||
_windageCur = _windageCur * 3.38;
|
||||
};
|
||||
|
||||
case 2:
|
||||
{
|
||||
_elevationCur = _elevationCur / 1.047;
|
||||
_windageCur = _windageCur / 1.047;
|
||||
};
|
||||
|
||||
case 3:
|
||||
{
|
||||
_elevationScopeStep = ((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 7);
|
||||
_windageScopeStep = ((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 8);
|
||||
|
||||
_elevationCur = _elevationCur * _elevationScopeStep;
|
||||
_windageCur = _windageCur * _windageScopeStep;
|
||||
};
|
||||
};
|
||||
|
||||
(GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) set [10, _elevationCur];
|
||||
(GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) set [11, _windageCur];
|
||||
|
||||
call compile preprocessFile ("\atragmx\fnc_update_gun.sqf");
|
||||
call compile preprocessFile ("\atragmx\fnc_update_atmosphere.sqf");
|
||||
call compile preprocessFile ("\atragmx\fnc_update_target.sqf");
|
@ -0,0 +1,6 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
(GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) set [10, 0];
|
||||
(GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) set [11, 0];
|
||||
|
||||
call compile preprocessFile ("\atragmx\fnc_update_result.sqf");
|
13
addons/atragmx/functions/fnc_save_gun.sqf
Normal file
13
addons/atragmx/functions/fnc_save_gun.sqf
Normal file
@ -0,0 +1,13 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_index"];
|
||||
_index = 0 max (lbCurSel 6000);
|
||||
|
||||
GVAR(ATragMX_gunList) set [_index, +(GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget))];
|
||||
|
||||
lbClear 6000;
|
||||
{
|
||||
lbAdd [6000, _x select 0];
|
||||
} forEach GVAR(ATragMX_gunList);
|
||||
|
||||
profileNamespace setVariable ["GVAR(ATragMX_gunList)", GVAR(ATragMX_gunList)];
|
3
addons/atragmx/functions/fnc_show_add_new_gun.sqf
Normal file
3
addons/atragmx/functions/fnc_show_add_new_gun.sqf
Normal file
@ -0,0 +1,3 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [11000, 11001, 11002, 11003];
|
3
addons/atragmx/functions/fnc_show_gun_list.sqf
Normal file
3
addons/atragmx/functions/fnc_show_gun_list.sqf
Normal file
@ -0,0 +1,3 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [6000, 6001, 6002, 6003, 6004, 6005, 6006, 6007];
|
4
addons/atragmx/functions/fnc_show_main_page.sqf
Normal file
4
addons/atragmx/functions/fnc_show_main_page.sqf
Normal file
@ -0,0 +1,4 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [10, 100, 11, 110, 12, 120, 13, 130, 14, 140, 20, 200, 21, 210, 22, 220, 30, 300, 31, 310, 32, 320, 33, 330, 34, 340, 40, 400, 401, 402, 403, 41, 410, 411, 412, 42, 420,
|
||||
500, 501, 502, 503, 600, 601, 602, 603, 1000, 2000, 3000, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008];
|
3
addons/atragmx/functions/fnc_show_range_card.sqf
Normal file
3
addons/atragmx/functions/fnc_show_range_card.sqf
Normal file
@ -0,0 +1,3 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [5000, 5001, 5002, 5003, 5004, 5005, 5006, 5007];
|
3
addons/atragmx/functions/fnc_show_range_card_setup.sqf
Normal file
3
addons/atragmx/functions/fnc_show_range_card_setup.sqf
Normal file
@ -0,0 +1,3 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [10000, 10001, 10002, 10003, 10004, 10005, 10006, 10007, 10008, 10009];
|
@ -0,0 +1,3 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010, 7011, 7012, 7013, 7014, 7015, 7016, 7017, 7018, 7019, 7020];
|
@ -0,0 +1,3 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009, 8010, 8011, 8012, 8013, 8014, 8015];
|
@ -0,0 +1,3 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [9000, 9001, 9002];
|
22
addons/atragmx/functions/fnc_sord.sqf
Normal file
22
addons/atragmx/functions/fnc_sord.sqf
Normal file
@ -0,0 +1,22 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ATragMX_COMPAT_LRF = ["Rangefinder", "Laserdesignator"];
|
||||
|
||||
private ["_fnc_atragmx"];
|
||||
|
||||
_fnc_atragmx = {
|
||||
private ["_target", "_position", "_range", "_inclinationAngle"];
|
||||
|
||||
if ((local player) && (currentWeapon player) in ATragMX_COMPAT_LRF && (!isNull (_this select 0))) then {
|
||||
_target = getPosATL (_this select 0);
|
||||
_position = getPosATL player;
|
||||
|
||||
_inclinationAngle = asin((player weaponDirection currentWeapon player) select 2);
|
||||
_range = _position distance _target;
|
||||
|
||||
GVAR(ATragMX_inclinationAngle) set [GVAR(ATragMX_currentTarget), _inclinationAngle];
|
||||
GVAR(ATragMX_targetRange) set [GVAR(ATragMX_currentTarget), _range];
|
||||
};
|
||||
};
|
||||
|
||||
//["ace_sys_rangefinder_Lazing", _fnc_atragmx] call CBA_fnc_addEventHandler;
|
30
addons/atragmx/functions/fnc_target_speed_assist_timer.sqf
Normal file
30
addons/atragmx/functions/fnc_target_speed_assist_timer.sqf
Normal file
@ -0,0 +1,30 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define _dsp (uiNamespace getVariable "ATragMX_Display")
|
||||
|
||||
if !(ctrlVisible 9000) then
|
||||
{
|
||||
private ["_startTime"];
|
||||
|
||||
false execVM "\atragmx\fnc_show_target_speed_assist.sqf";
|
||||
true execVM "\atragmx\fnc_show_target_speed_assist_timer.sqf";
|
||||
|
||||
ctrlSetFocus (_dsp displayCtrl 9002);
|
||||
|
||||
_startTime = time;
|
||||
|
||||
while {GVAR(ATragMX_speedAssistTimer)} do
|
||||
{
|
||||
sleep 0.1;
|
||||
ctrlSetText [9001, Str(Round((time - _startTime) * 10) / 10)];
|
||||
};
|
||||
|
||||
GVAR(ATragMX_speedAssistTimer) = true;
|
||||
|
||||
ctrlSetText [8006, Str(Round((time - _startTime) * 10) / 10)];
|
||||
|
||||
call compile preprocessFile ("\atragmx\fnc_calculate_target_speed_assist.sqf");
|
||||
|
||||
false execVM "\atragmx\fnc_show_target_speed_assist_timer.sqf";
|
||||
true execVM "\atragmx\fnc_show_target_speed_assist.sqf";
|
||||
};
|
21
addons/atragmx/functions/fnc_toggle_gun_list.sqf
Normal file
21
addons/atragmx/functions/fnc_toggle_gun_list.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define _dsp (uiNamespace getVariable "ATragMX_Display")
|
||||
|
||||
if (ctrlVisible 6000) then
|
||||
{
|
||||
false execVM "\atragmx\fnc_show_gun_list.sqf";
|
||||
true execVM "\atragmx\fnc_show_main_page.sqf";
|
||||
|
||||
if (_this) then {
|
||||
(lbCurSel 6000) call compile preprocessFile ("\atragmx\fnc_change_gun.sqf");
|
||||
};
|
||||
} else
|
||||
{
|
||||
false execVM "\atragmx\fnc_show_main_page.sqf";
|
||||
true execVM "\atragmx\fnc_show_gun_list.sqf";
|
||||
|
||||
ctrlSetFocus (_dsp displayCtrl 6002);
|
||||
|
||||
lbSetCurSel [6000, (GVAR(ATragMX_currentGun) select GVAR(ATragMX_currentTarget))];
|
||||
};
|
18
addons/atragmx/functions/fnc_toggle_range_card.sqf
Normal file
18
addons/atragmx/functions/fnc_toggle_range_card.sqf
Normal file
@ -0,0 +1,18 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define _dsp (uiNamespace getVariable "ATragMX_Display")
|
||||
|
||||
if (ctrlVisible 5006) then
|
||||
{
|
||||
false execVM "\atragmx\fnc_show_range_card.sqf";
|
||||
true execVM "\atragmx\fnc_show_main_page.sqf";
|
||||
} else
|
||||
{
|
||||
false execVM "\atragmx\fnc_show_main_page.sqf";
|
||||
true execVM "\atragmx\fnc_show_range_card.sqf";
|
||||
|
||||
ctrlSetFocus (_dsp displayCtrl 5001);
|
||||
|
||||
call compile preprocessFile ("\atragmx\fnc_calculate_range_card.sqf");
|
||||
call compile preprocessFile ("\atragmx\fnc_update_range_card.sqf");
|
||||
};
|
29
addons/atragmx/functions/fnc_toggle_range_card_setup.sqf
Normal file
29
addons/atragmx/functions/fnc_toggle_range_card_setup.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define _dsp (uiNamespace getVariable "ATragMX_Display")
|
||||
|
||||
if (ctrlVisible 10000) then
|
||||
{
|
||||
false execVM "\atragmx\fnc_show_range_card_setup.sqf";
|
||||
true execVM "\atragmx\fnc_show_range_card.sqf";
|
||||
|
||||
if (_this == 1) then
|
||||
{
|
||||
GVAR(ATragMX_rangeCardStartRange) = 0 max Round(parseNumber(ctrlText 10003)) min 3000;
|
||||
GVAR(ATragMX_rangeCardEndRange) = 0 max Round(parseNumber(ctrlText 10004)) min 3000;
|
||||
GVAR(ATragMX_rangeCardIncrement) = 1 max Round(parseNumber(ctrlText 10005)) min 3000;
|
||||
|
||||
call compile preprocessFile ("\atragmx\fnc_calculate_range_card.sqf");
|
||||
call compile preprocessFile ("\atragmx\fnc_update_range_card.sqf");
|
||||
};
|
||||
} else
|
||||
{
|
||||
false execVM "\atragmx\fnc_show_range_card.sqf";
|
||||
true execVM "\atragmx\fnc_show_range_card_setup.sqf";
|
||||
|
||||
ctrlSetFocus (_dsp displayCtrl 10006);
|
||||
|
||||
ctrlSetText [10003, Str(Round(GVAR(ATragMX_rangeCardStartRange)))];
|
||||
ctrlSetText [10004, Str(Round(GVAR(ATragMX_rangeCardEndRange)))];
|
||||
ctrlSetText [10005, Str(Round(GVAR(ATragMX_rangeCardIncrement)))];
|
||||
};
|
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 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define _dsp (uiNamespace getVariable "ATragMX_Display")
|
||||
|
||||
if (ctrlVisible 7000) then
|
||||
{
|
||||
false execVM "\atragmx\fnc_show_target_range_assist.sqf";
|
||||
true execVM "\atragmx\fnc_show_main_page.sqf";
|
||||
|
||||
if (_this == 1) then
|
||||
{
|
||||
ctrlSetText [320, Str(parseNumber(ctrlText 7012))];
|
||||
ctrlSetText [340, Str(parseNumber(ctrlText 7013))];
|
||||
};
|
||||
} else
|
||||
{
|
||||
false execVM "\atragmx\fnc_show_main_page.sqf";
|
||||
true execVM "\atragmx\fnc_show_target_range_assist.sqf";
|
||||
|
||||
ctrlSetFocus (_dsp displayCtrl 7018);
|
||||
|
||||
ctrlSetText [7012, Str(parseNumber(ctrlText 320))];
|
||||
ctrlSetText [7013, Str(parseNumber(ctrlText 340))];
|
||||
|
||||
if (GVAR(ATragMX_currentUnit) != 2) then
|
||||
{
|
||||
ctrlSetText [7016, "Yards"];
|
||||
} else
|
||||
{
|
||||
ctrlSetText [7016, "Meters"];
|
||||
};
|
||||
};
|
39
addons/atragmx/functions/fnc_toggle_target_speed_assist.sqf
Normal file
39
addons/atragmx/functions/fnc_toggle_target_speed_assist.sqf
Normal file
@ -0,0 +1,39 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define _dsp (uiNamespace getVariable "ATragMX_Display")
|
||||
|
||||
if (ctrlVisible 8000) then
|
||||
{
|
||||
false execVM "\atragmx\fnc_show_target_speed_assist.sqf";
|
||||
true execVM "\atragmx\fnc_show_main_page.sqf";
|
||||
|
||||
if (_this == 1) then
|
||||
{
|
||||
call compile preprocessFile ("\atragmx\fnc_calculate_target_speed_assist.sqf");
|
||||
ctrlSetText [330, Str(parseNumber(ctrlText 8007))];
|
||||
};
|
||||
} else
|
||||
{
|
||||
false execVM "\atragmx\fnc_show_main_page.sqf";
|
||||
true execVM "\atragmx\fnc_show_target_speed_assist.sqf";
|
||||
|
||||
ctrlSetFocus (_dsp displayCtrl 8012);
|
||||
|
||||
ctrlSetText [8004, Str(Round((GVAR(ATragMX_targetRange) select GVAR(ATragMX_currentTarget))))];
|
||||
|
||||
if (GVAR(ATragMX_currentUnit) != 2) then
|
||||
{
|
||||
ctrlSetText [8008, "Yards"];
|
||||
} else
|
||||
{
|
||||
ctrlSetText [8008, "Meters"];
|
||||
};
|
||||
|
||||
if (GVAR(ATragMX_currentUnit) != 1) then
|
||||
{
|
||||
ctrlSetText [8011, "m/s"];
|
||||
} else
|
||||
{
|
||||
ctrlSetText [8011, "mph"];
|
||||
};
|
||||
};
|
9
addons/atragmx/functions/fnc_update_atmosphere.sqf
Normal file
9
addons/atragmx/functions/fnc_update_atmosphere.sqf
Normal file
@ -0,0 +1,9 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ctrlSetText [200, Str(Round((GVAR(ATragMX_temperature) select GVAR(ATragMX_currentTarget)) * 10) / 10)];
|
||||
if (GVAR(ATragMX_currentUnit) == 1) then {
|
||||
ctrlSetText [210, Str(Round((GVAR(ATragMX_barometricPressure) select GVAR(ATragMX_currentTarget)) * 100) / 100)];
|
||||
} else {
|
||||
ctrlSetText [210, Str(Round(GVAR(ATragMX_barometricPressure) select GVAR(ATragMX_currentTarget)))];
|
||||
};
|
||||
ctrlSetText [220, Str(Round((GVAR(ATragMX_relativeHumidity) select GVAR(ATragMX_currentTarget)) * 100 * 10) / 10)];
|
38
addons/atragmx/functions/fnc_update_gun.sqf
Normal file
38
addons/atragmx/functions/fnc_update_gun.sqf
Normal file
@ -0,0 +1,38 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ctrlSetText [1000, (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 0];
|
||||
if (GVAR(ATragMX_currentUnit) == 1) then
|
||||
{
|
||||
ctrlSetText [ 100, Str(Round(((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 5) / 2.54 * 100) / 100)];
|
||||
} else
|
||||
{
|
||||
ctrlSetText [ 100, Str(Round(((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 5) * 100) / 100)];
|
||||
};
|
||||
if (GVAR(ATragMX_currentUnit) == 1) then
|
||||
{
|
||||
ctrlSetText [ 110, Str(Round(((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 12) * 15.4323584))];
|
||||
} else
|
||||
{
|
||||
ctrlSetText [ 110, Str(Round((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 12))];
|
||||
};
|
||||
if (AdvancedBallistics && AB_AdvancedAirDragEnabled) then {
|
||||
ctrlSetText [ 120, Str(Round(((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 15) * 1000) / 1000)];
|
||||
} else {
|
||||
ctrlSetText [ 120, Str(Round(((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 4) * -1000 * 1000) / 1000)];
|
||||
};
|
||||
if (GVAR(ATragMX_currentUnit) == 1) then
|
||||
{
|
||||
ctrlSetText [130, Str(Round(((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 1) * 3.2808399))];
|
||||
} else
|
||||
{
|
||||
ctrlSetText [130, Str(Round((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 1))];
|
||||
};
|
||||
if (GVAR(ATragMX_currentUnit) == 2) then
|
||||
{
|
||||
ctrlSetText [140, Str(Round((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 2))];
|
||||
} else
|
||||
{
|
||||
ctrlSetText [140, Str(Round(((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 2) * 1.0936133))];
|
||||
};
|
||||
|
||||
call compile preprocessFile ("\atragmx\fnc_update_scope_unit.sqf");
|
89
addons/atragmx/functions/fnc_update_range_card.sqf
Normal file
89
addons/atragmx/functions/fnc_update_range_card.sqf
Normal file
@ -0,0 +1,89 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_range", "_elevation", "_windage", "_lead", "_TOF", "_velocity", "_kineticEnergy", "_rangeOutput", "_elevationOutput", "_windageOutput", "_lastColumnOutput"];
|
||||
_lastColumnOutput = "";
|
||||
|
||||
ctrlSetText [5006, (GVAR(ATragMX_rangeCardLastColumns) select GVAR(ATragMX_rangeCardCurrentColumn))];
|
||||
|
||||
if (GVAR(ATragMX_currentUnit) != 2) then
|
||||
{
|
||||
ctrlSetText [5003, "Yards"];
|
||||
} else
|
||||
{
|
||||
ctrlSetText [5003, "Meters"];
|
||||
};
|
||||
|
||||
lnbClear 5007;
|
||||
|
||||
{
|
||||
_range = _x select 0;
|
||||
_elevation = _x select 1;
|
||||
_windage = _x select 2;
|
||||
_lead = _x select 3;
|
||||
_TOF = _x select 4;
|
||||
_velocity = _x select 5;
|
||||
_kineticEnergy = _x select 6;
|
||||
|
||||
switch ((GVAR(ATragMX_currentScopeUnit) select GVAR(ATragMX_currentTarget))) do
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
_elevation = _elevation / 3.38;
|
||||
_windage = _windage / 3.38;
|
||||
};
|
||||
|
||||
case 2:
|
||||
{
|
||||
_elevation = _elevation * 1.047;
|
||||
_windage = _windage * 1.047;
|
||||
};
|
||||
|
||||
case 3:
|
||||
{
|
||||
_elevationScopeStep = ((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 7);
|
||||
_windageScopeStep = ((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 8);
|
||||
|
||||
_elevation = Round(_elevation / _elevationScopeStep);
|
||||
_windage = Round(_windage / _windageScopeStep);
|
||||
};
|
||||
};
|
||||
|
||||
_elevationOutput = Str(Round(_elevation * 100) / 100);
|
||||
_windageOutput = Str(Round(_windage * 100) / 100);
|
||||
|
||||
_rangeOutput = Str(_range);
|
||||
if (_velocity < 340.29) then
|
||||
{
|
||||
_rangeOutput = _rangeOutput + "*";
|
||||
};
|
||||
|
||||
if (GVAR(ATragMX_currentUnit) == 1) then
|
||||
{
|
||||
_velocity = _velocity * 3.2808399;
|
||||
};
|
||||
|
||||
switch (GVAR(ATragMX_rangeCardCurrentColumn)) do
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
_lastColumnOutput = Str(Round(_lead * 100) / 100);
|
||||
};
|
||||
|
||||
case 1:
|
||||
{
|
||||
_lastColumnOutput = Str(Round(_velocity));
|
||||
};
|
||||
|
||||
case 2:
|
||||
{
|
||||
_lastColumnOutput = Str(Round(_kineticEnergy));
|
||||
};
|
||||
|
||||
case 3:
|
||||
{
|
||||
_lastColumnOutput = Str(Round(_TOF * 100) / 100);
|
||||
}
|
||||
};
|
||||
|
||||
lnbAddRow [5007, [_rangeOutput, _elevationOutput, _windageOutput, _lastColumnOutput]];
|
||||
} forEach GVAR(ATragMX_rangeCardData);
|
@ -0,0 +1,6 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
(GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) set [10, (GVAR(ATragMX_elevationOutput) select GVAR(ATragMX_currentTarget))];
|
||||
(GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) set [11, (GVAR(ATragMX_windageOutput) select GVAR(ATragMX_currentTarget))];
|
||||
|
||||
call compile preprocessFile ("\atragmx\fnc_update_result.sqf");
|
65
addons/atragmx/functions/fnc_update_result.sqf
Normal file
65
addons/atragmx/functions/fnc_update_result.sqf
Normal file
@ -0,0 +1,65 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_elevationAbs", "_elevationRel", "_elevationCur", "_windageAbs", "_windageRel", "_windageCur", "_lead", "_elevationScopeStep", "_windageScopeStep"];
|
||||
_elevationAbs = (GVAR(ATragMX_elevationOutput) select GVAR(ATragMX_currentTarget));
|
||||
_windageAbs = (GVAR(ATragMX_windageOutput) select GVAR(ATragMX_currentTarget));
|
||||
|
||||
_elevationCur = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 10;
|
||||
_windageCur = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 11;
|
||||
|
||||
_elevationRel = _elevationAbs - _elevationCur;
|
||||
_windageRel = _windageAbs - _windageCur;
|
||||
|
||||
_lead = (GVAR(ATragMX_leadOutput) select GVAR(ATragMX_currentTarget));
|
||||
|
||||
switch ((GVAR(ATragMX_currentScopeUnit) select GVAR(ATragMX_currentTarget))) do
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
_elevationAbs = _elevationAbs / 3.38;
|
||||
_windageAbs = _windageAbs / 3.38;
|
||||
|
||||
_elevationRel = _elevationRel / 3.38;
|
||||
_windageRel = _windageRel / 3.38;
|
||||
|
||||
_elevationCur = _elevationCur / 3.38;
|
||||
_windageCur = _windageCur / 3.38;
|
||||
};
|
||||
|
||||
case 2:
|
||||
{
|
||||
_elevationAbs = _elevationAbs * 1.047;
|
||||
_windageAbs = _windageAbs * 1.047;
|
||||
|
||||
_elevationRel = _elevationRel * 1.047;
|
||||
_windageRel = _windageRel * 1.047;
|
||||
|
||||
_elevationCur = _elevationCur * 1.047;
|
||||
_windageCur = _windageCur * 1.047;
|
||||
};
|
||||
|
||||
case 3:
|
||||
{
|
||||
_elevationScopeStep = ((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 7);
|
||||
_windageScopeStep = ((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 8);
|
||||
|
||||
_elevationAbs = Round(_elevationAbs / _elevationScopeStep);
|
||||
_windageAbs = Round(_windageAbs / _windageScopeStep);
|
||||
|
||||
_elevationRel = Round(_elevationRel / _elevationScopeStep);
|
||||
_windageRel = Round(_windageRel / _windageScopeStep);
|
||||
|
||||
_elevationCur = Round(_elevationCur / _elevationScopeStep);
|
||||
_windageCur = Round(_windageCur / _windageScopeStep);
|
||||
};
|
||||
};
|
||||
|
||||
ctrlSetText [400, Str(Round(_elevationAbs * 100) / 100)];
|
||||
ctrlSetText [401, Str(Round(_elevationRel * 100) / 100)];
|
||||
ctrlSetText [402, Str(Round(_elevationCur * 100) / 100)];
|
||||
|
||||
ctrlSetText [410, Str(Round(_windageAbs * 100) / 100)];
|
||||
ctrlSetText [411, Str(Round(_windageRel * 100) / 100)];
|
||||
ctrlSetText [412, Str(Round(_windageCur * 100) / 100)];
|
||||
|
||||
ctrlSetText [420, Str(Round(_lead * 100) / 100)];
|
4
addons/atragmx/functions/fnc_update_scope_unit.sqf
Normal file
4
addons/atragmx/functions/fnc_update_scope_unit.sqf
Normal file
@ -0,0 +1,4 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ctrlSetText [2000, GVAR(ATragMX_scopeUnits) select (GVAR(ATragMX_currentScopeUnit) select GVAR(ATragMX_currentTarget))];
|
||||
ctrlSetText [5000, GVAR(ATragMX_scopeUnits) select (GVAR(ATragMX_currentScopeUnit) select GVAR(ATragMX_currentTarget))];
|
22
addons/atragmx/functions/fnc_update_target.sqf
Normal file
22
addons/atragmx/functions/fnc_update_target.sqf
Normal file
@ -0,0 +1,22 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!isNil ("GVAR(ATragMX_windSpeed)")) then
|
||||
{
|
||||
ctrlSetText [300, Str(Round((GVAR(ATragMX_windSpeed) select GVAR(ATragMX_currentTarget)) * 100) / 100)];
|
||||
};
|
||||
if (!isNil ("GVAR(ATragMX_windDirection)")) then
|
||||
{
|
||||
ctrlSetText [310, Str(Round((GVAR(ATragMX_windDirection) select GVAR(ATragMX_currentTarget))))];
|
||||
};
|
||||
if (!isNil ("GVAR(ATragMX_inclinationAngle)")) then
|
||||
{
|
||||
ctrlSetText [320, Str(Round((GVAR(ATragMX_inclinationAngle) select GVAR(ATragMX_currentTarget))))];
|
||||
};
|
||||
if (!isNil ("GVAR(ATragMX_targetSpeed)")) then
|
||||
{
|
||||
ctrlSetText [330, Str(Round((GVAR(ATragMX_targetSpeed) select GVAR(ATragMX_currentTarget)) * 100) / 100)];
|
||||
};
|
||||
if (!isNil ("GVAR(ATragMX_targetRange)")) then
|
||||
{
|
||||
ctrlSetText [340, Str(Round((GVAR(ATragMX_targetRange) select GVAR(ATragMX_currentTarget))))];
|
||||
};
|
14
addons/atragmx/functions/fnc_update_target_selection.sqf
Normal file
14
addons/atragmx/functions/fnc_update_target_selection.sqf
Normal file
@ -0,0 +1,14 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define _dsp (uiNamespace getVariable "ATragMX_Display")
|
||||
|
||||
(_dsp displayCtrl 500) ctrlEnable true;
|
||||
(_dsp displayCtrl 501) ctrlEnable true;
|
||||
(_dsp displayCtrl 502) ctrlEnable true;
|
||||
(_dsp displayCtrl 503) ctrlEnable true;
|
||||
|
||||
(_dsp displayCtrl 500 + GVAR(ATragMX_currentTarget)) ctrlEnable false;
|
||||
|
||||
ctrlSetFocus (_dsp displayCtrl 3000);
|
||||
|
||||
call compile preprocessFile ("\atragmx\fnc_update_unit_selection.sqf");
|
14
addons/atragmx/functions/fnc_update_unit_selection.sqf
Normal file
14
addons/atragmx/functions/fnc_update_unit_selection.sqf
Normal file
@ -0,0 +1,14 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define _dsp (uiNamespace getVariable "ATragMX_Display")
|
||||
|
||||
(_dsp displayCtrl 600) ctrlEnable true;
|
||||
(_dsp displayCtrl 601) ctrlEnable true;
|
||||
(_dsp displayCtrl 602) ctrlEnable true;
|
||||
|
||||
(_dsp displayCtrl 600 + GVAR(ATragMX_currentUnit)) ctrlEnable false;
|
||||
|
||||
call compile preprocessFile ("\atragmx\fnc_update_gun.sqf");
|
||||
call compile preprocessFile ("\atragmx\fnc_update_atmosphere.sqf");
|
||||
call compile preprocessFile ("\atragmx\fnc_update_target.sqf");
|
||||
call compile preprocessFile ("\atragmx\fnc_update_result.sqf");
|
36
addons/atragmx/functions/fnc_update_zero_range.sqf
Normal file
36
addons/atragmx/functions/fnc_update_zero_range.sqf
Normal file
@ -0,0 +1,36 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_scopeBaseAngle"];
|
||||
_scopeBaseAngle = ((GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 3);
|
||||
|
||||
private ["_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel"];
|
||||
_bulletMass = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 12;
|
||||
_boreHeight = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 5;
|
||||
_airFriction = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 4;
|
||||
_muzzleVelocity = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 1;
|
||||
_bc = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 15;
|
||||
_dragModel = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 16;
|
||||
_atmosphereModel = (GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) select 17;
|
||||
|
||||
private ["_zeroRange"];
|
||||
_zeroRange = Round(parseNumber(ctrlText 140));
|
||||
if (GVAR(ATragMX_currentUnit) != 2) then
|
||||
{
|
||||
_zeroRange = _zeroRange / 1.0936133;
|
||||
};
|
||||
|
||||
private ["_temperature", "_barometricPressure", "_relativeHumidity"];
|
||||
_temperature = (GVAR(ATragMX_temperature) select GVAR(ATragMX_currentTarget));
|
||||
_barometricPressure = (GVAR(ATragMX_barometricPressure) select GVAR(ATragMX_currentTarget));
|
||||
_relativeHumidity = (GVAR(ATragMX_relativeHumidity) select GVAR(ATragMX_currentTarget));
|
||||
if (GVAR(ATragMX_currentUnit) == 1) then
|
||||
{
|
||||
_temperature = (_temperature - 32) / 1.8;
|
||||
_barometricPressure = _barometricPressure * 33.8638866667;
|
||||
};
|
||||
|
||||
private ["_result"];
|
||||
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, 0, 0, 0, 0, _zeroRange, _bc, _dragModel, _atmosphereModel, false] call FUNC(calculate_solution);
|
||||
|
||||
(GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) set [2, _zeroRange];
|
||||
(GVAR(ATragMX_workingMemory) select GVAR(ATragMX_currentTarget)) set [3, _scopeBaseAngle + (_result select 0) / 60];
|
1
addons/atragmx/functions/script_component.hpp
Normal file
1
addons/atragmx/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
||||
#include "\z\ace\addons\atragmx\script_component.hpp"
|
11
addons/atragmx/initKeybinds.sqf
Normal file
11
addons/atragmx/initKeybinds.sqf
Normal file
@ -0,0 +1,11 @@
|
||||
["ACE3", QGVAR(ATragMXDialogKey), localize "STR_ACE_ATragMX_ATragMXDialogKey",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
|
||||
// Statement
|
||||
[] call FUNC(create_dialog);
|
||||
false
|
||||
},
|
||||
{false},
|
||||
[197, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // (PRINT)
|
12
addons/atragmx/script_component.hpp
Normal file
12
addons/atragmx/script_component.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
#define COMPONENT atragmx
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
#ifdef DEBUG_ENABLED_ATRAGMX
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_SETTINGS_ATRAGMX
|
||||
#define DEBUG_SETTINGS DEBUG_SETTINGS_ATRAGMX
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
26
addons/atragmx/stringtable.xml
Normal file
26
addons/atragmx/stringtable.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Project name="ACE">
|
||||
<Package name="ATragMX">
|
||||
<Key ID="STR_ACE_ATragMX_Name">
|
||||
<English>ATragMX</English>
|
||||
<German>ATragMX</German>
|
||||
<Spanish>ATragMX</Spanish>
|
||||
<French>ATragMX</French>
|
||||
<Polish>ATragMX</Polish>
|
||||
<Czech>ATragMX</Czech>
|
||||
<Italian>ATragMX</Italian>
|
||||
<Hungarian>ATragMX</Hungarian>
|
||||
<Portuguese>ATragMX</Portuguese>
|
||||
<Russian>ATragMX</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_ATragMX_OpenATragMXDialog">
|
||||
<English>Open ATragMX</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_ATragMX_Description">
|
||||
<English>Rugged PDA with ATragMX</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_ATragMX_ATragMXDialogKey">
|
||||
<English>Open ATragMX</English>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user