mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'master' of https://github.com/KoffeinFlummi/ACE3 into AdvancedBallistics
This commit is contained in:
commit
9f0388fa12
@ -76,3 +76,4 @@ ruPaladin <happyworm24@rambler.ru>
|
||||
BlackPixxel
|
||||
Asgar Serran <piechottaf@web.de>
|
||||
Kavinsky <nmunozfernandez@gmail.com>
|
||||
BlackPixxel
|
||||
|
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)
|
1050
addons/atragmx/RscTitles.hpp
Normal file
1050
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.
25
addons/atragmx/XEH_postInit.sqf
Normal file
25
addons/atragmx/XEH_postInit.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
//#include "initKeybinds.sqf"
|
||||
|
||||
if (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, 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(gunList) = [["12.7x108mm" , 820, 100, 0.0659, -0.0008600, 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, 100, 0.0607, -0.0008600, 3.81, 0, 0.338, 0.338, 120, 0, 0, 41.92, "B_127x99_Ball" , "5Rnd_mas_127x99_Stanag" , 0.670, 1, "ASM" ],
|
||||
["12.7x54mm" , 290, 100, 0.3913, -0.0014000, 3.81, 0, 0.338, 0.338, 120, 0, 0, 61.56, "B_127x54_Ball" , "10Rnd_127x54_Mag" , 1.050, 1, "ASM" ],
|
||||
["10.4x77mm" , 910, 100, 0.0572, -0.0004800, 3.81, 0, 0.338, 0.338, 120, 0, 0, 27.15, "B_408_Ball" , "7Rnd_408_Mag" , 0.970, 1, "ASM" ],
|
||||
["9.3×64mm" , 870, 100, 0.0632, -0.0007500, 3.81, 0, 0.338, 0.338, 120, 0, 0, 16.20, "B_93x64_Ball" , "10Rnd_93x64_DMR_05_Mag" , 0.368, 1, "ASM" ],
|
||||
["8.6×70mm" , 915, 100, 0.0572, -0.0006100, 3.81, 0, 0.338, 0.338, 120, 0, 0, 16.20, "B_338_Ball" , "10Rnd_338_Mag" , 0.322, 7, "ICAO"],
|
||||
["7.62x51mm" , 850, 100, 0.0639, -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, 100, 0.0689, -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, 100, 0.0584, -0.0012650, 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, 100, 0.0643, -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 ["ACE_ATragMX_gunList", GVAR(gunList)];
|
||||
};
|
||||
|
||||
[] call FUNC(init);
|
||||
|
||||
["RangerfinderData", {_this call FUNC(sord)}] call EFUNC(common,addEventHandler);
|
48
addons/atragmx/XEH_preInit.sqf
Normal file
48
addons/atragmx/XEH_preInit.sqf
Normal file
@ -0,0 +1,48 @@
|
||||
#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(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 = "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)];
|
||||
};
|
62
addons/atragmx/functions/fnc_calculate_range_card.sqf
Normal file
62
addons/atragmx/functions/fnc_calculate_range_card.sqf
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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 GVAR(currentTarget)) select 3);
|
||||
|
||||
private ["_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel"];
|
||||
_bulletMass = (GVAR(workingMemory) select GVAR(currentTarget)) select 12;
|
||||
_boreHeight = (GVAR(workingMemory) select GVAR(currentTarget)) select 5;
|
||||
_airFriction = (GVAR(workingMemory) select GVAR(currentTarget)) select 4;
|
||||
_muzzleVelocity = (GVAR(workingMemory) select GVAR(currentTarget)) select 1;
|
||||
_bc = (GVAR(workingMemory) select GVAR(currentTarget)) select 15;
|
||||
_dragModel = (GVAR(workingMemory) select GVAR(currentTarget)) select 16;
|
||||
_atmosphereModel = (GVAR(workingMemory) select GVAR(currentTarget)) select 17;
|
||||
|
||||
private ["_temperature", "_barometricPressure", "_relativeHumidity"];
|
||||
_temperature = (GVAR(temperature) select GVAR(currentTarget));
|
||||
_barometricPressure = (GVAR(barometricPressure) select GVAR(currentTarget));
|
||||
_relativeHumidity = (GVAR(relativeHumidity) select GVAR(currentTarget));
|
||||
if (GVAR(currentUnit) == 1) then
|
||||
{
|
||||
_temperature = (_temperature - 32) / 1.8;
|
||||
_barometricPressure = _barometricPressure * 33.8638866667;
|
||||
};
|
||||
|
||||
private ["_windSpeed", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange"];
|
||||
_windSpeed = (GVAR(windSpeed) 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) != 2) then
|
||||
{
|
||||
_targetRange = _targetRange / 1.0936133;
|
||||
};
|
||||
if (GVAR(currentUnit) == 1) then
|
||||
{
|
||||
_windSpeed = _windSpeed / 2.23693629;
|
||||
_targetSpeed = _targetSpeed / 2.23693629;
|
||||
};
|
||||
|
||||
GVAR(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);
|
39
addons/atragmx/functions/fnc_calculate_scope_base_angle.sqf
Normal file
39
addons/atragmx/functions/fnc_calculate_scope_base_angle.sqf
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
_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
|
157
addons/atragmx/functions/fnc_calculate_solution.sqf
Normal file
157
addons/atragmx/functions/fnc_calculate_solution.sqf
Normal file
@ -0,0 +1,157 @@
|
||||
/*
|
||||
* 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 <NUMBER>
|
||||
* 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>
|
||||
*
|
||||
* Return Value:
|
||||
* 0: Elevation <NUMBER>
|
||||
* 1: Windage <NUMBER>
|
||||
* 2: Lead <NUMBER>
|
||||
* 3: Time of fligth <NUMBER>
|
||||
* 4: Remaining velocity <NUMBER>
|
||||
* 4: Remaining kinetic energy <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", "_windSpeed", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange", "_bc", "_dragModel", "_atmosphereModel", "_storeRangeCardData"];
|
||||
_scopeBaseAngle = _this select 0;
|
||||
_bulletMass = _this select 1;
|
||||
_boreHeight = _this select 2;
|
||||
_airFriction = _this select 3;
|
||||
_muzzleVelocity = _this select 4;
|
||||
_temperature = _this select 5;
|
||||
_barometricPressure = _this select 6;
|
||||
_relativeHumidity = _this select 7;
|
||||
_simSteps = _this select 8;
|
||||
_windSpeed = _this select 9;
|
||||
_windDirection = _this select 10;
|
||||
_inclinationAngle = _this select 11;
|
||||
_targetSpeed = _this select 12;
|
||||
_targetRange = _this select 13;
|
||||
_bc = _this select 14;
|
||||
_dragModel = _this select 15;
|
||||
_atmosphereModel = _this select 16;
|
||||
_storeRangeCardData = _this select 17;
|
||||
|
||||
private ["_bulletPos", "_bulletVelocity", "_bulletAccel", "_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", "_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(currentUnit) != 2) then {
|
||||
_rangeFactor = 1.0936133;
|
||||
};
|
||||
GVAR(rangeCardData) = [];
|
||||
};
|
||||
|
||||
private ["_wind"];
|
||||
_wind = [cos(270 - _windDirection * 30) * _windSpeed, sin(270 - _windDirection * 30) * _windSpeed, 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);
|
||||
};
|
||||
|
||||
_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 (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
|
||||
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false]) then {
|
||||
private ["_drag"];
|
||||
_drag = -1 * ([_dragModel, _bc, _trueSpeed] call EFUNC(advanced_ballistics,calculateRetardation));
|
||||
_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(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));
|
||||
_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(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]
|
@ -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) != 2) 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))];
|
||||
};
|
||||
};
|
67
addons/atragmx/functions/fnc_calculate_target_solution.sqf
Normal file
67
addons/atragmx/functions/fnc_calculate_target_solution.sqf
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* 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 GVAR(currentTarget)) select 3);
|
||||
|
||||
private ["_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel"];
|
||||
_bulletMass = (GVAR(workingMemory) select GVAR(currentTarget)) select 12;
|
||||
_boreHeight = (GVAR(workingMemory) select GVAR(currentTarget)) select 5;
|
||||
_airFriction = (GVAR(workingMemory) select GVAR(currentTarget)) select 4;
|
||||
_muzzleVelocity = (GVAR(workingMemory) select GVAR(currentTarget)) select 1;
|
||||
_bc = (GVAR(workingMemory) select GVAR(currentTarget)) select 15;
|
||||
_dragModel = (GVAR(workingMemory) select GVAR(currentTarget)) select 16;
|
||||
_atmosphereModel = (GVAR(workingMemory) select GVAR(currentTarget)) select 17;
|
||||
|
||||
private ["_temperature", "_barometricPressure", "_relativeHumidity"];
|
||||
_temperature = (GVAR(temperature) select GVAR(currentTarget));
|
||||
_barometricPressure = (GVAR(barometricPressure) select GVAR(currentTarget));
|
||||
_relativeHumidity = (GVAR(relativeHumidity) select GVAR(currentTarget));
|
||||
if (GVAR(currentUnit) == 1) then
|
||||
{
|
||||
_temperature = (_temperature - 32) / 1.8;
|
||||
_barometricPressure = _barometricPressure * 33.8638866667;
|
||||
};
|
||||
|
||||
private ["_windSpeed", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange"];
|
||||
_windSpeed = (GVAR(windSpeed) 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));
|
||||
if (GVAR(currentUnit) != 2) then
|
||||
{
|
||||
_targetRange = _targetRange / 1.0936133;
|
||||
};
|
||||
if (GVAR(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(elevationOutput) set [GVAR(currentTarget), _result select 0];
|
||||
GVAR(windageOutput) set [GVAR(currentTarget), _result 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,56 @@
|
||||
/*
|
||||
* 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) != 2) 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) == 1) 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);
|
38
addons/atragmx/functions/fnc_change_gun.sqf
Normal file
38
addons/atragmx/functions/fnc_change_gun.sqf
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Selects a new gun profile and updates the gun column and the result input/output fields
|
||||
*
|
||||
* Arguments:
|
||||
* gunID <number>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_change_gun
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (_this < 0 || _this > (count GVAR(gunList)) - 1) exitWith {};
|
||||
|
||||
GVAR(workingMemory) set [GVAR(currentTarget), +(GVAR(gunList) select _this)];
|
||||
GVAR(currentGun) set [GVAR(currentTarget), _this];
|
||||
|
||||
lbSetCurSel [6000, (GVAR(currentGun) select GVAR(currentTarget))];
|
||||
|
||||
if ((GVAR(scopeUnits) select (GVAR(currentScopeUnit) select GVAR(currentTarget))) != "Clicks") then
|
||||
{
|
||||
GVAR(currentScopeUnit) set [GVAR(currentTarget), (GVAR(workingMemory) select GVAR(currentTarget)) select 6];
|
||||
};
|
||||
|
||||
[] call FUNC(update_gun);
|
||||
|
||||
GVAR(elevationOutput) set [GVAR(currentTarget), 0];
|
||||
GVAR(windageOutput) set [GVAR(currentTarget), 0];
|
||||
GVAR(leadOutput) set [GVAR(currentTarget), 0];
|
||||
GVAR(tofOutput) set [GVAR(currentTarget), 0];
|
||||
GVAR(velocityOutput) set [GVAR(currentTarget), 0];
|
||||
|
||||
[] call FUNC(update_result);
|
40
addons/atragmx/functions/fnc_create_dialog.sqf
Normal file
40
addons/atragmx/functions/fnc_create_dialog.sqf
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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);
|
||||
|
||||
true call FUNC(show_main_page);
|
||||
|
||||
false call FUNC(show_add_new_gun);
|
||||
false call FUNC(show_gun_list);
|
||||
false call FUNC(show_range_card);
|
||||
false call FUNC(show_range_card_setup);
|
||||
false call FUNC(show_target_range_assist);
|
||||
false call FUNC(show_target_speed_assist);
|
||||
false call FUNC(show_target_speed_assist_timer);
|
||||
|
||||
{
|
||||
lbAdd [6000, _x select 0];
|
||||
} forEach GVAR(gunList);
|
||||
|
||||
true
|
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) set [GVAR(currentTarget), ((GVAR(currentScopeUnit) select GVAR(currentTarget)) + 1) % (count GVAR(scopeUnits))];
|
||||
|
||||
[] call FUNC(update_scope_unit);
|
||||
[] call FUNC(update_result);
|
34
addons/atragmx/functions/fnc_delete_gun.sqf
Normal file
34
addons/atragmx/functions/fnc_delete_gun.sqf
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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 {};
|
||||
|
||||
for "_i" from 0 to (count GVAR(currentGun)) - 1 do {
|
||||
if ((GVAR(currentGun) select _i) > _index) then {
|
||||
GVAR(currentGun) set [_i, (GVAR(currentGun) select _i) - 1];
|
||||
};
|
||||
};
|
||||
|
||||
GVAR(gunList) set [_index, 0];
|
||||
GVAR(gunList) = GVAR(gunList) - [0];
|
||||
|
||||
lbDelete [6000, _index];
|
||||
|
||||
profileNamespace setVariable ["ACE_ATragMX_gunList", GVAR(gunList)];
|
58
addons/atragmx/functions/fnc_init.sqf
Normal file
58
addons/atragmx/functions/fnc_init.sqf
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Inits all global variables with the default values
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_init
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(workingMemory) = [+(GVAR(gunList) select 0), +(GVAR(gunList) select 0), +(GVAR(gunList) select 0), +(GVAR(gunList) select 0)];
|
||||
|
||||
GVAR(scopeUnits) = ["MILs", "TMOA", "SMOA", "Clicks"];
|
||||
|
||||
GVAR(rangeCardStartRange) = 200;
|
||||
GVAR(rangeCardEndRange) = 2000;
|
||||
GVAR(rangeCardIncrement) = 50;
|
||||
GVAR(rangeCardLastColumns) = ["Lead", "RemV", "RemE", "TmFlt"];
|
||||
GVAR(rangeCardCurrentColumn) = 3;
|
||||
GVAR(rangeCardData) = [];
|
||||
|
||||
GVAR(GVAR(rangeAssistTargetSizeUnit)s) = ["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, 0, 0, 0];
|
||||
GVAR(currentTarget) = 0;
|
||||
GVAR(currentScopeUnit) = [0, 0, 0, 0];
|
||||
|
||||
GVAR(temperature) = [15, 15, 15, 15];
|
||||
GVAR(barometricPressure) = [1013.25, 1013.25, 1013.25, 1013.25];
|
||||
GVAR(relativeHumidity) = [0.5, 0.5, 0.5, 0.5];
|
||||
|
||||
GVAR(windSpeed) = [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(elevationOutput) = [0, 0, 0, 0];
|
||||
GVAR(windageOutput) = [0, 0, 0, 0];
|
||||
GVAR(leadOutput) = [0, 0, 0, 0];
|
||||
GVAR(tofOutput) = [0, 0, 0, 0];
|
||||
GVAR(velocityOutput) = [0, 0, 0, 0];
|
89
addons/atragmx/functions/fnc_parse_input.sqf
Normal file
89
addons/atragmx/functions/fnc_parse_input.sqf
Normal file
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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(temperature) set [GVAR(currentTarget), parseNumber(ctrlText 200)];
|
||||
GVAR(barometricPressure) set [GVAR(currentTarget), 0 max parseNumber(ctrlText 210)];
|
||||
GVAR(relativeHumidity) set [GVAR(currentTarget), (0 max parseNumber(ctrlText 220) min 100) / 100];
|
||||
|
||||
GVAR(windSpeed) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 300)) min 50];
|
||||
GVAR(windDirection) set [GVAR(currentTarget), 1 max Round(parseNumber(ctrlText 310)) min 12];
|
||||
GVAR(inclinationAngle) set [GVAR(currentTarget), -60 max parseNumber(ctrlText 320) min 60];
|
||||
GVAR(targetSpeed) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 330)) min 50];
|
||||
GVAR(targetRange) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 340)) min 4000];
|
||||
|
||||
private ["_boreHeight", "_bulletMass", "_airFriction", "_muzzleVelocity"];
|
||||
_boreHeight = parseNumber(ctrlText 100);
|
||||
_bulletMass = parseNumber(ctrlText 110);
|
||||
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then {
|
||||
_airFriction = 0.1 max parseNumber(ctrlText 120) min 2;
|
||||
} else {
|
||||
_airFriction = parseNumber(ctrlText 120) / -1000;
|
||||
};
|
||||
_muzzleVelocity = parseNumber(ctrlText 130);
|
||||
if (GVAR(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(workingMemory) select GVAR(currentTarget)) set [5, _boreHeight];
|
||||
(GVAR(workingMemory) select GVAR(currentTarget)) set [12, _bulletMass];
|
||||
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then {
|
||||
(GVAR(workingMemory) select GVAR(currentTarget)) set [15, _airFriction];
|
||||
} else {
|
||||
(GVAR(workingMemory) select GVAR(currentTarget)) set [4, _airFriction];
|
||||
};
|
||||
(GVAR(workingMemory) select GVAR(currentTarget)) set [1, _muzzleVelocity];
|
||||
|
||||
private ["_elevationCur", "_elevationCur", "_elevationScopeStep", "_windageScopeStep"];
|
||||
_elevationCur = parseNumber(ctrlText 402);
|
||||
_windageCur = parseNumber(ctrlText 412);
|
||||
|
||||
switch ((GVAR(currentScopeUnit) select GVAR(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(workingMemory) select GVAR(currentTarget)) select 7);
|
||||
_windageScopeStep = ((GVAR(workingMemory) select GVAR(currentTarget)) select 8);
|
||||
|
||||
_elevationCur = _elevationCur * _elevationScopeStep;
|
||||
_windageCur = _windageCur * _windageScopeStep;
|
||||
};
|
||||
};
|
||||
|
||||
(GVAR(workingMemory) select GVAR(currentTarget)) set [10, _elevationCur];
|
||||
(GVAR(workingMemory) select GVAR(currentTarget)) set [11, _windageCur];
|
||||
|
||||
[] call FUNC(update_gun);
|
||||
[] call FUNC(update_atmosphere);
|
||||
[] call FUNC(update_target);
|
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) select GVAR(currentTarget)) set [10, 0];
|
||||
(GVAR(workingMemory) select GVAR(currentTarget)) set [11, 0];
|
||||
|
||||
[] call FUNC(update_result);
|
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) select GVAR(currentTarget))];
|
||||
|
||||
lbClear 6000;
|
||||
{
|
||||
lbAdd [6000, _x select 0];
|
||||
} forEach GVAR(gunList);
|
||||
|
||||
profileNamespace setVariable ["ACE_ATragMX_gunList", GVAR(gunList)];
|
18
addons/atragmx/functions/fnc_show_add_new_gun.sqf
Normal file
18
addons/atragmx/functions/fnc_show_add_new_gun.sqf
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [11000, 11001, 11002, 11003];
|
18
addons/atragmx/functions/fnc_show_gun_list.sqf
Normal file
18
addons/atragmx/functions/fnc_show_gun_list.sqf
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [6000, 6001, 6002, 6003, 6004, 6005, 6006, 6007];
|
19
addons/atragmx/functions/fnc_show_main_page.sqf
Normal file
19
addons/atragmx/functions/fnc_show_main_page.sqf
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
{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];
|
18
addons/atragmx/functions/fnc_show_range_card.sqf
Normal file
18
addons/atragmx/functions/fnc_show_range_card.sqf
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [5000, 5001, 5002, 5003, 5004, 5005, 5006, 5007];
|
18
addons/atragmx/functions/fnc_show_range_card_setup.sqf
Normal file
18
addons/atragmx/functions/fnc_show_range_card_setup.sqf
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [10000, 10001, 10002, 10003, 10004, 10005, 10006, 10007, 10008, 10009];
|
18
addons/atragmx/functions/fnc_show_target_range_assist.sqf
Normal file
18
addons/atragmx/functions/fnc_show_target_range_assist.sqf
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
{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];
|
18
addons/atragmx/functions/fnc_show_target_speed_assist.sqf
Normal file
18
addons/atragmx/functions/fnc_show_target_speed_assist.sqf
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
{ctrlShow [_x, _this]} forEach [8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009, 8010, 8011, 8012, 8013, 8014, 8015];
|
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
{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;
|
||||
|
||||
//_inclination = asin((ACE_player weaponDirection currentWeapon ACE_player) select 2);
|
||||
GVAR(inclinationAngle) set [GVAR(currentTarget), _inclination];
|
||||
GVAR(targetRange) set [GVAR(currentTarget), _slopeDistance];
|
48
addons/atragmx/functions/fnc_target_speed_assist_timer.sqf
Normal file
48
addons/atragmx/functions/fnc_target_speed_assist_timer.sqf
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
#define _dsp (uiNamespace getVariable "ATragMX_Display")
|
||||
|
||||
if !(ctrlVisible 9000) then {
|
||||
|
||||
false call FUNC(show_target_speed_assist);
|
||||
true call FUNC(show_target_speed_assist_timer);
|
||||
|
||||
ctrlSetFocus (_dsp 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;
|
||||
};
|
36
addons/atragmx/functions/fnc_toggle_gun_list.sqf
Normal file
36
addons/atragmx/functions/fnc_toggle_gun_list.sqf
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Toggles the gun list screen on/off
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_toggle_gun_list
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define _dsp (uiNamespace getVariable "ATragMX_Display")
|
||||
|
||||
if (ctrlVisible 6000) then
|
||||
{
|
||||
false call FUNC(show_gun_list);
|
||||
true call FUNC(show_main_page);
|
||||
|
||||
if (_this) then {
|
||||
(lbCurSel 6000) call FUNC(change_gun);
|
||||
};
|
||||
} else
|
||||
{
|
||||
false call FUNC(show_main_page);
|
||||
true call FUNC(show_gun_list);
|
||||
|
||||
ctrlSetFocus (_dsp displayCtrl 6002);
|
||||
|
||||
lbSetCurSel [6000, (GVAR(currentGun) select GVAR(currentTarget))];
|
||||
};
|
33
addons/atragmx/functions/fnc_toggle_range_card.sqf
Normal file
33
addons/atragmx/functions/fnc_toggle_range_card.sqf
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
#define _dsp (uiNamespace getVariable "ATragMX_Display")
|
||||
|
||||
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 (_dsp displayCtrl 5001);
|
||||
|
||||
[] call FUNC(calculate_range_card);
|
||||
[] call FUNC(update_range_card);
|
||||
};
|
44
addons/atragmx/functions/fnc_toggle_range_card_setup.sqf
Normal file
44
addons/atragmx/functions/fnc_toggle_range_card_setup.sqf
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Toggles the range card setup screen on/off
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_toggle_range_card_setup
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define _dsp (uiNamespace getVariable "ATragMX_Display")
|
||||
|
||||
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);
|
||||
|
||||
ctrlSetFocus (_dsp displayCtrl 10006);
|
||||
|
||||
ctrlSetText [10003, Str(Round(GVAR(rangeCardStartRange)))];
|
||||
ctrlSetText [10004, Str(Round(GVAR(rangeCardEndRange)))];
|
||||
ctrlSetText [10005, Str(Round(GVAR(rangeCardIncrement)))];
|
||||
};
|
47
addons/atragmx/functions/fnc_toggle_target_range_assist.sqf
Normal file
47
addons/atragmx/functions/fnc_toggle_target_range_assist.sqf
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Toggles the target range assist screen on/off
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_toggle_target_range_assist
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define _dsp (uiNamespace getVariable "ATragMX_Display")
|
||||
|
||||
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 [340, Str(parseNumber(ctrlText 7013))];
|
||||
};
|
||||
} else
|
||||
{
|
||||
false call FUNC(show_main_page);
|
||||
true call FUNC(show_target_range_assist);
|
||||
|
||||
ctrlSetFocus (_dsp displayCtrl 7018);
|
||||
|
||||
ctrlSetText [7012, Str(parseNumber(ctrlText 320))];
|
||||
ctrlSetText [7013, Str(parseNumber(ctrlText 340))];
|
||||
|
||||
if (GVAR(currentUnit) != 2) then
|
||||
{
|
||||
ctrlSetText [7016, "Yards"];
|
||||
} else
|
||||
{
|
||||
ctrlSetText [7016, "Meters"];
|
||||
};
|
||||
};
|
54
addons/atragmx/functions/fnc_toggle_target_speed_assist.sqf
Normal file
54
addons/atragmx/functions/fnc_toggle_target_speed_assist.sqf
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Toggles the target speed assist screen on/off
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_toggle_target_speed_assist
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define _dsp (uiNamespace getVariable "ATragMX_Display")
|
||||
|
||||
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);
|
||||
ctrlSetText [330, Str(parseNumber(ctrlText 8007))];
|
||||
};
|
||||
} else
|
||||
{
|
||||
false call FUNC(show_main_page);
|
||||
true call FUNC(show_target_speed_assist);
|
||||
|
||||
ctrlSetFocus (_dsp displayCtrl 8012);
|
||||
|
||||
ctrlSetText [8004, Str(Round((GVAR(targetRange) select GVAR(currentTarget))))];
|
||||
|
||||
if (GVAR(currentUnit) != 2) then
|
||||
{
|
||||
ctrlSetText [8008, "Yards"];
|
||||
} else
|
||||
{
|
||||
ctrlSetText [8008, "Meters"];
|
||||
};
|
||||
|
||||
if (GVAR(currentUnit) != 1) then
|
||||
{
|
||||
ctrlSetText [8011, "m/s"];
|
||||
} else
|
||||
{
|
||||
ctrlSetText [8011, "mph"];
|
||||
};
|
||||
};
|
24
addons/atragmx/functions/fnc_update_atmosphere.sqf
Normal file
24
addons/atragmx/functions/fnc_update_atmosphere.sqf
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Updates all atmosphere column input fields
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_update_atmosphere
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
ctrlSetText [200, Str(Round((GVAR(temperature) select GVAR(currentTarget)) * 10) / 10)];
|
||||
if (GVAR(currentUnit) == 1) then {
|
||||
ctrlSetText [210, Str(Round((GVAR(barometricPressure) select GVAR(currentTarget)) * 100) / 100)];
|
||||
} else {
|
||||
ctrlSetText [210, Str(Round(GVAR(barometricPressure) select GVAR(currentTarget)))];
|
||||
};
|
||||
ctrlSetText [220, Str(Round((GVAR(relativeHumidity) select GVAR(currentTarget)) * 100 * 10) / 10)];
|
53
addons/atragmx/functions/fnc_update_gun.sqf
Normal file
53
addons/atragmx/functions/fnc_update_gun.sqf
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Updates all gun column input fields
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_update_gun
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
ctrlSetText [1000, (GVAR(workingMemory) select GVAR(currentTarget)) select 0];
|
||||
if (GVAR(currentUnit) == 1) then
|
||||
{
|
||||
ctrlSetText [ 100, Str(Round(((GVAR(workingMemory) select GVAR(currentTarget)) select 5) / 2.54 * 100) / 100)];
|
||||
} else
|
||||
{
|
||||
ctrlSetText [ 100, Str(Round(((GVAR(workingMemory) select GVAR(currentTarget)) select 5) * 100) / 100)];
|
||||
};
|
||||
if (GVAR(currentUnit) == 1) then
|
||||
{
|
||||
ctrlSetText [ 110, Str(Round(((GVAR(workingMemory) select GVAR(currentTarget)) select 12) * 15.4323584))];
|
||||
} else
|
||||
{
|
||||
ctrlSetText [ 110, Str(Round((GVAR(workingMemory) select GVAR(currentTarget)) select 12))];
|
||||
};
|
||||
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then {
|
||||
ctrlSetText [ 120, Str(Round(((GVAR(workingMemory) select GVAR(currentTarget)) select 15) * 1000) / 1000)];
|
||||
} else {
|
||||
ctrlSetText [ 120, Str(Round(((GVAR(workingMemory) select GVAR(currentTarget)) select 4) * -1000 * 1000) / 1000)];
|
||||
};
|
||||
if (GVAR(currentUnit) == 1) then
|
||||
{
|
||||
ctrlSetText [130, Str(Round(((GVAR(workingMemory) select GVAR(currentTarget)) select 1) * 3.2808399))];
|
||||
} else
|
||||
{
|
||||
ctrlSetText [130, Str(Round((GVAR(workingMemory) select GVAR(currentTarget)) select 1))];
|
||||
};
|
||||
if (GVAR(currentUnit) == 2) then
|
||||
{
|
||||
ctrlSetText [140, Str(Round((GVAR(workingMemory) select GVAR(currentTarget)) select 2))];
|
||||
} else
|
||||
{
|
||||
ctrlSetText [140, Str(Round(((GVAR(workingMemory) select GVAR(currentTarget)) select 2) * 1.0936133))];
|
||||
};
|
||||
|
||||
[] call FUNC(update_scope_unit);
|
104
addons/atragmx/functions/fnc_update_range_card.sqf
Normal file
104
addons/atragmx/functions/fnc_update_range_card.sqf
Normal file
@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Updates the range card listbox content
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_update_range_card
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_range", "_elevation", "_windage", "_lead", "_TOF", "_velocity", "_kineticEnergy", "_rangeOutput", "_elevationOutput", "_windageOutput", "_lastColumnOutput"];
|
||||
_lastColumnOutput = "";
|
||||
|
||||
ctrlSetText [5006, (GVAR(rangeCardLastColumns) select GVAR(rangeCardCurrentColumn))];
|
||||
|
||||
if (GVAR(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(currentScopeUnit) select GVAR(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(workingMemory) select GVAR(currentTarget)) select 7);
|
||||
_windageScopeStep = ((GVAR(workingMemory) select GVAR(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(currentUnit) == 1) then
|
||||
{
|
||||
_velocity = _velocity * 3.2808399;
|
||||
};
|
||||
|
||||
switch (GVAR(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(rangeCardData);
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Updates the relative click memory
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_update_relative_click_memory
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
(GVAR(workingMemory) select GVAR(currentTarget)) set [10, (GVAR(elevationOutput) select GVAR(currentTarget))];
|
||||
(GVAR(workingMemory) select GVAR(currentTarget)) set [11, (GVAR(windageOutput) select GVAR(currentTarget))];
|
||||
|
||||
[] call FUNC(update_result);
|
80
addons/atragmx/functions/fnc_update_result.sqf
Normal file
80
addons/atragmx/functions/fnc_update_result.sqf
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Updates the result input and output fields
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_update_result
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_elevationAbs", "_elevationRel", "_elevationCur", "_windageAbs", "_windageRel", "_windageCur", "_lead", "_elevationScopeStep", "_windageScopeStep"];
|
||||
_elevationAbs = (GVAR(elevationOutput) select GVAR(currentTarget));
|
||||
_windageAbs = (GVAR(windageOutput) select GVAR(currentTarget));
|
||||
|
||||
_elevationCur = (GVAR(workingMemory) select GVAR(currentTarget)) select 10;
|
||||
_windageCur = (GVAR(workingMemory) select GVAR(currentTarget)) select 11;
|
||||
|
||||
_elevationRel = _elevationAbs - _elevationCur;
|
||||
_windageRel = _windageAbs - _windageCur;
|
||||
|
||||
_lead = (GVAR(leadOutput) select GVAR(currentTarget));
|
||||
|
||||
switch ((GVAR(currentScopeUnit) select GVAR(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(workingMemory) select GVAR(currentTarget)) select 7);
|
||||
_windageScopeStep = ((GVAR(workingMemory) select GVAR(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)];
|
19
addons/atragmx/functions/fnc_update_scope_unit.sqf
Normal file
19
addons/atragmx/functions/fnc_update_scope_unit.sqf
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Updates the scope unit fields
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_update_scope_unit
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
ctrlSetText [2000, GVAR(scopeUnits) select (GVAR(currentScopeUnit) select GVAR(currentTarget))];
|
||||
ctrlSetText [5000, GVAR(scopeUnits) select (GVAR(currentScopeUnit) select GVAR(currentTarget))];
|
37
addons/atragmx/functions/fnc_update_target.sqf
Normal file
37
addons/atragmx/functions/fnc_update_target.sqf
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Updates all target column input fields
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_update_target
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!isNil QGVAR(windSpeed)) then
|
||||
{
|
||||
ctrlSetText [300, Str(Round((GVAR(windSpeed) select GVAR(currentTarget)) * 100) / 100)];
|
||||
};
|
||||
if (!isNil QGVAR(windDirection)) then
|
||||
{
|
||||
ctrlSetText [310, Str(Round((GVAR(windDirection) select GVAR(currentTarget))))];
|
||||
};
|
||||
if (!isNil QGVAR(inclinationAngle)) then
|
||||
{
|
||||
ctrlSetText [320, Str(Round((GVAR(inclinationAngle) select GVAR(currentTarget))))];
|
||||
};
|
||||
if (!isNil QGVAR(targetSpeed)) then
|
||||
{
|
||||
ctrlSetText [330, Str(Round((GVAR(targetSpeed) select GVAR(currentTarget)) * 100) / 100)];
|
||||
};
|
||||
if (!isNil QGVAR(targetRange)) then
|
||||
{
|
||||
ctrlSetText [340, Str(Round((GVAR(targetRange) select GVAR(currentTarget))))];
|
||||
};
|
29
addons/atragmx/functions/fnc_update_target_selection.sqf
Normal file
29
addons/atragmx/functions/fnc_update_target_selection.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Updates all input fields based on the currently selected target
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_update_target_selection
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#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(currentTarget)) ctrlEnable false;
|
||||
|
||||
ctrlSetFocus (_dsp displayCtrl 3000);
|
||||
|
||||
[] call FUNC(update_unit_selection);
|
29
addons/atragmx/functions/fnc_update_unit_selection.sqf
Normal file
29
addons/atragmx/functions/fnc_update_unit_selection.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Updates all input fields based on the currently selected unit
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_update_unit_selection
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#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(currentUnit)) ctrlEnable false;
|
||||
|
||||
[] call FUNC(update_gun);
|
||||
[] call FUNC(update_atmosphere);
|
||||
[] call FUNC(update_target);
|
||||
[] call FUNC(update_result);
|
55
addons/atragmx/functions/fnc_update_zero_range.sqf
Normal file
55
addons/atragmx/functions/fnc_update_zero_range.sqf
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Author: Ruthberg
|
||||
* Updates the scope base angle based on the zero range input
|
||||
*
|
||||
* Arguments:
|
||||
* Nothing
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* call ace_atragmx_fnc_update_zero_range
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_scopeBaseAngle"];
|
||||
_scopeBaseAngle = ((GVAR(workingMemory) select GVAR(currentTarget)) select 3);
|
||||
|
||||
private ["_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel"];
|
||||
_bulletMass = (GVAR(workingMemory) select GVAR(currentTarget)) select 12;
|
||||
_boreHeight = (GVAR(workingMemory) select GVAR(currentTarget)) select 5;
|
||||
_airFriction = (GVAR(workingMemory) select GVAR(currentTarget)) select 4;
|
||||
_muzzleVelocity = (GVAR(workingMemory) select GVAR(currentTarget)) select 1;
|
||||
_bc = (GVAR(workingMemory) select GVAR(currentTarget)) select 15;
|
||||
_dragModel = (GVAR(workingMemory) select GVAR(currentTarget)) select 16;
|
||||
_atmosphereModel = (GVAR(workingMemory) select GVAR(currentTarget)) select 17;
|
||||
|
||||
private ["_zeroRange"];
|
||||
_zeroRange = Round(parseNumber(ctrlText 140));
|
||||
if (GVAR(currentUnit) != 2) then
|
||||
{
|
||||
_zeroRange = _zeroRange / 1.0936133;
|
||||
};
|
||||
if (_zeroRange < 10) exitWith {
|
||||
(GVAR(workingMemory) select GVAR(currentTarget)) set [2, _zeroRange];
|
||||
(GVAR(workingMemory) select GVAR(currentTarget)) set [3, 0];
|
||||
};
|
||||
|
||||
private ["_temperature", "_barometricPressure", "_relativeHumidity"];
|
||||
_temperature = (GVAR(temperature) select GVAR(currentTarget));
|
||||
_barometricPressure = (GVAR(barometricPressure) select GVAR(currentTarget));
|
||||
_relativeHumidity = (GVAR(relativeHumidity) select GVAR(currentTarget));
|
||||
if (GVAR(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(workingMemory) select GVAR(currentTarget)) set [2, _zeroRange];
|
||||
(GVAR(workingMemory) select GVAR(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>
|
@ -70,9 +70,9 @@ class RscInGameUI {
|
||||
colorText[] = {1,1,1,0};
|
||||
colorBackground[] = {0,0,0,0};
|
||||
x = safezoneX+0.5*safezoneW-0.5*SIZEX;
|
||||
y = safezoneY+0.5*safezoneH-0.5*SIZEX*safezoneW/safezoneH;
|
||||
y = safezoneY+0.5*safezoneH-0.5*SIZEX*safezoneW/safezoneH*(16/9)/(getResolution select 4);
|
||||
w = SIZEX;
|
||||
h = SIZEX*safezoneW/safezoneH;
|
||||
h = SIZEX*safezoneW/safezoneH*(16/9)/(getResolution select 4);
|
||||
};
|
||||
|
||||
class ReticleNight: ReticleDay {
|
||||
@ -86,9 +86,9 @@ class RscInGameUI {
|
||||
idc = 1713005;
|
||||
text = "";
|
||||
x = safezoneX+0.5*safezoneW-0.5*SIZEX;
|
||||
y = safezoneY+0.5*safezoneH-0.5*SIZEX*safezoneW/safezoneH;
|
||||
y = safezoneY+0.5*safezoneH-0.5*SIZEX*safezoneW/safezoneH*(16/9)/(getResolution select 4);
|
||||
w = SIZEX;
|
||||
h = SIZEX*safezoneW/safezoneH;
|
||||
h = SIZEX*safezoneW/safezoneH*(16/9)/(getResolution select 4);
|
||||
};
|
||||
|
||||
class BodyNight: BodyDay {
|
||||
|
@ -215,6 +215,11 @@ class CfgWeapons {
|
||||
};
|
||||
|
||||
class ACE_optic_SOS_2D: optic_SOS {
|
||||
GVAR(BodyDay) = QUOTE(PATHTOF(reticles\sos-body_ca.paa));
|
||||
GVAR(BodyNight) = QUOTE(PATHTOF(reticles\sos-bodyNight_ca.paa));
|
||||
GVAR(ReticleDay) = QUOTE(PATHTOF(reticles\sos-reticleMLR_ca.paa));
|
||||
GVAR(ReticleNight) = QUOTE(PATHTOF(reticles\sos-reticleMLRIllum_ca.paa));
|
||||
|
||||
author = "$STR_ACE_Common_ACETeam";
|
||||
_generalMacro = "ACE_optic_SOS_2D";
|
||||
displayName = "$STR_ACE_optic_sos";
|
||||
@ -232,11 +237,6 @@ class CfgWeapons {
|
||||
};
|
||||
|
||||
class ACE_optic_SOS_PIP: ACE_optic_SOS_2D {
|
||||
GVAR(BodyDay) = QUOTE(PATHTOF(reticles\sos-body_ca.paa));
|
||||
GVAR(BodyNight) = QUOTE(PATHTOF(reticles\sos-bodyNight_ca.paa));
|
||||
GVAR(ReticleDay) = QUOTE(PATHTOF(reticles\sos-reticleMLR_ca.paa));
|
||||
GVAR(ReticleNight) = QUOTE(PATHTOF(reticles\sos-reticleMLRIllum_ca.paa));
|
||||
|
||||
author = "$STR_ACE_Common_ACETeam";
|
||||
_generalMacro = "ACE_optic_SOS_PIP";
|
||||
scopeArsenal = 1;
|
||||
|
@ -52,7 +52,7 @@ _scopeShiftY = _recoilCoef * linearConversion [0, 1, random 1, SCOPE_SHIFT_Y_MIN
|
||||
private ["_sizeX", "_sizeY"];
|
||||
|
||||
_sizeX = (0.75+_recoilScope)/(getResolution select 5);
|
||||
_sizeY = _sizeX*safezoneW/safezoneH;
|
||||
_sizeY = _sizeX*safezoneW/safezoneH*(16/9)/(getResolution select 4);
|
||||
|
||||
private "_positionReticle";
|
||||
_positionReticle = [
|
||||
@ -83,7 +83,7 @@ _positionBody = [
|
||||
|
||||
// Bring them all back
|
||||
_sizeX = 0.75/(getResolution select 5);
|
||||
_sizeY = _sizeX*safezoneW/safezoneH;
|
||||
_sizeY = _sizeX*safezoneW/safezoneH*(16/9)/(getResolution select 4);
|
||||
|
||||
_positionReticle = [
|
||||
safezoneX+0.5*safezoneW-0.5*_sizeX,
|
||||
|
@ -39,7 +39,7 @@ _nightOpacity = [1,0] select (_dayOpacity == 1);
|
||||
|
||||
// Apply lighting and make layers visible
|
||||
(_display displayCtrl 1713001) ctrlSetTextColor [1,1,1,1];
|
||||
(_display displayCtrl 1713002) ctrlSetTextColor [1,1,1,_nightOpacity];
|
||||
(_display displayCtrl 1713002) ctrlSetTextColor [1,1,1,[0,1] select (_dayOpacity < 0.5)];
|
||||
(_display displayCtrl 1713005) ctrlSetTextColor [1,1,1,_dayOpacity];
|
||||
(_display displayCtrl 1713006) ctrlSetTextColor [1,1,1,_nightOpacity];
|
||||
|
||||
|
@ -32,7 +32,7 @@ private ["_onSuccess", "_onFailure", "_condition"];
|
||||
|
||||
_onSuccess = {
|
||||
(_this select 0 select 0) removeMagazine (_this select 0 select 3);
|
||||
["reloadLauncher", _this select 0 select 0, _this select 0] call DEFUNC(common,targetEvent);
|
||||
["reloadLauncher", _this select 0 select 1, _this select 0] call DEFUNC(common,targetEvent);
|
||||
|
||||
[localize "STR_ACE_ReloadLaunchers_LauncherLoaded"] call DEFUNC(common,displayTextStructured);
|
||||
};
|
||||
|
19
addons/scopes/CfgVehicles.hpp
Normal file
19
addons/scopes/CfgVehicles.hpp
Normal file
@ -0,0 +1,19 @@
|
||||
class CfgVehicles {
|
||||
class Man;
|
||||
class CAManBase: Man {
|
||||
class ACE_SelfActions {
|
||||
class ACE_Equipment {
|
||||
class GVAR(adjustZero) {
|
||||
// Updates the zero reference
|
||||
displayName = "$STR_ACE_Scopes_AdjustZero";
|
||||
condition = QUOTE([ACE_player] call FUNC(canAdjustZero));
|
||||
statement = QUOTE([ACE_player] call FUNC(adjustZero));
|
||||
showDisabled = 0;
|
||||
priority = 0.2;
|
||||
//icon = QUOTE(PATHTOF(UI\...)); // TODO
|
||||
exceptions[] = {"notOnMap", "isNotInside"};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
@ -1,14 +1,15 @@
|
||||
class CfgWeapons {
|
||||
class ItemCore;
|
||||
class InventoryOpticsItem_Base_F;
|
||||
|
||||
|
||||
class optic_LRPS : ItemCore {
|
||||
ACE_ScopeAdjust_Horizontal[] = { -50, 50 };
|
||||
ACE_ScopeAdjust_Vertical[] = { -70, 70 };
|
||||
ACE_ScopeAdjust_Vertical[] = { -4, 30 };
|
||||
ACE_ScopeAdjust_Horizontal[] = { -6, 6 };
|
||||
ACE_ScopeAdjust_Increment = 0.1;
|
||||
class ItemInfo : InventoryOpticsItem_Base_F {
|
||||
class OpticsModes {
|
||||
class Snip {
|
||||
discreteDistance[] = { 1 };
|
||||
discreteDistance[] = { 100 };
|
||||
discreteDistanceInitIndex = 0;
|
||||
};
|
||||
};
|
||||
@ -16,12 +17,13 @@ class CfgWeapons {
|
||||
};
|
||||
|
||||
class optic_SOS : ItemCore {
|
||||
ACE_ScopeAdjust_Horizontal[] = { -50, 50 };
|
||||
ACE_ScopeAdjust_Vertical[] = { -60, 60 };
|
||||
ACE_ScopeAdjust_Vertical[] = { -4, 30 };
|
||||
ACE_ScopeAdjust_Horizontal[] = { -6, 6 };
|
||||
ACE_ScopeAdjust_Increment = 0.1;
|
||||
class ItemInfo : InventoryOpticsItem_Base_F {
|
||||
class OpticsModes {
|
||||
class Snip {
|
||||
discreteDistance[] = { 1 };
|
||||
discreteDistance[] = { 100 };
|
||||
discreteDistanceInitIndex = 0;
|
||||
};
|
||||
};
|
||||
@ -29,12 +31,41 @@ class CfgWeapons {
|
||||
};
|
||||
|
||||
class optic_DMS : ItemCore {
|
||||
ACE_ScopeAdjust_Horizontal[] = { -40, 40 };
|
||||
ACE_ScopeAdjust_Vertical[] = { -40, 40 };
|
||||
ACE_ScopeAdjust_Vertical[] = { -4, 20 };
|
||||
ACE_ScopeAdjust_Horizontal[] = { -6, 6 };
|
||||
ACE_ScopeAdjust_Increment = 0.1;
|
||||
class ItemInfo : InventoryOpticsItem_Base_F {
|
||||
class OpticsModes {
|
||||
class Snip {
|
||||
discreteDistance[] = { 1 };
|
||||
discreteDistance[] = { 100 };
|
||||
discreteDistanceInitIndex = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class optic_AMS_base : ItemCore {
|
||||
ACE_ScopeAdjust_Vertical[] = { -4, 30 };
|
||||
ACE_ScopeAdjust_Horizontal[] = { -6, 6 };
|
||||
ACE_ScopeAdjust_Increment = 0.1;
|
||||
class ItemInfo : InventoryOpticsItem_Base_F {
|
||||
class OpticsModes {
|
||||
class AMS {
|
||||
discreteDistance[] = { 100 };
|
||||
discreteDistanceInitIndex = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class optic_KHS_base : ItemCore {
|
||||
ACE_ScopeAdjust_Vertical[] = { -4, 30 };
|
||||
ACE_ScopeAdjust_Horizontal[] = { -6, 6 };
|
||||
ACE_ScopeAdjust_Increment = 0.1;
|
||||
class ItemInfo : InventoryOpticsItem_Base_F {
|
||||
class OpticsModes {
|
||||
class KHS {
|
||||
discreteDistance[] = { 100 };
|
||||
discreteDistanceInitIndex = 0;
|
||||
};
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Author: KoffeinFlummi and esteldunedain
|
||||
* Author: KoffeinFlummi, esteldunedain, Ruthberg
|
||||
*
|
||||
* Watches for scope changes.
|
||||
* Defines key bindings
|
||||
@ -33,66 +33,118 @@ if !(hasInterface) exitWith {};
|
||||
|
||||
|
||||
// Add keybinds
|
||||
["ACE3", QGVAR(AdjustUp), localize "STR_ACE_Scopes_AdjustUp",
|
||||
["ACE3", QGVAR(AdjustUpMinor), localize "STR_ACE_Scopes_AdjustUpMinor",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
[ACE_player] call FUNC(inventoryCheck);
|
||||
if !([ACE_player, 0, 0.1] call FUNC(canAdjustScope)) exitWith {false};
|
||||
|
||||
|
||||
// Statement
|
||||
[ACE_player, 0, 0.1] call FUNC(adjustScope);
|
||||
[ACE_player, ELEVATION_UP, MINOR_INCREMENT] call FUNC(adjustScope);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[201, [false, false, false]], true] call cba_fnc_addKeybind;
|
||||
|
||||
["ACE3", QGVAR(AdjustDown), localize "STR_ACE_Scopes_AdjustDown",
|
||||
["ACE3", QGVAR(AdjustDownMinor), localize "STR_ACE_Scopes_AdjustDownMinor",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
[ACE_player] call FUNC(inventoryCheck);
|
||||
if !([ACE_player, 0, -0.1] call FUNC(canAdjustScope)) exitWith {false};
|
||||
|
||||
// Statement
|
||||
[ACE_player, 0, -0.1] call FUNC(adjustScope);
|
||||
[ACE_player, ELEVATION_DOWN, MINOR_INCREMENT] call FUNC(adjustScope);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[209, [false, false, false]], true] call cba_fnc_addKeybind;
|
||||
|
||||
["ACE3", QGVAR(AdjustLeft), localize "STR_ACE_Scopes_AdjustLeft",
|
||||
["ACE3", QGVAR(AdjustLeftMinor), localize "STR_ACE_Scopes_AdjustLeftMinor",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
[ACE_player] call FUNC(inventoryCheck);
|
||||
if !([ACE_player, -0.1, 0] call FUNC(canAdjustScope)) exitWith {false};
|
||||
|
||||
// Statement
|
||||
[ACE_player, -0.1, 0] call FUNC(adjustScope);
|
||||
[ACE_player, WINDAGE_LEFT, MINOR_INCREMENT] call FUNC(adjustScope);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[209, [false, true, false]], true] call cba_fnc_addKeybind;
|
||||
|
||||
["ACE3", QGVAR(AdjustRight), localize "STR_ACE_Scopes_AdjustRight",
|
||||
["ACE3", QGVAR(AdjustRightMinor), localize "STR_ACE_Scopes_AdjustRightMinor",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
[ACE_player] call FUNC(inventoryCheck);
|
||||
if !([ACE_player, 0.1, 0] call FUNC(canAdjustScope)) exitWith {false};
|
||||
|
||||
// Statement
|
||||
[ACE_player, 0.1, 0] call FUNC(adjustScope);
|
||||
[ACE_player, WINDAGE_RIGHT, MINOR_INCREMENT] call FUNC(adjustScope);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[201, [false, true, false]], true] call cba_fnc_addKeybind;
|
||||
|
||||
["ACE3", QGVAR(AdjustUpMajor), localize "STR_ACE_Scopes_AdjustUpMajor",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
[ACE_player] call FUNC(inventoryCheck);
|
||||
|
||||
// Statement
|
||||
[ACE_player, ELEVATION_UP, MAJOR_INCREMENT] call FUNC(adjustScope);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[201, [true, false, false]], true] call cba_fnc_addKeybind;
|
||||
|
||||
["ACE3", QGVAR(AdjustDownMajor), localize "STR_ACE_Scopes_AdjustDownMajor",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
[ACE_player] call FUNC(inventoryCheck);
|
||||
|
||||
// Statement
|
||||
[ACE_player, ELEVATION_DOWN, MAJOR_INCREMENT] call FUNC(adjustScope);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[209, [true, false, false]], true] call cba_fnc_addKeybind;
|
||||
|
||||
["ACE3", QGVAR(AdjustLeftMajor), localize "STR_ACE_Scopes_AdjustLeftMajor",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
[ACE_player] call FUNC(inventoryCheck);
|
||||
|
||||
// Statement
|
||||
[ACE_player, WINDAGE_LEFT, MAJOR_INCREMENT] call FUNC(adjustScope);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[209, [true, true, false]], true] call cba_fnc_addKeybind;
|
||||
|
||||
["ACE3", QGVAR(AdjustRightMajor), localize "STR_ACE_Scopes_AdjustRightMajor",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
[ACE_player] call FUNC(inventoryCheck);
|
||||
|
||||
// Statement
|
||||
[ACE_player, WINDAGE_RIGHT, MAJOR_INCREMENT] call FUNC(adjustScope);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[201, [true, true, false]], true] call cba_fnc_addKeybind;
|
||||
|
||||
// init shortdot
|
||||
GVAR(showShortdot) = false;
|
||||
|
||||
|
@ -3,7 +3,9 @@
|
||||
ADDON = false;
|
||||
|
||||
PREP(adjustScope);
|
||||
PREP(canAdjustScope);
|
||||
PREP(adjustZero);
|
||||
PREP(applyScopeAdjustment);
|
||||
PREP(canAdjustZero);
|
||||
PREP(firedEH);
|
||||
PREP(getOptics);
|
||||
PREP(inventoryCheck);
|
||||
|
@ -16,6 +16,8 @@ class CfgPatches {
|
||||
|
||||
#include "CfgSounds.hpp"
|
||||
|
||||
#include "CfgVehicles.hpp"
|
||||
|
||||
#include "CfgWeapons.hpp"
|
||||
|
||||
#include "RscTitles.hpp"
|
||||
|
@ -1,56 +1,71 @@
|
||||
/*
|
||||
* Author: KoffeinFlummi
|
||||
* Author: KoffeinFlummi, Ruthberg
|
||||
* Changes the adjustment for the current scope
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Horizontal adjustment <NUMBER>
|
||||
* 2: Vertical adjustment <NUMBER>
|
||||
* 1: Turret and Direction <NUMBER>
|
||||
* 2: Major Step <BOOL>
|
||||
*
|
||||
* Return value:
|
||||
* True <BOOL>
|
||||
* Did we adjust anything? <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_weapons", "_zeroing", "_pitchbankyaw", "_pitch", "_bank", "_yaw", "_hint"];
|
||||
if !(vehicle _unit == _unit) exitWith {false};
|
||||
|
||||
_unit = _this select 0;
|
||||
private ["_unit", "_turretAndDirection", "_majorStep", "_weaponIndex", "_zeroing", "_optic", "_increment", "_maxVertical", "_maxHorizontal", "_elevation", "_windage", "_zero"];
|
||||
|
||||
EXPLODE_3_PVT(_this,_unit,_turretAndDirection,_majorStep);
|
||||
|
||||
_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
||||
if (_weaponIndex < 0) exitWith {false};
|
||||
|
||||
_adjustment = _unit getVariable QGVAR(Adjustment);
|
||||
if (isNil "_adjustment") then {
|
||||
_adjustment = [[0,0], [0,0], [0,0]];
|
||||
_unit setVariable [QGVAR(Adjustment), _adjustment];
|
||||
_adjustment = [[0,0,0], [0,0,0], [0,0,0]]; // [Windage, Elevation, Zero]
|
||||
};
|
||||
|
||||
_zeroing = _adjustment select _weaponIndex;
|
||||
_zeroing set [0, (round (((_zeroing select 0) + (_this select 1)) * 10)) / 10];
|
||||
_zeroing set [1, (round (((_zeroing select 1) + (_this select 2)) * 10)) / 10];
|
||||
|
||||
// Change the adjustment array
|
||||
_adjustment set [_weaponIndex, _zeroing];
|
||||
[_unit, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic);
|
||||
|
||||
playSound (["ACE_Scopes_Click_1", "ACE_Scopes_Click_2", "ACE_Scopes_Click_3"] select floor random 3);
|
||||
|
||||
// slightly rotate the player if looking through optic
|
||||
if (cameraView == "GUNNER") then {
|
||||
|
||||
_pitchbankyaw = [_unit] call EFUNC(common,getPitchBankYaw);
|
||||
// these are not exact mil-to-degree conversions, but instead chosen
|
||||
// to minimize the effect of rounding errors
|
||||
_pitch = (_pitchbankyaw select 0) + ((_this select 2) * -0.04);
|
||||
_bank = _pitchbankyaw select 1;
|
||||
_yaw = (_pitchbankyaw select 2) + ((_this select 1) * -0.04);
|
||||
[_unit, _pitch, _bank, _yaw] call EFUNC(common,setPitchBankYaw)
|
||||
|
||||
} else {
|
||||
|
||||
[] call FUNC(showZeroing);
|
||||
|
||||
if (isNil QGVAR(Optics)) then {
|
||||
GVAR(Optics) = ["", "", ""];
|
||||
};
|
||||
|
||||
true
|
||||
_optic = GVAR(Optics) select _weaponIndex;
|
||||
_increment = getNumber (configFile >> "CfgWeapons" >> _optic >> "ACE_ScopeAdjust_Increment");
|
||||
_maxVertical = getArray (configFile >> "CfgWeapons" >> _optic >> "ACE_ScopeAdjust_Vertical");
|
||||
_maxHorizontal = getArray (configFile >> "CfgWeapons" >> _optic >> "ACE_ScopeAdjust_Horizontal");
|
||||
|
||||
if ((count _maxHorizontal < 2) or (count _maxVertical < 2)) exitWith {false};
|
||||
|
||||
_zeroing = _adjustment select _weaponIndex;
|
||||
_elevation = _zeroing select 0;
|
||||
_windage = _zeroing select 1;
|
||||
_zero = _zeroing select 2;
|
||||
|
||||
switch (_turretAndDirection) do
|
||||
{
|
||||
case ELEVATION_UP: { _elevation = _elevation + _increment };
|
||||
case ELEVATION_DOWN: { _elevation = _elevation - _increment };
|
||||
case WINDAGE_LEFT: { _windage = _windage - _increment };
|
||||
case WINDAGE_RIGHT: { _windage = _windage + _increment };
|
||||
};
|
||||
|
||||
if (_majorStep) then {
|
||||
switch (_turretAndDirection) do
|
||||
{
|
||||
case ELEVATION_UP: { _elevation = ceil(_elevation) };
|
||||
case ELEVATION_DOWN: { _elevation = floor(_elevation) };
|
||||
case WINDAGE_LEFT: { _windage = floor(_windage) };
|
||||
case WINDAGE_RIGHT: { _windage = ceil(_windage) };
|
||||
};
|
||||
};
|
||||
|
||||
_elevation = round(_elevation * 10) / 10;
|
||||
_windage = round(_windage * 10) / 10;
|
||||
|
||||
if ((_elevation + _zero) < _maxVertical select 0 or (_elevation + _zero) > _maxVertical select 1) exitWith {false};
|
||||
if (_windage < _maxHorizontal select 0 or _windage > _maxHorizontal select 1) exitWith {false};
|
||||
|
||||
[_unit, _elevation, _windage, _zero] call FUNC(applyScopeAdjustment);
|
||||
|
39
addons/scopes/functions/fnc_adjustZero.sqf
Normal file
39
addons/scopes/functions/fnc_adjustZero.sqf
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Author: KoffeinFlummi, Ruthberg
|
||||
* Updates the zero reference for the current scope
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* true <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if !(vehicle _unit == _unit) exitWith {false};
|
||||
|
||||
private ["_unit", "_adjustment", "_zeroing", "_elevation", "_windage", "_zero"];
|
||||
_unit = _this select 0;
|
||||
|
||||
_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
||||
if (_weaponIndex < 0) exitWith {false};
|
||||
|
||||
_adjustment = _unit getVariable QGVAR(Adjustment);
|
||||
if (isNil "_adjustment") then {
|
||||
// [Windage, Elevation, Zero]
|
||||
_adjustment = [[0,0,0], [0,0,0], [0,0,0]];
|
||||
};
|
||||
|
||||
_zeroing = _adjustment select _weaponIndex;
|
||||
_elevation = _zeroing select 0;
|
||||
_windage = _zeroing select 1;
|
||||
_zero = _zeroing select 2;
|
||||
|
||||
_zero = round((_zero + _elevation) * 10) / 10;
|
||||
_elevation = 0;
|
||||
|
||||
[_unit, _elevation, _windage, _zero] call FUNC(applyScopeAdjustment);
|
||||
|
||||
true
|
51
addons/scopes/functions/fnc_applyScopeAdjustment.sqf
Normal file
51
addons/scopes/functions/fnc_applyScopeAdjustment.sqf
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Author: KoffeinFlummi, Ruthberg
|
||||
* Applies the adjustment for the current scope
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Absolute elevation <NUMBER>
|
||||
* 2: Absolute windage <NUMBER>
|
||||
* 3: Absolute zero reference <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* True <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_elevation", "_windage", "_zero", "_adjustmentDifference", "_pitchbankyaw", "_pitch", "_bank", "_yaw"];
|
||||
|
||||
EXPLODE_4_PVT(_this,_unit,_elevation,_windage,_zero);
|
||||
|
||||
_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
||||
|
||||
_adjustment = _unit getVariable QGVAR(Adjustment);
|
||||
if (isNil "_adjustment") then {
|
||||
// [Windage, Elevation, Zero]
|
||||
_adjustment = [[0,0,0], [0,0,0], [0,0,0]];
|
||||
_unit setVariable [QGVAR(Adjustment), _adjustment];
|
||||
};
|
||||
|
||||
_adjustmentDifference = (_adjustment select _weaponIndex) vectorDiff [_elevation, _windage, _zero];
|
||||
|
||||
_adjustment set [_weaponIndex, [_elevation, _windage, _zero]];
|
||||
[_unit, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic);
|
||||
|
||||
playSound (["ACE_Scopes_Click_1", "ACE_Scopes_Click_2", "ACE_Scopes_Click_3"] select floor random 3);
|
||||
|
||||
// slightly rotate the player if looking through optic
|
||||
if (cameraView == "GUNNER") then {
|
||||
// Convert adjustmentDifference from mils to degrees
|
||||
_adjustmentDifference = [_adjustmentDifference, {_this * 0.05625}] call EFUNC(common,map);
|
||||
_pitchbankyaw = [_unit] call EFUNC(common,getPitchBankYaw);
|
||||
_pitch = (_pitchbankyaw select 0) + (_adjustmentDifference select 0);
|
||||
_bank = (_pitchbankyaw select 1);
|
||||
_yaw = (_pitchbankyaw select 2) + (_adjustmentDifference select 1);
|
||||
[_unit, _pitch, _bank, _yaw] call EFUNC(common,setPitchBankYaw);
|
||||
} else {
|
||||
[] call FUNC(showZeroing);
|
||||
};
|
||||
|
||||
true
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Author: KoffeinFlummi
|
||||
* Checks if a player can adjust his optic in the given way.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Horizontal adjustment <NUMBER>
|
||||
* 2: Vertical adjustment <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* Can adjustment be done? <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_weaponIndex", "_zeroing", "_optic", "_maxHorizontal", "_maxVertical"];
|
||||
|
||||
_unit = _this select 0;
|
||||
|
||||
_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
||||
if (_weaponIndex < 0) exitWith {false};
|
||||
|
||||
_adjustment = _unit getVariable QGVAR(Adjustment);
|
||||
if (isNil "_adjustment") then {
|
||||
_adjustment = [[0,0], [0,0], [0,0]];
|
||||
};
|
||||
|
||||
if (isNil QGVAR(Optics)) then {
|
||||
GVAR(Optics) = ["", "", ""];
|
||||
};
|
||||
|
||||
_zeroing = _adjustment select _weaponIndex;
|
||||
_zeroX = (_zeroing select 0) + (_this select 1);
|
||||
_zeroY = (_zeroing select 1) + (_this select 2);
|
||||
|
||||
_optic = GVAR(Optics) select _weaponIndex;
|
||||
_maxHorizontal = getArray (configFile >> "CfgWeapons" >> _optic >> "ACE_ScopeAdjust_Horizontal");
|
||||
_maxVertical = getArray (configFile >> "CfgWeapons" >> _optic >> "ACE_ScopeAdjust_Vertical");
|
||||
if ((count _maxHorizontal < 2) or (count _maxVertical < 2)) exitWith {false};
|
||||
if ((_maxHorizontal isEqualTo [0,0]) or (_maxVertical isEqualTo [0,0])) exitWith {false};
|
||||
|
||||
if (_zeroX < _maxHorizontal select 0 or _zeroX > _maxHorizontal select 1) exitWith {false};
|
||||
if (_zeroY < _maxVertical select 0 or _zeroY > _maxVertical select 1) exitWith {false};
|
||||
|
||||
vehicle _unit == _unit
|
34
addons/scopes/functions/fnc_canAdjustZero.sqf
Normal file
34
addons/scopes/functions/fnc_canAdjustZero.sqf
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Author: KoffeinFlummi, Ruthberg
|
||||
* Changes the adjustment for the current scope
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return value:
|
||||
* Can we update the zero reference? <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (cameraView == "GUNNER") exitWith {false};
|
||||
if !(vehicle _unit == _unit) exitWith {false};
|
||||
if !(missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) exitWith {false};
|
||||
|
||||
private ["_unit", "_adjustment", "_elevation"];
|
||||
_unit = _this select 0;
|
||||
|
||||
_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
||||
if (_weaponIndex < 0) exitWith {false};
|
||||
|
||||
_adjustment = _unit getVariable QGVAR(Adjustment);
|
||||
if (isNil "_adjustment") then {
|
||||
// [Windage, Elevation, Zero]
|
||||
_adjustment = [[0,0,0], [0,0,0], [0,0,0]];
|
||||
};
|
||||
|
||||
_elevation = (_adjustment select _weaponIndex) select 0;
|
||||
|
||||
// You can only adjust your zero reference, if your relative elevation setting is not 0
|
||||
_elevation != 0
|
@ -39,4 +39,4 @@ _zeroing = _adjustment select _weaponIndex;
|
||||
// Convert zeroing from mils to degrees
|
||||
_zeroing = [_zeroing, {_this * 0.05625}] call EFUNC(common,map);
|
||||
|
||||
[_projectile, _zeroing select 0, _zeroing select 1, 0] call EFUNC(common,changeProjectileDirection);
|
||||
[_projectile, (_zeroing select 1), (_zeroing select 0) + (_zeroing select 2), 0] call EFUNC(common,changeProjectileDirection);
|
||||
|
@ -18,7 +18,8 @@ private ["_newOptics", "_adjustment"];
|
||||
|
||||
_adjustment = ACE_player getVariable QGVAR(Adjustment);
|
||||
if (isNil "_adjustment") then {
|
||||
_adjustment = [[0,0], [0,0], [0,0]];
|
||||
// [Windage, Elevation, Zero]
|
||||
_adjustment = [[0,0,0], [0,0,0], [0,0,0]];
|
||||
ACE_player setVariable [QGVAR(Adjustment), _adjustment];
|
||||
[ACE_player, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic);
|
||||
};
|
||||
@ -31,8 +32,8 @@ _newOptics = [_player] call FUNC(getOptics);
|
||||
{
|
||||
if (_newOptics select _forEachIndex != _x) then {
|
||||
// The optic for this weapon changed, set adjustment to zero
|
||||
if !((_adjustment select _foreachindex) isEqualTo [0,0]) then {
|
||||
_adjustment set [_forEachIndex, [0,0]];
|
||||
if !((_adjustment select _foreachindex) isEqualTo [0,0,0]) then {
|
||||
_adjustment set [_forEachIndex, [0,0,0]];
|
||||
[ACE_player, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic);
|
||||
};
|
||||
};
|
||||
|
@ -21,7 +21,8 @@ if (_weaponIndex < 0) exitWith {};
|
||||
|
||||
_adjustment = ACE_player getVariable QGVAR(Adjustment);
|
||||
if (isNil "_adjustment") then {
|
||||
_adjustment = [[0,0], [0,0], [0,0]];
|
||||
// [Windage, Elevation, Zero]
|
||||
_adjustment = [[0,0,0], [0,0,0], [0,0,0]];
|
||||
};
|
||||
|
||||
// Display the adjustment knobs
|
||||
@ -36,8 +37,8 @@ if (isNull _display) exitWith {};
|
||||
_zeroing = _adjustment select _weaponIndex;
|
||||
_vertical = _display displayCtrl 12;
|
||||
_horizontal = _display displayCtrl 13;
|
||||
_vertical ctrlSetText (str (_zeroing select 1));
|
||||
_horizontal ctrlSetText (str (_zeroing select 0));
|
||||
_vertical ctrlSetText (str (_zeroing select 0));
|
||||
_horizontal ctrlSetText (str (_zeroing select 1));
|
||||
|
||||
// Set the time when to hide the knobs
|
||||
GVAR(timeToHide) = diag_tickTime + 3.0;
|
||||
|
@ -1,6 +1,14 @@
|
||||
#define COMPONENT scopes
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
#define ELEVATION_UP 0
|
||||
#define ELEVATION_DOWN 1
|
||||
#define WINDAGE_LEFT 2
|
||||
#define WINDAGE_RIGHT 3
|
||||
|
||||
#define MINOR_INCREMENT false
|
||||
#define MAJOR_INCREMENT true
|
||||
|
||||
#ifdef DEBUG_ENABLED_SCOPES
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
@ -2,49 +2,32 @@
|
||||
<!-- Edited with tabler - 2014-12-11 -->
|
||||
<Project name="ACE">
|
||||
<Package name="Scopes">
|
||||
<Key ID="STR_ACE_Scopes_AdjustUp">
|
||||
<English>Adjust Elevation Up</English>
|
||||
<Hungarian>Magasság Állítása Felfelé</Hungarian>
|
||||
<German>Optik-Elevation erhöhen</German>
|
||||
<Portuguese>Ajustar Elevação Acima</Portuguese>
|
||||
<French>Hausse +</French>
|
||||
<Polish>Regulacja krzyża w pionie +</Polish>
|
||||
<Czech>Zvýšit náměr</Czech>
|
||||
<Spanish>Ajustar elevación arriba</Spanish>
|
||||
<Russian>Вверх по вертикали</Russian>
|
||||
<Key ID="STR_ACE_Scopes_AdjustUpMinor">
|
||||
<English>"Minor adjustment up</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Scopes_AdjustDown">
|
||||
<English>Adjust Elevation Down</English>
|
||||
<Hungarian>Magasság Állítása Lefelé</Hungarian>
|
||||
<German>Optik-Elevation verringern</German>
|
||||
<Portuguese>Ajustar Elevação Abaixo</Portuguese>
|
||||
<French>Hausse -</French>
|
||||
<Polish>Regulacja krzyża w pionie -</Polish>
|
||||
<Czech>Snížit náměr</Czech>
|
||||
<Spanish>Ajustar elevación abajo</Spanish>
|
||||
<Russian>Вниз по вертикали</Russian>
|
||||
<Key ID="STR_ACE_Scopes_AdjustDownMinor">
|
||||
<English>"Minor adjustment down</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Scopes_AdjustRight">
|
||||
<English>Adjust Windage Right</English>
|
||||
<Hungarian>Oldalirány Állítása Jobbra</Hungarian>
|
||||
<German>Optik-Azimuth erhöhen</German>
|
||||
<Portuguese>Ajustar Azimute à Direita</Portuguese>
|
||||
<French>Dérive +</French>
|
||||
<Polish>Regulacja krzyża w poziomie +</Polish>
|
||||
<Czech>Náměr doprava (vítr)</Czech>
|
||||
<Spanish>Ajustar deriva a la derecha</Spanish>
|
||||
<Russian>Вправо на уровне</Russian>
|
||||
<Key ID="STR_ACE_Scopes_AdjustRightMinor">
|
||||
<English>"Minor adjustment right</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Scopes_AdjustLeft">
|
||||
<English>Adjust Windage Left</English>
|
||||
<Hungarian>Oldalirány Állítása Balra</Hungarian>
|
||||
<German>Optik-Azimuth verringern</German>
|
||||
<Portuguese>Ajustar Azimute à Esquerda</Portuguese>
|
||||
<French>Dérive -</French>
|
||||
<Polish>Regulacja krzyża w poziomie -</Polish>
|
||||
<Czech>Náměr doleva (vítr)</Czech>
|
||||
<Spanish>Ajustar deriva a la izquierda</Spanish>
|
||||
<Russian>Влево на уровне</Russian>
|
||||
<Key ID="STR_ACE_Scopes_AdjustLeftMinor">
|
||||
<English>"Minor adjustment left</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Scopes_AdjustUpMajor">
|
||||
<English>Major adjustment up</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Scopes_AdjustDownMajor">
|
||||
<English>Major adjustment down</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Scopes_AdjustRightMajor">
|
||||
<English>Major adjustment right</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Scopes_AdjustLeftMajor">
|
||||
<English>Major adjustment left</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Scopes_AdjustZero">
|
||||
<English>Set zero adjustment</English>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
@ -535,6 +535,10 @@ See the make.cfg file for additional build options.
|
||||
else:
|
||||
old_sha = ""
|
||||
|
||||
#We always build ACE_common so we can properly show the correct version stamp in the RPT file.
|
||||
if module == "common":
|
||||
old_sha = ""
|
||||
|
||||
# Hash the module
|
||||
new_sha = get_directory_hash(os.path.join(module_root, module))
|
||||
|
||||
|
@ -535,6 +535,10 @@ See the make.cfg file for additional build options.
|
||||
else:
|
||||
old_sha = ""
|
||||
|
||||
#We always build ACE_common so we can properly show the correct version stamp in the RPT file.
|
||||
if module == "common":
|
||||
old_sha = ""
|
||||
|
||||
# Hash the module
|
||||
new_sha = get_directory_hash(os.path.join(module_root, module))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user