diff --git a/addons/atragmx/RscTitles.hpp b/addons/atragmx/RscTitles.hpp index b60ff03fdc..592374ddad 100644 --- a/addons/atragmx/RscTitles.hpp +++ b/addons/atragmx/RscTitles.hpp @@ -230,12 +230,12 @@ class ATragMX_Display { w=0.03; h=0.03; colorBackground[]={0,0,0,0.0}; - action=QUOTE((GVAR(currentGun) + (count GVAR(gunList)) - 1) % (count GVAR(gunList)) call FUNC(change_gun)); + action=QUOTE(-1 call FUNC(cycle_gun_list)); }; class BOTTOM: TOP { idc=-1; y=0.265*safezoneH+safezoneY+0.955; - action=QUOTE((GVAR(currentGun) + (count GVAR(gunList)) + 1) % (count GVAR(gunList)) call FUNC(change_gun)); + action=QUOTE(+1 call FUNC(cycle_gun_list)); }; class LEFT: ATragMX_RscButton { idc=-1; @@ -316,6 +316,7 @@ class ATragMX_Display { colorBackground[]={0.15,0.21,0.23,0.3}; colorFocused[]={0.15,0.21,0.23,0.2}; text="Gun"; + action=QUOTE(call FUNC(toggle_gun_ammo_data)); }; class TEXT_BORE_HEIGHT: TEXT_GUN_PROFILE { idc=10; @@ -323,12 +324,12 @@ class ATragMX_Display { y=0.265*safezoneH+safezoneY+0.285; text="BH"; }; - class TEXT_BORE_HEIGHT_INPUT: ATragMX_RscEdit { + class TEXT_BORE_HEIGHT_OUTPUT: TEXT_BORE_HEIGHT { idc=100; + style=ST_RIGHT; w=0.058; x=0.550*safezoneW+safezoneX+0.145; y=0.265*safezoneH+safezoneY+0.285; - onKeyUp=QUOTE(if (_this select 1 == 28) then {call FUNC(calculate_target_solution)}); }; class TEXT_BULLET_MASS: TEXT_BORE_HEIGHT { idc=11; @@ -336,7 +337,7 @@ class ATragMX_Display { y=0.265*safezoneH+safezoneY+0.320; text="BW"; }; - class TEXT_BULLET_MASS_INPUT: TEXT_BORE_HEIGHT_INPUT { + class TEXT_BULLET_MASS_OUTPUT: TEXT_BORE_HEIGHT_OUTPUT { idc=110; y=0.265*safezoneH+safezoneY+0.320; }; @@ -345,7 +346,7 @@ class ATragMX_Display { y=0.265*safezoneH+safezoneY+0.355; text="C1"; }; - class TEXT_AIR_FRICTION_INPUT: TEXT_BORE_HEIGHT_INPUT { + class TEXT_AIR_FRICTION_OUTPUT: TEXT_BORE_HEIGHT_OUTPUT { idc=120; y=0.265*safezoneH+safezoneY+0.355; }; @@ -359,7 +360,7 @@ class ATragMX_Display { colorFocused[]={0.15,0.21,0.23,0.2}; text="MV"; }; - class TEXT_MUZZLE_VELOCITY_INPUT: TEXT_BORE_HEIGHT_INPUT { + class TEXT_MUZZLE_VELOCITY_OUTPUT: TEXT_BORE_HEIGHT_OUTPUT { idc=130; y=0.265*safezoneH+safezoneY+0.390; }; @@ -368,35 +369,35 @@ class ATragMX_Display { y=0.265*safezoneH+safezoneY+0.425; text="ZR"; }; - class TEXT_ZERO_RANGE_INPUT: TEXT_BORE_HEIGHT_INPUT { + class TEXT_ZERO_RANGE_OUTPUT: TEXT_BORE_HEIGHT_OUTPUT { idc=140; y=0.265*safezoneH+safezoneY+0.425; - onKeyUp=QUOTE(if (_this select 1 == 28) then {call FUNC(update_zero_range)}); }; class TEXT_ATMOSPHERE: TEXT_GUN { idc=4001; x=0.550*safezoneW+safezoneX+0.205; text="Atmsphr"; + action=QUOTE(0 call FUNC(toggle_atmo_env_data)); }; class TEXT_TEMPERATURE: TEXT_BULLET_MASS { idc=20; x=0.550*safezoneW+safezoneX+0.20; text="Tmp"; }; - class TEXT_TEMPERATURE_INPUT: ATragMX_RscEdit { + class TEXT_TEMPERATURE_OUTPUT: TEXT_TEMPERATURE { idc=200; + style=ST_RIGHT; w=0.050; x=0.550*safezoneW+safezoneX+0.245; y=0.265*safezoneH+safezoneY+0.320; text=""; - onKeyUp=QUOTE(if (_this select 1 == 28) then {call FUNC(calculate_target_solution)}); }; class TEXT_BAROMETRIC_PRESSURE: TEXT_AIR_FRICTION { idc=21; x=0.550*safezoneW+safezoneX+0.20; text="BP"; }; - class TEXT_BAROMETRIC_PRESSURE_INPUT: TEXT_TEMPERATURE_INPUT { + class TEXT_BAROMETRIC_PRESSURE_OUTPUT: TEXT_TEMPERATURE_OUTPUT { idc=210; y=0.265*safezoneH+safezoneY+0.355; }; @@ -406,10 +407,19 @@ class ATragMX_Display { y=0.265*safezoneH+safezoneY+0.390; text="RH"; }; - class TEXT_RELATIVE_HUMIDITY_INPUT: TEXT_TEMPERATURE_INPUT { + class TEXT_RELATIVE_HUMIDITY_OUTPUT: TEXT_TEMPERATURE_OUTPUT { idc=220; y=0.265*safezoneH+safezoneY+0.390; }; + class TEXT_ALTITUDE: TEXT_BORE_HEIGHT { + idc=23; + x=0.550*safezoneW+safezoneX+0.20; + text="Alt"; + }; + class TEXT_ALTITUDE_OUTPUT: TEXT_TEMPERATURE_OUTPUT { + idc=230; + y=0.265*safezoneH+safezoneY+0.285; + }; class TEXT_TARGET_A: ATragMX_RscButton { idc=500; w=0.0231; @@ -445,18 +455,18 @@ class ATragMX_Display { idc=4002; x=0.550*safezoneW+safezoneX+0.3; text="Target"; + action=QUOTE(0 call FUNC(toggle_target_data)); }; class TEXT_WIND_SPEED: TEXT_BORE_HEIGHT { idc=30; x=0.550*safezoneW+safezoneX+0.3; text="WS"; }; - class TEXT_WIND_SPEED_INPUT: ATragMX_RscEdit { + class TEXT_WIND_SPEED_OUTPUT: TEXT_BORE_HEIGHT_OUTPUT { idc=300; w=0.058; x=0.550*safezoneW+safezoneX+0.335; y=0.265*safezoneH+safezoneY+0.285; - onKeyUp=QUOTE(if (_this select 1 == 28) then {call FUNC(calculate_target_solution)}); text="0"; }; class TEXT_WIND_DIRECTION: TEXT_BULLET_MASS { @@ -464,7 +474,7 @@ class ATragMX_Display { x=0.550*safezoneW+safezoneX+0.3; text="WD"; }; - class TEXT_WIND_DIRECTION_INPUT: TEXT_WIND_SPEED_INPUT { + class TEXT_WIND_DIRECTION_OUTPUT: TEXT_WIND_SPEED_OUTPUT { idc=310; y=0.265*safezoneH+safezoneY+0.32; }; @@ -473,7 +483,7 @@ class ATragMX_Display { x=0.550*safezoneW+safezoneX+0.3; text="IA"; }; - class TEXT_INCLINATION_ANGLE_INPUT: TEXT_WIND_SPEED_INPUT { + class TEXT_INCLINATION_ANGLE_OUTPUT: TEXT_WIND_SPEED_OUTPUT { idc=320; y=0.265*safezoneH+safezoneY+0.355; }; @@ -481,9 +491,9 @@ class ATragMX_Display { idc=33; x=0.550*safezoneW+safezoneX+0.3; text="TS"; - action=QUOTE(call FUNC(toggle_target_speed_assist)); + action=QUOTE(0 call FUNC(toggle_target_speed_assist)); }; - class TEXT_TARGET_SPEED_INPUT: TEXT_WIND_SPEED_INPUT { + class TEXT_TARGET_SPEED_OUTPUT: TEXT_WIND_SPEED_OUTPUT { idc=330; y=0.265*safezoneH+safezoneY+0.39; }; @@ -493,7 +503,7 @@ class ATragMX_Display { text="TR"; action=QUOTE(0 call FUNC(toggle_target_range_assist)); }; - class TEXT_TARGET_RANGE_INPUT: TEXT_WIND_SPEED_INPUT { + class TEXT_TARGET_RANGE_INPUT: TEXT_WIND_SPEED_OUTPUT { idc=340; y=0.265*safezoneH+safezoneY+0.425; }; @@ -563,6 +573,7 @@ class ATragMX_Display { x=0.550*safezoneW+safezoneX+0.11; y=0.265*safezoneH+safezoneY+0.57; text="Lead"; + action=""; }; class TEXT_LEAD_OUTPUT: TEXT_ELEVATION_OUTPUT_ABSOLUTE { idc=420; @@ -814,13 +825,13 @@ class ATragMX_Display { w=0.07; x=0.550*safezoneW+safezoneX+0.32; text="cm"; - action=QUOTE(GVAR(rangeAssistTargetSizeUnit)=(GVAR(rangeAssistTargetSizeUnit)+1) % (count GVAR(GVAR(rangeAssistTargetSizeUnit)s)); ctrlSetText [7014, GVAR(GVAR(rangeAssistTargetSizeUnit)s) select GVAR(rangeAssistTargetSizeUnit)]); + action=QUOTE(call FUNC(cycle_target_size_units)); }; class TEXT_TARGET_RANGE_ASSIST_IMAGE_SIZE_UNIT: TEXT_TARGET_RANGE_ASSIST_TARGET_SIZE_UNIT { idc=7015; y=0.265*safezoneH+safezoneY+0.45; text="MIL"; - action=QUOTE(GVAR(rangeAssistImageSizeUnit)=(GVAR(rangeAssistImageSizeUnit)+1) % (count GVAR(rangeAssistImageSizeUnits)); ctrlSetText [7015, GVAR(rangeAssistImageSizeUnits) select GVAR(rangeAssistImageSizeUnit)]); + action=QUOTE(call FUNC(cycle_image_size_units)); }; class TEXT_TARGET_RANGE_ASSIST_ESTIMATED_RANGE_UNIT: TEXT_TARGET_RANGE_ASSIST_ESTIMATED_RANGE { idc=7016; @@ -861,22 +872,22 @@ class ATragMX_Display { class TEXT_TARGET_SPEED_ASSIST_TARGET_RANGE: TEXT_TARGET_RANGE_ASSIST_TARGET_SIZE { idc=8000; - x=0.550*safezoneW+safezoneX+0.12; + x=0.550*safezoneW+safezoneX+0.13; text="Target Range"; }; class TEXT_TARGET_SPEED_ASSIST_NUM_TICKS: TEXT_TARGET_RANGE_ASSIST_IMAGE_SIZE { idc=8001; - x=0.550*safezoneW+safezoneX+0.12; + x=0.550*safezoneW+safezoneX+0.13; text="Num Ticks"; }; class TEXT_TARGET_SPEED_ASSIST_TIME: TEXT_TARGET_RANGE_ASSIST_ANGLE { idc=8002; - x=0.550*safezoneW+safezoneX+0.12; + x=0.550*safezoneW+safezoneX+0.13; text="Time (secs)"; }; class TEXT_TARGET_SPEED_ASSIST_TARGET_ESTIMATED_SPEED: TEXT_TARGET_RANGE_ASSIST_ESTIMATED_RANGE { idc=8003; - x=0.550*safezoneW+safezoneX+0.12; + x=0.550*safezoneW+safezoneX+0.13; text="Est Speed"; }; class TEXT_TARGET_SPEED_ASSIST_TARGET_RANGE_INPUT: TEXT_TARGET_RANGE_ASSIST_TARGET_SIZE_INPUT { @@ -907,7 +918,7 @@ class ATragMX_Display { class TEXT_TARGET_SPEED_ASSIST_NUM_TICKS_UNIT: TEXT_TARGET_RANGE_ASSIST_IMAGE_SIZE_UNIT { idc=8009; text="MIL"; - action=QUOTE(GVAR(speedAssistNumTicksUnit)=(GVAR(speedAssistNumTicksUnit)+1) % (count GVAR(speedAssistNumTicksUnits)); ctrlSetText [8009, GVAR(speedAssistNumTicksUnits) select GVAR(speedAssistNumTicksUnit)]; call FUNC(calculate_target_speed_assist)); + action=QUOTE(call FUNC(cycle_num_ticks_units)); }; class TEXT_TARGET_SPEED_ASSIST_TIMER_START: TEXT_TARGET_RANGE_ASSIST_IMAGE_SIZE_UNIT { idc=8010; @@ -1046,5 +1057,258 @@ class ATragMX_Display { text="Cancel"; action=QUOTE(false call FUNC(show_add_new_gun); true call FUNC(show_gun_list)); }; + + class TEXT_GUN_AMMO_DATA_BORE_HEIGHT: TEXT_BORE_HEIGHT { + idc=12000; + w=0.22; + y=0.265*safezoneH+safezoneY+0.28; + text="Bore (cm)"; + }; + class TEXT_GUN_AMMO_DATA_BORE_HEIGHT_INPUT: ATragMX_RscEdit { + idc=120000; + w=0.06; + x=0.550*safezoneW+safezoneX+0.335; + y=0.265*safezoneH+safezoneY+0.28; + }; + class TEXT_GUN_AMMO_DATA_BULLET_MASS: TEXT_GUN_AMMO_DATA_BORE_HEIGHT { + idc=12001; + y=0.265*safezoneH+safezoneY+0.320; + text="Bullet Weight (grams)"; + }; + class TEXT_GUN_AMMO_DATA_BULLET_MASS_INPUT: TEXT_GUN_AMMO_DATA_BORE_HEIGHT_INPUT { + idc=120010; + y=0.265*safezoneH+safezoneY+0.320; + }; + class TEXT_GUN_AMMO_DATA_BULLET_DIAMETER: TEXT_GUN_AMMO_DATA_BORE_HEIGHT { + idc=12002; + y=0.265*safezoneH+safezoneY+0.360; + text="Bullet Diam (cm)"; + }; + class TEXT_GUN_AMMO_DATA_BULLET_DIAMETER_INPUT: TEXT_GUN_AMMO_DATA_BORE_HEIGHT_INPUT { + idc=120020; + y=0.265*safezoneH+safezoneY+0.360; + }; + class TEXT_GUN_AMMO_DATA_AIR_FRICTION: TEXT_GUN_AMMO_DATA_BORE_HEIGHT { + idc=12003; + y=0.265*safezoneH+safezoneY+0.400; + text="C1 Coefficient"; + }; + class TEXT_GUN_AMMO_DATA_AIR_FRICTION_INPUT: TEXT_GUN_AMMO_DATA_BORE_HEIGHT_INPUT { + idc=120030; + y=0.265*safezoneH+safezoneY+0.400; + }; + class TEXT_GUN_AMMO_DATA_RIFLE_TWIST: TEXT_GUN_AMMO_DATA_BORE_HEIGHT { + idc=12004; + y=0.265*safezoneH+safezoneY+0.440; + text="Rifle Twist (cm/trn)"; + }; + class TEXT_GUN_AMMO_DATA_RIFLE_TWIST_INPUT: TEXT_GUN_AMMO_DATA_BORE_HEIGHT_INPUT { + idc=120040; + y=0.265*safezoneH+safezoneY+0.440; + }; + class TEXT_GUN_AMMO_DATA_MUZZLE_VELOCITY: TEXT_GUN_AMMO_DATA_BORE_HEIGHT { + idc=12005; + y=0.265*safezoneH+safezoneY+0.480; + text="Muzzle Velocity (m/s)"; + }; + class TEXT_GUN_AMMO_DATA_MUZZLE_VELOCITY_INPUT: TEXT_GUN_AMMO_DATA_BORE_HEIGHT_INPUT { + idc=120050; + y=0.265*safezoneH+safezoneY+0.480; + }; + class TEXT_GUN_AMMO_DATA_ZERO_RANGE: TEXT_GUN_AMMO_DATA_BORE_HEIGHT { + idc=12006; + y=0.265*safezoneH+safezoneY+0.520; + text="Zero Range (meters)"; + }; + class TEXT_GUN_AMMO_DATA_ZERO_RANGE_INPUT: TEXT_GUN_AMMO_DATA_BORE_HEIGHT_INPUT { + idc=120060; + y=0.265*safezoneH+safezoneY+0.520; + }; + class TEXT_GUN_AMMO_DATA_DONE: TEXT_TARGET_SPEED_ASSIST_DONE { + idc=12008; + action=QUOTE(1 call FUNC(toggle_gun_ammo_data)); + }; + class TEXT_GUN_AMMO_DATA_CANCEL: TEXT_TARGET_SPEED_ASSIST_CANCEL { + idc=12009; + action=QUOTE(0 call FUNC(toggle_gun_ammo_data)); + }; + class TEXT_GUN_AMMO_DATA_PREV: TEXT_TARGET_SPEED_ASSIST_PREV { + idc=12010; + }; + class TEXT_GUN_AMMO_DATA_NEXT: TEXT_TARGET_SPEED_ASSIST_NEXT { + idc=12011; + }; + + class TEXT_ATMO_ENV_DATA_DEFAULT: TEXT_LEAD { + idc=13000; + w=0.08; + x=0.550*safezoneW+safezoneX+0.15; + y=0.265*safezoneH+safezoneY+0.320; + text="Default"; + action=QUOTE(call FUNC(restore_atmo_default)); + }; + class TEXT_ATMO_ENV_DATA_AT: TEXT_TARGET_A { + idc=13001; + w=0.04; + x=0.550*safezoneW+safezoneX+0.24; + y=0.265*safezoneH+safezoneY+0.320; + text="AT"; + action=QUOTE(GVAR(atmosphereModeTBH) = false; call FUNC(update_atmo_selection)); + }; + class TEXT_ATMO_ENV_DATA_TBH: TEXT_ATMO_ENV_DATA_AT { + idc=13002; + x=0.550*safezoneW+safezoneX+0.28; + text="TBH"; + action=QUOTE(GVAR(atmosphereModeTBH) = true; call FUNC(update_atmo_selection)); + }; + class TEXT_ATMO_ENV_DATA_ALTITUDE: TEXT_GUN_AMMO_DATA_BORE_HEIGHT { + idc=13003; + x=0.550*safezoneW+safezoneX+0.115; + y=0.265*safezoneH+safezoneY+0.400; + text="Altitude (ft)"; + }; + class TEXT_ATMO_ENV_DATA_ALTITUDE_INPUT: TEXT_GUN_AMMO_DATA_BORE_HEIGHT_INPUT { + idc=130030; + x=0.550*safezoneW+safezoneX+0.330; + y=0.265*safezoneH+safezoneY+0.400; + }; + class TEXT_ATMO_ENV_DATA_TEMPERATURE: TEXT_ATMO_ENV_DATA_ALTITUDE { + idc=13004; + y=0.265*safezoneH+safezoneY+0.440; + text="temperature (F)"; + }; + class TEXT_ATMO_ENV_DATA_TEMPERATURE_INPUT: TEXT_ATMO_ENV_DATA_ALTITUDE_INPUT { + idc=130040; + y=0.265*safezoneH+safezoneY+0.440; + }; + class TEXT_ATMO_ENV_DATA_BAROMETRIC_PRESSURE: TEXT_ATMO_ENV_DATA_ALTITUDE { + idc=13005; + y=0.265*safezoneH+safezoneY+0.480; + text="Barom Pres (in.merc.)"; + }; + class TEXT_ATMO_ENV_DATA_BAROMETRIC_PRESSURE_INPUT: TEXT_ATMO_ENV_DATA_ALTITUDE_INPUT { + idc=130050; + y=0.265*safezoneH+safezoneY+0.480; + }; + class TEXT_ATMO_ENV_DATA_RELATIVE_HUMIDITY: TEXT_ATMO_ENV_DATA_ALTITUDE { + idc=13006; + y=0.265*safezoneH+safezoneY+0.520; + text="Relative Humidity (%)"; + }; + class TEXT_ATMO_ENV_DATA_RELATIVE_HUMIDITY_INPUT: TEXT_ATMO_ENV_DATA_ALTITUDE_INPUT { + idc=130060; + y=0.265*safezoneH+safezoneY+0.520; + }; + class TEXT_ATMO_ENV_DATA_DONE: TEXT_TARGET_SPEED_ASSIST_DONE { + idc=13007; + action=QUOTE(1 call FUNC(toggle_atmo_env_data)); + }; + class TEXT_ATMO_ENV_DATA_CANCEL: TEXT_TARGET_SPEED_ASSIST_CANCEL { + idc=13008; + action=QUOTE(0 call FUNC(toggle_atmo_env_data)); + }; + class TEXT_ATMO_ENV_DATA_PREV: TEXT_TARGET_SPEED_ASSIST_PREV { + idc=13009; + }; + class TEXT_ATMO_ENV_DATA_NEXT: TEXT_TARGET_SPEED_ASSIST_NEXT { + idc=13010; + }; + + class TEXT_TARGET_DATA_LATITUDE: TEXT_BORE_HEIGHT { + idc=14000; + w=0.22; + y=0.265*safezoneH+safezoneY+0.28; + text="Latitude"; + }; + class TEXT_TARGET_DATA_LATITUDE_INPUT: ATragMX_RscEdit { + idc=140000; + w=0.06; + x=0.550*safezoneW+safezoneX+0.335; + y=0.265*safezoneH+safezoneY+0.28; + }; + class TEXT_TARGET_DATA_DIR_OF_FIRE: TEXT_TARGET_DATA_LATITUDE { + idc=14001; + y=0.265*safezoneH+safezoneY+0.320; + text="Dir of Fire (deg from N)"; + }; + class TEXT_TARGET_DATA_DIR_OF_FIRE_INPUT: TEXT_TARGET_DATA_LATITUDE_INPUT { + idc=140010; + y=0.265*safezoneH+safezoneY+0.320; + }; + class TEXT_TARGET_DATA_WIND_SPEED: TEXT_TARGET_DATA_LATITUDE { + idc=14002; + y=0.265*safezoneH+safezoneY+0.360; + text="Wind Speed (m/s)"; + }; + class TEXT_TARGET_DATA_WIND_SPEED_INPUT_1: TEXT_TARGET_DATA_LATITUDE_INPUT { + idc=140020; + w=0.045; + x=0.550*safezoneW+safezoneX+0.300; + y=0.265*safezoneH+safezoneY+0.360; + }; + class TEXT_TARGET_DATA_WIND_SPEED_INPUT_2: TEXT_TARGET_DATA_LATITUDE_INPUT { + idc=140021; + w=0.045; + x=0.550*safezoneW+safezoneX+0.350; + y=0.265*safezoneH+safezoneY+0.360; + }; + class TEXT_TARGET_DATA_WIND_DIRECTION: TEXT_TARGET_DATA_LATITUDE { + idc=14003; + y=0.265*safezoneH+safezoneY+0.400; + text="Wind Direction (clock)"; + }; + class TEXT_TARGET_DATA_WIND_DIRECTION_INPUT: TEXT_TARGET_DATA_LATITUDE_INPUT { + idc=140030; + y=0.265*safezoneH+safezoneY+0.400; + }; + class TEXT_TARGET_DATA_INCLINATION_ANGLE: TEXT_TARGET_DATA_LATITUDE { + idc=14004; + y=0.265*safezoneH+safezoneY+0.440; + text="Inclination Angle"; + }; + class TEXT_TARGET_DATA_INCLINATION_ANGLE_INPUT_COSINE: TEXT_TARGET_DATA_LATITUDE_INPUT { + idc=140041; + w=0.045; + x=0.550*safezoneW+safezoneX+0.300; + y=0.265*safezoneH+safezoneY+0.440; + }; + class TEXT_TARGET_DATA_INCLINATION_ANGLE_INPUT_DEGREE: TEXT_TARGET_DATA_LATITUDE_INPUT { + idc=140040; + w=0.045; + x=0.550*safezoneW+safezoneX+0.350; + y=0.265*safezoneH+safezoneY+0.440; + }; + class TEXT_TARGET_DATA_TARGET_SPEED: TEXT_TARGET_DATA_LATITUDE { + idc=14005; + y=0.265*safezoneH+safezoneY+0.480; + text="Target Speed (m/s)"; + }; + class TEXT_TARGET_DATA_TARGET_SPEED_INPUT: TEXT_TARGET_DATA_LATITUDE_INPUT { + idc=140050; + y=0.265*safezoneH+safezoneY+0.480; + }; + class TEXT_TARGET_DATA_TARGET_RANGE: TEXT_TARGET_DATA_LATITUDE { + idc=14006; + y=0.265*safezoneH+safezoneY+0.520; + text="Target Range (meters)"; + }; + class TEXT_TARGET_DATA_TARGET_RANGE_INPUT: TEXT_TARGET_DATA_LATITUDE_INPUT { + idc=140060; + y=0.265*safezoneH+safezoneY+0.520; + }; + class TEXT_TARGET_DATA_DONE: TEXT_TARGET_SPEED_ASSIST_DONE { + idc=14008; + action=QUOTE(1 call FUNC(toggle_target_data)); + }; + class TEXT_TARGET_DATA_CANCEL: TEXT_TARGET_SPEED_ASSIST_CANCEL { + idc=14009; + action=QUOTE(0 call FUNC(toggle_target_data)); + }; + class TEXT_TARGET_DATA_PREV: TEXT_TARGET_SPEED_ASSIST_PREV { + idc=14010; + }; + class TEXT_TARGET_DATA_NEXT: TEXT_TARGET_SPEED_ASSIST_NEXT { + idc=14011; + }; }; }; \ No newline at end of file diff --git a/addons/atragmx/XEH_postInit.sqf b/addons/atragmx/XEH_postInit.sqf index 9d769d84a3..01b13fc85e 100644 --- a/addons/atragmx/XEH_postInit.sqf +++ b/addons/atragmx/XEH_postInit.sqf @@ -5,43 +5,44 @@ 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.630, 1, "ASM" ], + // 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, Bullet Diameter, Rifle Twist, 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, 12.7, 38.10, 0.630, 1, "ASM" ], - ["12.7x99mm AMAX" , 860, 100, 0.0612, -0.0008600, 3.81, 0, 0.338, 0.338, 120, 0, 0, 48.60, "B_127x99_Ball" , "5Rnd_mas_127x99_Stanag" , 1.050, 1, "ASM" ], - ["12.7x99mm" , 853, 100, 0.0623, -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.7x99mm AMAX" , 860, 100, 0.0612, -0.0008600, 3.81, 0, 0.338, 0.338, 120, 0, 0, 48.60, 12.7, 38.10, 1.050, 1, "ASM" ], + ["12.7x99mm" , 853, 100, 0.0623, -0.0008600, 3.81, 0, 0.338, 0.338, 120, 0, 0, 41.92, 12.7, 38.10, 0.670, 1, "ASM" ], - ["12.7x54mm" , 300, 100, 0.3394, -0.0014000, 3.81, 0, 0.338, 0.338, 120, 0, 0, 48.60, "B_127x54_Ball" , "10Rnd_127x54_Mag" , 1.050, 1, "ASM" ], + ["12.7x54mm" , 300, 100, 0.3394, -0.0014000, 3.81, 0, 0.338, 0.338, 120, 0, 0, 48.60, 12.7, 24.13, 1.050, 1, "ASM" ], - [".408 Chey Tac" , 910, 100, 0.0569, -0.0004800, 3.81, 0, 0.338, 0.338, 120, 0, 0, 27.15, "B_408_Ball" , "7Rnd_408_Mag" , 0.970, 1, "ASM" ], + [".408 Chey Tac" , 910, 100, 0.0569, -0.0004800, 3.81, 0, 0.338, 0.338, 120, 0, 0, 27.15, 10.4, 33.02, 0.970, 1, "ASM" ], - ["9.3×64mm" , 870, 100, 0.0619, -0.0007500, 3.81, 0, 0.338, 0.338, 120, 0, 0, 14.90, "B_93x64_Ball" , "10Rnd_93x64_DMR_05_Mag" , 0.368, 1, "ASM" ], + ["9.3×64mm" , 870, 100, 0.0619, -0.0007500, 3.81, 0, 0.338, 0.338, 120, 0, 0, 14.90, 9.30, 35.56, 0.368, 1, "ASM" ], - [".338LM 250gr" , 880, 100, 0.0598, -0.0006060, 3.81, 0, 0.338, 0.338, 120, 0, 0, 16.20, "B_338_Ball" , "10Rnd_338_Mag" , 0.322, 7, "ICAO"], - [".338LM 300gr" , 800, 100, 0.0677, -0.0005350, 3.81, 0, 0.338, 0.338, 120, 0, 0, 19.44, "ACE_338_Ball" , "ACE_10Rnd_338_300gr_HPBT_Mag" , 0.381, 7, "ICAO"], - [".338LM API526" , 880, 100, 0.0601, -0.0006730, 3.81, 0, 0.338, 0.338, 120, 0, 0, 16.39, "ACE_338_Ball_API526" , "ACE_10Rnd_338_API526_Mag" , 0.290, 7, "ICAO"], + [".338LM 250gr" , 880, 100, 0.0598, -0.0006060, 3.81, 0, 0.338, 0.338, 120, 0, 0, 16.20, 8.58, 25.40, 0.322, 7, "ICAO"], + [".338LM 300gr" , 800, 100, 0.0677, -0.0005350, 3.81, 0, 0.338, 0.338, 120, 0, 0, 19.44, 8.58, 25.40, 0.381, 7, "ICAO"], + [".338LM API526" , 880, 100, 0.0601, -0.0006730, 3.81, 0, 0.338, 0.338, 120, 0, 0, 16.39, 8.58, 25.40, 0.290, 7, "ICAO"], - [".300WM Mk248 Mod 0", 900, 100, 0.0584, -0.0008300, 3.81, 0, 0.338, 0.338, 120, 0, 0, 13.31, "ACE_762x67_Ball_Mk248_Mod_0" , "ACE_20Rnd_762x67_Mk248_Mod_0_Mag" , 0.268, 7, "ICAO"], - [".300WM Mk248 Mod 1", 867, 100, 0.0611, -0.0008150, 3.81, 0, 0.338, 0.338, 120, 0, 0, 14.26, "ACE_762x67_Ball_Mk248_Mod_1" , "ACE_20Rnd_762x67_Mk248_Mod_1_Mag" , 0.310, 7, "ICAO"], - [".300WM Berger OTM" , 853, 100, 0.0622, -0.0007600, 3.81, 0, 0.338, 0.338, 120, 0, 0, 14.90, "ACE_762x67_Ball_Berger_Hybrid_OTM", "ACE_20Rnd_762x67_Berger_Hybrid_OTM_Mag", 0.368, 7, "ICAO"], + [".300WM Mk248 Mod 0", 900, 100, 0.0584, -0.0008300, 3.81, 0, 0.338, 0.338, 120, 0, 0, 13.31, 7.80, 25.40, 0.268, 7, "ICAO"], + [".300WM Mk248 Mod 1", 867, 100, 0.0611, -0.0008150, 3.81, 0, 0.338, 0.338, 120, 0, 0, 14.26, 7.80, 25.40, 0.310, 7, "ICAO"], + [".300WM Berger OTM" , 853, 100, 0.0622, -0.0007600, 3.81, 0, 0.338, 0.338, 120, 0, 0, 14.90, 7.80, 25.40, 0.368, 7, "ICAO"], - ["7.62x54mmR" , 800, 100, 0.0692, -0.0010230, 3.81, 0, 0.338, 0.338, 120, 0, 0, 9.849, "B_762x54_Ball" , "10Rnd_762x54_Mag" , 0.400, 1, "ICAO"], + ["7.62x54mmR" , 800, 100, 0.0692, -0.0010230, 3.81, 0, 0.338, 0.338, 120, 0, 0, 9.849, 7.92, 24.13, 0.400, 1, "ICAO"], - ["7.62x51mm M80" , 810, 100, 0.0679, -0.0010350, 3.81, 0, 0.338, 0.338, 120, 0, 0, 9.525, "B_762x51_Ball" , "20Rnd_762x51_Mag" , 0.200, 7, "ICAO"], - ["7.62x51mm M118LR" , 820, 100, 0.0662, -0.0008525, 3.81, 0, 0.338, 0.338, 120, 0, 0, 11.34, "ACE_762x51_Ball_M118LR" , "ACE_20Rnd_762x51_M118LR_Mag" , 0.243, 7, "ICAO"], - ["7.62x51mm Mk319" , 820, 100, 0.0670, -0.0010300, 3.81, 0, 0.338, 0.338, 120, 0, 0, 8.424, "ACE_762x51_Ball_Mk319_Mod_0" , "ACE_20Rnd_762x51_Mk319_Mod_0_Mag" , 0.377, 1, "ICAO"], - ["7.62x51mm Subsonic", 320, 100, 0.3060, -0.0004910, 3.81, 0, 0.338, 0.338, 120, 0, 0, 12.96, "ACE_762x51_Ball_Subsonic" , "ACE_20Rnd_762x51_Mag_SD" , 0.235, 7, "ICAO"], + ["7.62x51mm M80" , 810, 100, 0.0679, -0.0010350, 3.81, 0, 0.338, 0.338, 120, 0, 0, 9.525, 7.82, 25.40, 0.200, 7, "ICAO"], + ["7.62x51mm M118LR" , 820, 100, 0.0662, -0.0008525, 3.81, 0, 0.338, 0.338, 120, 0, 0, 11.34, 7.82, 25.40, 0.243, 7, "ICAO"], + ["7.62x51mm Mk319" , 820, 100, 0.0670, -0.0010300, 3.81, 0, 0.338, 0.338, 120, 0, 0, 8.424, 7.82, 25.40, 0.377, 1, "ICAO"], + ["7.62x51mm Subsonic", 320, 100, 0.3060, -0.0004910, 3.81, 0, 0.338, 0.338, 120, 0, 0, 12.96, 7.82, 25.40, 0.235, 7, "ICAO"], - ["6.5x39mm" , 800, 100, 0.0683, -0.0007850, 3.81, 0, 0.338, 0.338, 120, 0, 0, 7.970, "B_65x39_Caseless" , "30Rnd_65x39_caseless_mag" , 0.263, 7, "ICAO"], - ["6.5x47mm Lapua" , 800, 100, 0.0682, -0.0007710, 3.81, 0, 0.338, 0.338, 120, 0, 0, 9.007, "ACE_65x47_Ball_Scenar" , "ACE_30Rnd_65x47_Scenar_mag" , 0.290, 7, "ICAO"], + ["6.5x39mm" , 800, 100, 0.0683, -0.0007850, 3.81, 0, 0.338, 0.338, 120, 0, 0, 7.970, 6.71, 22.86, 0.263, 7, "ICAO"], + ["6.5x47mm Lapua" , 800, 100, 0.0682, -0.0007710, 3.81, 0, 0.338, 0.338, 120, 0, 0, 9.007, 6.71, 22.86, 0.290, 7, "ICAO"], - ["5.56x45mm M855" , 870, 100, 0.0626, -0.0012650, 3.81, 0, 0.338, 0.338, 120, 0, 0, 4.018, "B_556x45_Ball" , "30Rnd_556x45_Stanag" , 0.151, 7, "ASM" ], - ["5.56x45mm Mk262" , 820, 100, 0.0671, -0.0011250, 3.81, 0, 0.338, 0.338, 120, 0, 0, 4.990, "ACE_556x45_Ball_Mk262" , "ACE_30Rnd_556x45_Stanag_Mk262_mag" , 0.361, 1, "ASM" ], - ["5.56x45mm Mk318" , 880, 100, 0.0616, -0.0011200, 3.81, 0, 0.338, 0.338, 120, 0, 0, 4.018, "ACE_556x45_Ball_Mk318" , "ACE_30Rnd_556x45_Stanag_Mk318_mag" , 0.307, 1, "ASM" ]]; + ["5.56x45mm M855" , 870, 100, 0.0626, -0.0012650, 3.81, 0, 0.338, 0.338, 120, 0, 0, 4.018, 5.70, 17.78, 0.151, 7, "ASM" ], + ["5.56x45mm Mk262" , 820, 100, 0.0671, -0.0011250, 3.81, 0, 0.338, 0.338, 120, 0, 0, 4.990, 5.70, 17.78, 0.361, 1, "ASM" ], + ["5.56x45mm Mk318" , 880, 100, 0.0616, -0.0011200, 3.81, 0, 0.338, 0.338, 120, 0, 0, 4.018, 5.70, 17.78, 0.307, 1, "ASM" ]]; profileNamespace setVariable ["ACE_ATragMX_gunList", GVAR(gunList)]; }; [] call FUNC(init); +[] call FUNC(restore_user_data); ["RangerfinderData", {_this call FUNC(sord)}] call EFUNC(common,addEventHandler); diff --git a/addons/atragmx/XEH_preInit.sqf b/addons/atragmx/XEH_preInit.sqf index 0224fc3e9c..10e0aff61c 100644 --- a/addons/atragmx/XEH_preInit.sqf +++ b/addons/atragmx/XEH_preInit.sqf @@ -13,35 +13,52 @@ PREP(can_show); PREP(change_gun); PREP(change_target_slot); PREP(create_dialog); +PREP(cycle_gun_list); +PREP(cycle_image_size_units); +PREP(cycle_num_ticks_units); PREP(cycle_range_card_columns); PREP(cycle_scope_unit); +PREP(cycle_target_size_units); PREP(delete_gun); PREP(init); PREP(parse_input); PREP(reset_relative_click_memory); +PREP(restore_atmo_default); +PREP(restore_user_data); PREP(save_gun); PREP(show_add_new_gun); +PREP(show_atmo_env_data); +PREP(show_gun_ammo_data); PREP(show_gun_list); PREP(show_main_page); PREP(show_range_card); PREP(show_range_card_setup); +PREP(show_target_data); PREP(show_target_range_assist); PREP(show_target_speed_assist); PREP(show_target_speed_assist_timer); PREP(sord); +PREP(store_user_data); PREP(target_speed_assist_timer); +PREP(toggle_atmo_env_data); +PREP(toggle_gun_ammo_data); PREP(toggle_gun_list); PREP(toggle_range_card); PREP(toggle_range_card_setup); +PREP(toggle_target_data); PREP(toggle_target_range_assist); PREP(toggle_target_speed_assist); PREP(update_atmosphere); +PREP(update_atmo_env_data); +PREP(update_atmo_selection); PREP(update_gun); +PREP(update_gun_ammo_data); PREP(update_range_card); PREP(update_relative_click_memory); PREP(update_result); PREP(update_scope_unit); PREP(update_target); +PREP(update_target_data); PREP(update_target_selection); PREP(update_unit_selection); PREP(update_zero_range); diff --git a/addons/atragmx/functions/fnc_calculate_range_card.sqf b/addons/atragmx/functions/fnc_calculate_range_card.sqf index aecd6496af..f506726be2 100644 --- a/addons/atragmx/functions/fnc_calculate_range_card.sqf +++ b/addons/atragmx/functions/fnc_calculate_range_card.sqf @@ -20,43 +20,64 @@ private ["_scopeBaseAngle"]; _scopeBaseAngle = (GVAR(workingMemory) select 3); -private ["_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel"]; +private ["_bulletMass", "_bulletDiameter", "_boreHeight", "_airFriction", "_barrelTwist", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel", "_twistDirection"]; _bulletMass = GVAR(workingMemory) select 12; +_bulletDiameter = GVAR(workingMemory) select 13; _boreHeight = GVAR(workingMemory) select 5; _airFriction = GVAR(workingMemory) select 4; +_barrelTwist = GVAR(workingMemory) select 14; _muzzleVelocity = GVAR(workingMemory) select 1; _bc = GVAR(workingMemory) select 15; _dragModel = GVAR(workingMemory) select 16; _atmosphereModel = GVAR(workingMemory) select 17; -private ["_temperature", "_barometricPressure", "_relativeHumidity"]; +_twistDirection = 0; +if (_barrelTwist > 0) then { + _twistDirection = 1; +} else { + if (_barrelTwist < 0) then { + _twistDirection = -1; + }; +}; +_barrelTwist = abs(_barrelTwist); + +private ["_altitude", "_temperature", "_barometricPressure", "_relativeHumidity"]; +_altitude = GVAR(altitude); _temperature = GVAR(temperature); _barometricPressure = GVAR(barometricPressure); _relativeHumidity = GVAR(relativeHumidity); -if (GVAR(currentUnit) == 1) then -{ - _temperature = (_temperature - 32) / 1.8; - _barometricPressure = _barometricPressure * 33.8638866667; +if (!GVAR(atmosphereModeTBH)) then { + _barometricPressure = 1013.25 * exp(-(_altitude) / 7990); + _relativeHumidity = 50; }; -private ["_windSpeed", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange"]; -_windSpeed = (GVAR(windSpeed) select GVAR(currentTarget)); +private ["_bulletLength", "_stabilityFactor"]; +_bulletLength = 1.8; +_stabilityFactor = 1.5; +if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false])) then { + if (_bulletDiameter > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then { + _stabilityFactor = [_bulletDiameter / 10 / 2.54, _bulletLength, _bulletMass * 15.4323584, _barrelTwist / 2.54, _muzzleVelocity, _temperature, _barometricPressure] call EFUNC(advanced_ballistics,calculateStabilityFactor); + }; +}; + +private ["_latitude", "_directionOfFire", "_windSpeed", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange"]; +_latitude = GVAR(latitude) select GVAR(currentTarget); +_directionOfFire = GVAR(directionOfFire) select GVAR(currentTarget); +_windSpeed = (GVAR(windSpeed1) 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 -{ +if (GVAR(currentUnit) != 2) then { _windSpeed = _windSpeed / 2.23693629; _targetSpeed = _targetSpeed / 2.23693629; }; +if (GVAR(currentUnit) == 1) then { + _targetRange = _targetRange / 1.0936133; +}; 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); + _windSpeed, _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, true, _stabilityFactor, _twistDirection, _latitude] call FUNC(calculate_solution); diff --git a/addons/atragmx/functions/fnc_calculate_scope_base_angle.sqf b/addons/atragmx/functions/fnc_calculate_scope_base_angle.sqf index 17370c82b2..4995c31a61 100644 --- a/addons/atragmx/functions/fnc_calculate_scope_base_angle.sqf +++ b/addons/atragmx/functions/fnc_calculate_scope_base_angle.sqf @@ -35,6 +35,6 @@ _barometricPressure = 1013.25; _relativeHumidity = 0; private ["_result"]; -_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, 0, 0, 0, 0, _zeroRange, _airFriction, 1, "ICAO", false] call FUNC(calculate_solution); +_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, 0, 0, 0, 0, _zeroRange, _airFriction, 1, "ICAO", false, 1.5, 0, 0] call FUNC(calculate_solution); _scopeBaseAngle + (_result select 0) / 60 diff --git a/addons/atragmx/functions/fnc_calculate_solution.sqf b/addons/atragmx/functions/fnc_calculate_solution.sqf index 4e7f5981c1..f7f23044e3 100644 --- a/addons/atragmx/functions/fnc_calculate_solution.sqf +++ b/addons/atragmx/functions/fnc_calculate_solution.sqf @@ -21,6 +21,9 @@ * 15: drag model * 16: atmosphere model * 17: Store range card data? + * 18: Stability factor + * 19: Twist Direction + * 20: Latitude * * Return Value: * 0: Elevation @@ -28,7 +31,10 @@ * 2: Lead * 3: Time of fligth * 4: Remaining velocity - * 4: Remaining kinetic energy + * 5: Remaining kinetic energy + * 6: Vertical coriolis drift + * 7: Horizontal coriolis drift + * 8: Spin drift * * Example: * call ace_atragmx_calculate_target_range_assist @@ -37,7 +43,7 @@ */ #include "script_component.hpp" -private ["_scopeBaseAngle", "_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_temperature", "_barometricPressure", "_relativeHumidity", "_simSteps", "_windSpeed", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange", "_bc", "_dragModel", "_atmosphereModel", "_storeRangeCardData"]; +private ["_scopeBaseAngle", "_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_temperature", "_barometricPressure", "_relativeHumidity", "_simSteps", "_windSpeed", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange", "_bc", "_dragModel", "_atmosphereModel", "_storeRangeCardData", "_stabilityFactor", "_twistDirection", "_latitude"]; _scopeBaseAngle = _this select 0; _bulletMass = _this select 1; _boreHeight = _this select 2; @@ -56,6 +62,9 @@ _bc = _this select 14; _dragModel = _this select 15; _atmosphereModel = _this select 16; _storeRangeCardData = _this select 17; +_stabilityFactor = _this select 18; +_twistDirection = _this select 19; +_latitude = _this select 20; private ["_bulletPos", "_bulletVelocity", "_bulletAccel", "_bulletSpeed", "_gravity", "_deltaT"]; _bulletPos = [0, 0, 0]; @@ -65,20 +74,26 @@ _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"]; +private ["_elevation", "_windage", "_lead", "_TOF", "_trueVelocity", "_trueSpeed", "_kineticEnergy", "_verticalCoriolis", "_verticalDeflection", "_horizontalCoriolis", "_horizontalDeflection", "_spinDrift", "_spinDeflection"]; _elevation = 0; _windage = 0; _lead = 0; _TOF = 0; _trueVelocity = [0, 0, 0]; _trueSpeed = 0; +_verticalCoriolis = 0; +_verticalDeflection = 0; +_horizontalCoriolis = 0; +_horizontalDeflection = 0; +_spinDrift = 0; +_spinDeflection = 0; private ["_n", "_range", "_rangeFactor"]; _n = 0; _range = 0; _rangeFactor = 1; if (_storeRangeCardData) then { - if (GVAR(currentUnit) != 2) then { + if (GVAR(currentUnit) == 1) then { _rangeFactor = 1.0936133; }; GVAR(rangeCardData) = []; @@ -90,6 +105,11 @@ if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) _bc = [_bc, _temperature, _barometricPressure, _relativeHumidity, _atmosphereModel] call EFUNC(advanced_ballistics,calculateAtmosphericCorrection); }; +private ["_speedTotal", "_stepsTotal", "_speedAverage"]; +_speedTotal = 0; +_stepsTotal = 0; +_speedAverage = 0; + _TOF = 0; _bulletPos set [0, 0]; @@ -102,6 +122,10 @@ _bulletVelocity set [2, Sin(_scopeBaseAngle) * _muzzleVelocity]; while {_TOF < 15 && (_bulletPos select 1) < _targetRange} do { _bulletSpeed = vectorMagnitude _bulletVelocity; + + _speedTotal = _speedTotal + _bulletSpeed; + _stepsTotal = _stepsTotal + 1; + _speedAverage = (_speedTotal / _stepsTotal); _trueVelocity = _bulletVelocity vectorDiff _wind; _trueSpeed = vectorMagnitude _trueVelocity; @@ -139,7 +163,22 @@ while {_TOF < 15 && (_bulletPos select 1) < _targetRange} do { }; _kineticEnergy = 0.5 * (_bulletMass / 1000 * (_bulletSpeed ^ 2)); _kineticEnergy = _kineticEnergy * 0.737562149; - + + if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,CoriolisEnabled), false])) then { + if ((_bulletPos select 1) > 0) then { + _horizontalDeflection = 0.0000729 * ((_bulletPos select 0) ^ 2) * sin(_latitude) / _speedAverage; + _horizontalCoriolis = - atan(_horizontalDeflection / (_bulletPos select 1)); + _windage = _windage + _horizontalCoriolis; + }; + }; + if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false])) then { + if ((_bulletPos select 1) > 0) then { + _spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83; + _spinDrift = - atan(_spinDeflection / (_bulletPos select 1)); + _windage = _windage + _spinDrift; + }; + }; + GVAR(rangeCardData) set [_n, [_range, _elevation * 60, _windage * 60, _lead, _TOF, _bulletSpeed, _kineticEnergy]]; _n = _n + 1; }; @@ -158,4 +197,19 @@ if (_targetRange != 0) then { _kineticEnergy = 0.5 * (_bulletMass / 1000 * (_bulletSpeed ^ 2)); _kineticEnergy = _kineticEnergy * 0.737562149; -[_elevation * 60, _windage * 60, _lead, _TOF, _bulletSpeed, _kineticEnergy] +if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,CoriolisEnabled), false])) then { + if ((_bulletPos select 1) > 0) then { + _horizontalDeflection = 0.0000729 * ((_bulletPos select 0) ^ 2) * sin(_latitude) / _speedAverage; + _horizontalCoriolis = - atan(_horizontalDeflection / (_bulletPos select 1)); + _windage = _windage + _horizontalCoriolis; + }; +}; +if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false])) then { + if ((_bulletPos select 1) > 0) then { + _spinDeflection = _twistDirection * 0.0254 * 1.25 * (_stabilityFactor + 1.2) * _TOF ^ 1.83; + _spinDrift = - atan(_spinDeflection / (_bulletPos select 1)); + _windage = _windage + _spinDrift; + }; +}; + +[_elevation * 60, _windage * 60, _lead, _TOF, _bulletSpeed, _kineticEnergy, _verticalCoriolis, _horizontalCoriolis, _spinDrift] diff --git a/addons/atragmx/functions/fnc_calculate_target_range_assist.sqf b/addons/atragmx/functions/fnc_calculate_target_range_assist.sqf index 6280f19339..91eb9ae20c 100644 --- a/addons/atragmx/functions/fnc_calculate_target_range_assist.sqf +++ b/addons/atragmx/functions/fnc_calculate_target_range_assist.sqf @@ -46,7 +46,7 @@ switch (GVAR(rangeAssistImageSizeUnit)) do { }; }; _estRange = parseNumber(ctrlText 7013); -if (GVAR(currentUnit) != 2) then { +if (GVAR(currentUnit) == 1) then { _estRange = _estRange / 1.0936133; }; diff --git a/addons/atragmx/functions/fnc_calculate_target_solution.sqf b/addons/atragmx/functions/fnc_calculate_target_solution.sqf index 3f4c92c191..f6dd92bc7f 100644 --- a/addons/atragmx/functions/fnc_calculate_target_solution.sqf +++ b/addons/atragmx/functions/fnc_calculate_target_solution.sqf @@ -20,44 +20,65 @@ private ["_scopeBaseAngle"]; _scopeBaseAngle = (GVAR(workingMemory) select 3); -private ["_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel"]; +private ["_bulletMass", "_bulletDiameter", "_boreHeight", "_airFriction", "_barrelTwist", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel", "_twistDirection"]; _bulletMass = GVAR(workingMemory) select 12; +_bulletDiameter = GVAR(workingMemory) select 13; _boreHeight = GVAR(workingMemory) select 5; _airFriction = GVAR(workingMemory) select 4; +_barrelTwist = GVAR(workingMemory) select 14; _muzzleVelocity = GVAR(workingMemory) select 1; _bc = GVAR(workingMemory) select 15; _dragModel = GVAR(workingMemory) select 16; _atmosphereModel = GVAR(workingMemory) select 17; -private ["_temperature", "_barometricPressure", "_relativeHumidity"]; +_twistDirection = 0; +if (_barrelTwist > 0) then { + _twistDirection = 1; +} else { + if (_barrelTwist < 0) then { + _twistDirection = -1; + }; +}; +_barrelTwist = abs(_barrelTwist); + +private ["_altitude", "_temperature", "_barometricPressure", "_relativeHumidity"]; +_altitude = GVAR(altitude); _temperature = GVAR(temperature); _barometricPressure = GVAR(barometricPressure); _relativeHumidity = GVAR(relativeHumidity); -if (GVAR(currentUnit) == 1) then -{ - _temperature = (_temperature - 32) / 1.8; - _barometricPressure = _barometricPressure * 33.8638866667; +if (!GVAR(atmosphereModeTBH)) then { + _barometricPressure = 1013.25 * exp(-(_altitude) / 7990); + _relativeHumidity = 50; }; -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; +private ["_bulletLength", "_stabilityFactor"]; +_bulletLength = 1.8; +_stabilityFactor = 1.5; +if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,SpinDriftEnabled), false])) then { + if (_bulletDiameter > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then { + _stabilityFactor = [_bulletDiameter / 10 / 2.54, _bulletLength, _bulletMass * 15.4323584, _barrelTwist / 2.54, _muzzleVelocity, _temperature, _barometricPressure] call EFUNC(advanced_ballistics,calculateStabilityFactor); + }; }; -if (GVAR(currentUnit) == 1) then -{ + +private ["_latitude", "_directionOfFire", "_windSpeed", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange"]; +_latitude = GVAR(latitude) select GVAR(currentTarget); +_directionOfFire = GVAR(directionOfFire) select GVAR(currentTarget); +_windSpeed = GVAR(windSpeed1) 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 { _windSpeed = _windSpeed / 2.23693629; _targetSpeed = _targetSpeed / 2.23693629; }; +if (GVAR(currentUnit) == 1) then { + _targetRange = _targetRange / 1.0936133; +}; private ["_result"]; _result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, - _windSpeed, _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, false] call FUNC(calculate_solution); + _windSpeed, _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, false, _stabilityFactor, _twistDirection, _latitude] call FUNC(calculate_solution); GVAR(elevationOutput) set [GVAR(currentTarget), _result select 0]; GVAR(windageOutput) set [GVAR(currentTarget), _result select 1]; diff --git a/addons/atragmx/functions/fnc_calculate_target_speed_assist.sqf b/addons/atragmx/functions/fnc_calculate_target_speed_assist.sqf index 7ee7e9ff78..d055af5a71 100644 --- a/addons/atragmx/functions/fnc_calculate_target_speed_assist.sqf +++ b/addons/atragmx/functions/fnc_calculate_target_speed_assist.sqf @@ -22,34 +22,27 @@ _numTicks = parseNumber(ctrlText 8005); _timeSecs = parseNumber(ctrlText 8006); _estSpeed = 0; -if (GVAR(currentUnit) != 2) then -{ +if (GVAR(currentUnit) == 1) then { _targetRange = _targetRange / 1.0936133; }; -switch (GVAR(rangeAssistImageSizeUnit)) do -{ - case 0: - { +switch (GVAR(rangeAssistImageSizeUnit)) do { + case 0: { _numTicks = _numTicks / 6400 * 360; }; - case 1: - { + case 1: { _numTicks = _numTicks / 60; }; - case 2: - { + case 2: { _numTicks = _numTicks / 60 / 1.047; }; }; -if (_timeSecs > 0) then -{ +if (_timeSecs > 0) then { _estSpeed = tan(_numTicks) * _targetRange / _timeSecs; }; -if (GVAR(currentUnit) == 1) then -{ +if (GVAR(currentUnit) != 2) then { _estSpeed = _estSpeed * 2.23693629; }; diff --git a/addons/atragmx/functions/fnc_change_gun.sqf b/addons/atragmx/functions/fnc_change_gun.sqf index 520e4e85be..9b0f18c185 100644 --- a/addons/atragmx/functions/fnc_change_gun.sqf +++ b/addons/atragmx/functions/fnc_change_gun.sqf @@ -4,6 +4,7 @@ * * Arguments: * gunID + * update solution * * Return Value: * Nothing @@ -15,19 +16,23 @@ */ #include "script_component.hpp" -if (_this < 0 || _this > (count GVAR(gunList)) - 1) exitWith {}; +private ["_gunID", "_updateSolution"]; +_gunID = _this select 0; +_updateSolution = _this select 1; -GVAR(workingMemory) = +(GVAR(gunList) select _this); -GVAR(currentGun) = _this; +if (_gunID < 0 || _gunID > (count GVAR(gunList)) - 1) exitWith {}; + +GVAR(workingMemory) = +(GVAR(gunList) select _gunID); +GVAR(currentGun) = _gunID; lbSetCurSel [6000, GVAR(currentGun)]; -if ((GVAR(scopeUnits) select GVAR(currentScopeUnit)) != "Clicks") then -{ +if ((GVAR(scopeUnits) select GVAR(currentScopeUnit)) != "Clicks") then { GVAR(currentScopeUnit) = GVAR(workingMemory) select 6; }; [] call FUNC(update_gun); +[] call FUNC(update_gun_ammo_data); GVAR(elevationOutput) set [GVAR(currentTarget), 0]; GVAR(windageOutput) set [GVAR(currentTarget), 0]; @@ -35,4 +40,6 @@ GVAR(leadOutput) set [GVAR(currentTarget), 0]; GVAR(tofOutput) set [GVAR(currentTarget), 0]; GVAR(velocityOutput) set [GVAR(currentTarget), 0]; -[] call FUNC(calculate_target_solution); +if (_updateSolution) then { + [] call FUNC(calculate_target_solution); +}; diff --git a/addons/atragmx/functions/fnc_change_target_slot.sqf b/addons/atragmx/functions/fnc_change_target_slot.sqf index 6e6951c6bf..ed8c622b8d 100644 --- a/addons/atragmx/functions/fnc_change_target_slot.sqf +++ b/addons/atragmx/functions/fnc_change_target_slot.sqf @@ -23,4 +23,4 @@ call FUNC(parse_input); GVAR(currentTarget) = _target; call FUNC(update_target_selection); -call FUNC(calculate_target_solution); +[] call FUNC(calculate_target_solution); diff --git a/addons/atragmx/functions/fnc_create_dialog.sqf b/addons/atragmx/functions/fnc_create_dialog.sqf index 59ec3528af..5be6e4ecb4 100644 --- a/addons/atragmx/functions/fnc_create_dialog.sqf +++ b/addons/atragmx/functions/fnc_create_dialog.sqf @@ -26,6 +26,8 @@ call FUNC(update_target_selection); GVAR(showMainPage) call FUNC(show_main_page); GVAR(showAddNewGun) call FUNC(show_add_new_gun); +GVAR(showAtmoEnvData) call FUNC(show_atmo_env_data); +GVAR(showGunAmmoData) call FUNC(show_gun_ammo_data); GVAR(showGunList) call FUNC(show_gun_list); GVAR(showRangeCard) call FUNC(show_range_card); if (GVAR(showRangeCard)) then { @@ -33,6 +35,7 @@ if (GVAR(showRangeCard)) then { [] call FUNC(update_range_card); }; GVAR(showRangeCardSetup) call FUNC(show_range_card_setup); +GVAR(showTargetData) call FUNC(show_target_data); GVAR(showTargetRangeAssist) call FUNC(show_target_range_assist); GVAR(showTargetSpeedAssist) call FUNC(show_target_speed_assist); GVAR(showTargetSpeedAssistTimer) call FUNC(show_target_speed_assist_timer); diff --git a/addons/atragmx/functions/fnc_cycle_gun_list.sqf b/addons/atragmx/functions/fnc_cycle_gun_list.sqf new file mode 100644 index 0000000000..3d4bef70c1 --- /dev/null +++ b/addons/atragmx/functions/fnc_cycle_gun_list.sqf @@ -0,0 +1,18 @@ +/* + * Author: Ruthberg + * Cycles through the gun list + * + * Arguments: + * step + * + * Return Value: + * Nothing + * + * Example: + * call ace_atragmx_cycle_scope_unit + * + * Public: No + */ +#include "script_component.hpp" + +[(GVAR(currentGun) + (count GVAR(gunList)) + _this) % (count GVAR(gunList)), true] call FUNC(change_gun); diff --git a/addons/atragmx/functions/fnc_cycle_image_size_units.sqf b/addons/atragmx/functions/fnc_cycle_image_size_units.sqf new file mode 100644 index 0000000000..d78b13731c --- /dev/null +++ b/addons/atragmx/functions/fnc_cycle_image_size_units.sqf @@ -0,0 +1,19 @@ +/* + * Author: Ruthberg + * Cycles through the image size units + * + * Arguments: + * step + * + * Return Value: + * Nothing + * + * Example: + * call ace_atragmx_cycle_image_size_units + * + * Public: No + */ +#include "script_component.hpp" + +GVAR(rangeAssistImageSizeUnit) = (GVAR(rangeAssistImageSizeUnit) + 1) % (count GVAR(rangeAssistImageSizeUnits)); +ctrlSetText [7015, GVAR(rangeAssistImageSizeUnits) select GVAR(rangeAssistImageSizeUnit)]; diff --git a/addons/atragmx/functions/fnc_cycle_num_ticks_units.sqf b/addons/atragmx/functions/fnc_cycle_num_ticks_units.sqf new file mode 100644 index 0000000000..6afc105f62 --- /dev/null +++ b/addons/atragmx/functions/fnc_cycle_num_ticks_units.sqf @@ -0,0 +1,20 @@ +/* + * Author: Ruthberg + * Cycles through the num ticks units + * + * Arguments: + * step + * + * Return Value: + * Nothing + * + * Example: + * call ace_atragmx_cycle_num_ticks_units + * + * Public: No + */ +#include "script_component.hpp" + +GVAR(speedAssistNumTicksUnit) = (GVAR(speedAssistNumTicksUnit) + 1) % (count GVAR(speedAssistNumTicksUnits)); +ctrlSetText [8009, GVAR(speedAssistNumTicksUnits) select GVAR(speedAssistNumTicksUnit)]; +call FUNC(calculate_target_speed_assist); diff --git a/addons/atragmx/functions/fnc_cycle_target_size_units.sqf b/addons/atragmx/functions/fnc_cycle_target_size_units.sqf new file mode 100644 index 0000000000..e055c8282c --- /dev/null +++ b/addons/atragmx/functions/fnc_cycle_target_size_units.sqf @@ -0,0 +1,19 @@ +/* + * Author: Ruthberg + * Cycles through the target size units + * + * Arguments: + * step + * + * Return Value: + * Nothing + * + * Example: + * call ace_atragmx_cycle_target_size_units + * + * Public: No + */ +#include "script_component.hpp" + +GVAR(rangeAssistTargetSizeUnit) = (GVAR(rangeAssistTargetSizeUnit) + 1) % (count GVAR(rangeAssistTargetSizeUnits)); +ctrlSetText [7014, GVAR(rangeAssistTargetSizeUnits) select GVAR(rangeAssistTargetSizeUnit)]; diff --git a/addons/atragmx/functions/fnc_init.sqf b/addons/atragmx/functions/fnc_init.sqf index 8fda3570fa..efbd39ef81 100644 --- a/addons/atragmx/functions/fnc_init.sqf +++ b/addons/atragmx/functions/fnc_init.sqf @@ -9,7 +9,7 @@ * Nothing * * Example: - * call ace_atragmx_init + * call ace_atragmx_fnc_init * * Public: No */ @@ -26,7 +26,7 @@ GVAR(rangeCardLastColumns) = ["Lead", "RemV", "RemE", "TmFlt"]; GVAR(rangeCardCurrentColumn) = 3; GVAR(rangeCardData) = []; -GVAR(GVAR(rangeAssistTargetSizeUnit)s) = ["in", "ft", "cm", "m"]; +GVAR(rangeAssistTargetSizeUnits) = ["in", "ft", "cm", "m"]; GVAR(rangeAssistTargetSizeUnit) = 2; GVAR(rangeAssistImageSizeUnits) = ["MIL", "TMOA", "IOA"]; GVAR(rangeAssistImageSizeUnit) = 0; @@ -41,11 +41,16 @@ GVAR(currentGun) = 0; GVAR(currentTarget) = 0; GVAR(currentScopeUnit) = 0; +GVAR(atmosphereModeTBH) = true; +GVAR(altitude) = 0; GVAR(temperature) = 15; GVAR(barometricPressure) = 1013.25; GVAR(relativeHumidity) = 0.5; -GVAR(windSpeed) = [0, 0, 0, 0]; +GVAR(latitude) = [38, 38, 38, 38]; +GVAR(directionOfFire) = [0, 0, 0, 0]; +GVAR(windSpeed1) = [0, 0, 0, 0]; +GVAR(windSpeed2) = [0, 0, 0, 0]; GVAR(windDirection) = [12, 12, 12, 12]; GVAR(inclinationAngle) = [0, 0, 0, 0]; GVAR(targetSpeed) = [0, 0, 0, 0]; @@ -59,10 +64,12 @@ GVAR(velocityOutput) = [0, 0, 0, 0]; GVAR(showMainPage) = true; GVAR(showAddNewGun) = false; +GVAR(showAtmoEnvData) = false; +GVAR(showGunAmmoData) = false; GVAR(showGunList) = false; GVAR(showRangeCard) = false; GVAR(showRangeCardSetup) = false; +GVAR(showTargetData) = false; GVAR(showTargetRangeAssist) = false; GVAR(showTargetSpeedAssist) = false; GVAR(showTargetSpeedAssistTimer) = false; - diff --git a/addons/atragmx/functions/fnc_parse_input.sqf b/addons/atragmx/functions/fnc_parse_input.sqf index 7d364cbdfc..be91ecc593 100644 --- a/addons/atragmx/functions/fnc_parse_input.sqf +++ b/addons/atragmx/functions/fnc_parse_input.sqf @@ -15,64 +15,78 @@ */ #include "script_component.hpp" -GVAR(temperature) = parseNumber(ctrlText 200); -GVAR(barometricPressure) = 0 max parseNumber(ctrlText 210); -GVAR(relativeHumidity) = (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; +GVAR(altitude) = -1000 max parseNumber(ctrlText 130030) min 20000; +GVAR(temperature) = -50 max parseNumber(ctrlText 130040) min 160; +GVAR(barometricPressure) = 0 max parseNumber(ctrlText 130050) min 1350; +GVAR(relativeHumidity) = (0 max parseNumber(ctrlText 130060) min 100) / 100; +if (GVAR(currentUnit) == 1) then { + GVAR(altitude) = GVAR(altitude) * 0.3048; + GVAR(temperature) = (GVAR(temperature) - 32) / 1.8; + GVAR(barometricPressure) = GVAR(barometricPressure) * 33.86389; }; -_muzzleVelocity = parseNumber(ctrlText 130); -if (GVAR(currentUnit) == 1) then -{ + +GVAR(latitude) set [GVAR(currentTarget), -90 max Round(parseNumber(ctrlText 140000)) min 90]; +GVAR(directionOfFire) set [GVAR(currentTarget), 0 max abs(Round(parseNumber(ctrlText 140010))) min 359]; +GVAR(windSpeed1) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 140020)) min 50]; +GVAR(windSpeed2) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 140021)) min 50]; +GVAR(windDirection) set [GVAR(currentTarget), 1 max Round(parseNumber(ctrlText 140030)) min 12]; +GVAR(inclinationAngle) set [GVAR(currentTarget), -60 max parseNumber(ctrlText 140040) min 60]; +GVAR(targetSpeed) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 140050)) min 50]; +GVAR(targetRange) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 140060)) min 4000]; + +private ["_boreHeight", "_bulletMass", "_bulletDiameter", "_airFriction", "_rifleTwist", "_muzzleVelocity", "_zeroRange"]; +_boreHeight = parseNumber(ctrlText 120000); +_bulletMass = parseNumber(ctrlText 120010); +_bulletDiameter = parseNumber(ctrlText 120020); +if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then { + _airFriction = 0.1 max parseNumber(ctrlText 120030) min 2; +} else { + _airFriction = parseNumber(ctrlText 120030) / -1000; +}; +_rifleTwist = parseNumber(ctrlText 120040); +_muzzleVelocity = parseNumber(ctrlText 120050); +_zeroRange = parseNumber (ctrlText 120060); +if (GVAR(currentUnit) != 2) then { _boreHeight = _boreHeight * 2.54; _bulletMass = _bulletMass * 0.06479891; + _bulletDiameter = _bulletDiameter * 10 * 2.54; + _rifleTwist = _rifleTwist * 2.54; _muzzleVelocity = _muzzleVelocity / 3.2808399; }; +if (GVAR(currentUnit) == 1) then { + _zeroRange = _zeroRange / 1.0936133; +}; _boreHeight = 0.1 max _boreHeight min 10; _bulletMass = 1 max _bulletMass min 100; +_bulletDiameter = 1 max _bulletDiameter min 25; _muzzleVelocity = 100 max _muzzleVelocity min 1400; - +_zeroRange = 0 max _zeroRange min 1000; GVAR(workingMemory) set [5, _boreHeight]; GVAR(workingMemory) set [12, _bulletMass]; +GVAR(workingMemory) set [13, _bulletDiameter]; +GVAR(workingMemory) set [14, _rifleTwist]; if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then { GVAR(workingMemory) set [15, _airFriction]; } else { GVAR(workingMemory) set [4, _airFriction]; }; GVAR(workingMemory) set [1, _muzzleVelocity]; +GVAR(workingMemory) set [2, _zeroRange]; private ["_elevationCur", "_windageCur", "_elevationScopeStep", "_windageScopeStep"]; _elevationCur = parseNumber(ctrlText 402); _windageCur = parseNumber(ctrlText 412); -switch (GVAR(currentScopeUnit)) do -{ - case 0: - { +switch (GVAR(currentScopeUnit)) do { + case 0: { _elevationCur = _elevationCur * 3.38; _windageCur = _windageCur * 3.38; }; - - case 2: - { + case 2: { _elevationCur = _elevationCur / 1.047; _windageCur = _windageCur / 1.047; }; - - case 3: - { + case 3: { _elevationScopeStep = (GVAR(workingMemory) select 7); _windageScopeStep = (GVAR(workingMemory) select 8); @@ -85,5 +99,9 @@ GVAR(workingMemory) set [10, _elevationCur]; GVAR(workingMemory) set [11, _windageCur]; [] call FUNC(update_gun); +[] call FUNC(update_gun_ammo_data); [] call FUNC(update_atmosphere); +[] call FUNC(update_atmo_env_data); [] call FUNC(update_target); + +[] call FUNC(store_user_data); diff --git a/addons/atragmx/functions/fnc_restore_atmo_default.sqf b/addons/atragmx/functions/fnc_restore_atmo_default.sqf new file mode 100644 index 0000000000..08b7c56d86 --- /dev/null +++ b/addons/atragmx/functions/fnc_restore_atmo_default.sqf @@ -0,0 +1,25 @@ +/* + * Author: Ruthberg + * Restores the atmospheric data defaults + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * call ace_atragmx_fnc_restore_atmo_default + * + * Public: No + */ +#include "script_component.hpp" + +GVAR(atmosphereModeTBH) = true; +GVAR(altitude) = 0; +GVAR(temperature) = 15; +GVAR(barometricPressure) = 1013.25; +GVAR(relativeHumidity) = 0.5; + +[] call FUNC(update_atmo_selection); +[] call FUNC(update_atmosphere); diff --git a/addons/atragmx/functions/fnc_restore_user_data.sqf b/addons/atragmx/functions/fnc_restore_user_data.sqf new file mode 100644 index 0000000000..7c011198d6 --- /dev/null +++ b/addons/atragmx/functions/fnc_restore_user_data.sqf @@ -0,0 +1,36 @@ +/* + * Author: Ruthberg + * Reads user data from profileNamespace + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * call ace_atragmx_fnc_restore_user_data + * + * Public: No + */ +#include "script_component.hpp" + +GVAR(currentUnit) = 0 max (profileNamespace getVariable ["ACE_ATragMX_currentUnit", 2]) min 2; +[profileNamespace getVariable ["ACE_ATragMX_currentGun", 0], false] call FUNC(change_gun); +GVAR(currentTarget) = 0 max (profileNamespace getVariable ["ACE_ATragMX_currentTarget", 0]) min 3; +GVAR(currentScopeUnit) = 0 max (profileNamespace getVariable ["ACE_ATragMX_currentScopeUnit", 0]) min 3; + +GVAR(atmosphereModeTBH) = profileNamespace getVariable ["ACE_ATragMX_atmosphereModeTBH", true]; +GVAR(altitude) = -1000 max (profileNamespace getVariable ["ACE_ATragMX_altitude", 0]) min 20000; +GVAR(temperature) = -50 max (profileNamespace getVariable ["ACE_ATragMX_temperature", 15]) min 160; +GVAR(barometricPressure) = 340 max (profileNamespace getVariable ["ACE_ATragMX_barometricPressure", 1013.25]) min 1350; +GVAR(relativeHumidity) = 0 max (profileNamespace getVariable ["ACE_ATragMX_relativeHumidity", 0.5]) min 1; + +GVAR(latitude) = profileNamespace getVariable ["ACE_ATragMX_latitude", [38, 38, 38, 38]]; +GVAR(directionOfFire) = profileNamespace getVariable ["ACE_ATragMX_directionOfFire", [0, 0, 0, 0]]; +GVAR(windSpeed1) = profileNamespace getVariable ["ACE_ATragMX_windSpeed1", [0, 0, 0, 0]]; +GVAR(windSpeed2) = profileNamespace getVariable ["ACE_ATragMX_windSpeed2", [0, 0, 0, 0]]; +GVAR(windDirection) = profileNamespace getVariable ["ACE_ATragMX_windDirection", [12, 12, 12, 12]]; +GVAR(inclinationAngle) = profileNamespace getVariable ["ACE_ATragMX_inclinationAngle", [0, 0, 0, 0]]; +GVAR(targetSpeed) = profileNamespace getVariable ["ACE_ATragMX_targetSpeed", [0, 0, 0, 0]]; +GVAR(targetRange) = profileNamespace getVariable ["ACE_ATragMX_targetRange", [0, 0, 0, 0]]; diff --git a/addons/atragmx/functions/fnc_show_atmo_env_data.sqf b/addons/atragmx/functions/fnc_show_atmo_env_data.sqf new file mode 100644 index 0000000000..9386956067 --- /dev/null +++ b/addons/atragmx/functions/fnc_show_atmo_env_data.sqf @@ -0,0 +1,25 @@ +/* + * Author: Ruthberg + * Shows/Hides the atmosphere and environmental data controls + * + * Arguments: + * visible - + * + * Return Value: + * Nothing + * + * Example: + * false call ace_atragmx_fnc_show_atmo_env_data + * + * Public: No + */ +#include "script_component.hpp" + +GVAR(showAtmoEnvData) = _this; + +{ctrlShow [_x, _this]} forEach [13000, 13001, 13002, 13003, 130030, 13004, 130040, 13005, 130050, 13006, 130060, 13007, 13008, 13009, 13010]; + +if (_this) then { + [] call FUNC(update_atmo_selection); + [] call FUNC(update_atmo_env_data); +}; diff --git a/addons/atragmx/functions/fnc_show_gun_ammo_data.sqf b/addons/atragmx/functions/fnc_show_gun_ammo_data.sqf new file mode 100644 index 0000000000..06ab20b3b7 --- /dev/null +++ b/addons/atragmx/functions/fnc_show_gun_ammo_data.sqf @@ -0,0 +1,24 @@ +/* + * Author: Ruthberg + * Shows/Hides the gun ammo data controls + * + * Arguments: + * visible - + * + * Return Value: + * Nothing + * + * Example: + * false call ace_atragmx_fnc_show_gun_ammo_data + * + * Public: No + */ +#include "script_component.hpp" + +GVAR(showGunAmmoData) = _this; + +{ctrlShow [_x, _this]} forEach [12000, 120000, 12001, 120010, 12002, 120020, 12003, 120030, 12004, 120040, 12005, 120050, 12006, 120060, 12007, 12008, 12009, 12010, 12011]; + +if (_this) then { + [] call FUNC(update_gun_ammo_data); +}; diff --git a/addons/atragmx/functions/fnc_show_main_page.sqf b/addons/atragmx/functions/fnc_show_main_page.sqf index 941c7559c8..607527a18e 100644 --- a/addons/atragmx/functions/fnc_show_main_page.sqf +++ b/addons/atragmx/functions/fnc_show_main_page.sqf @@ -17,5 +17,13 @@ GVAR(showMainPage) = _this; -{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, +{ctrlShow [_x, _this]} forEach [10, 100, 11, 110, 12, 120, 13, 130, 14, 140, 20, 200, 21, 210, 22, 220, 23, 230, 30, 300, 31, 310, 32, 320, 33, 330, 34, 340, 40, 400, 401, 402, 403, 41, 410, 411, 412, 42, 420, 500, 501, 502, 503, 600, 601, 602, 603, 1000, 2000, 3000, 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008]; + +if (_this) then { + if (GVAR(atmosphereModeTBH)) then { + {ctrlShow [_x, false]} forEach [23, 230]; + } else { + {ctrlShow [_x, false]} forEach [21, 210, 22, 220]; + }; +}; diff --git a/addons/atragmx/functions/fnc_show_target_data.sqf b/addons/atragmx/functions/fnc_show_target_data.sqf new file mode 100644 index 0000000000..8b206fee3a --- /dev/null +++ b/addons/atragmx/functions/fnc_show_target_data.sqf @@ -0,0 +1,24 @@ +/* + * Author: Ruthberg + * Shows/Hides the target data controls + * + * Arguments: + * visible - + * + * Return Value: + * Nothing + * + * Example: + * false call ace_atragmx_fnc_show_target_data + * + * Public: No + */ +#include "script_component.hpp" + +GVAR(showTargetData) = _this; + +{ctrlShow [_x, _this]} forEach [14000, 140000, 14001, 140010, 14002, 140020, 140021, 14003, 140030, 14004, 140040, 140041, 14005, 140050, 14006, 140060, 14007, 14008, 14009, 14010, 14011]; + +if (_this) then { + [] call FUNC(update_target_data); +}; diff --git a/addons/atragmx/functions/fnc_show_target_range_assist.sqf b/addons/atragmx/functions/fnc_show_target_range_assist.sqf index 60de30930f..4f46932a0b 100644 --- a/addons/atragmx/functions/fnc_show_target_range_assist.sqf +++ b/addons/atragmx/functions/fnc_show_target_range_assist.sqf @@ -25,11 +25,9 @@ if (_this) then { ctrlSetText [7012, Str(parseNumber(ctrlText 320))]; ctrlSetText [7013, Str(parseNumber(ctrlText 340))]; - if (GVAR(currentUnit) != 2) then - { + if (GVAR(currentUnit) == 1) then { ctrlSetText [7016, "Yards"]; - } else - { + } else { ctrlSetText [7016, "Meters"]; }; }; \ No newline at end of file diff --git a/addons/atragmx/functions/fnc_show_target_speed_assist.sqf b/addons/atragmx/functions/fnc_show_target_speed_assist.sqf index 3ac05f3f4f..2e66b5ea7b 100644 --- a/addons/atragmx/functions/fnc_show_target_speed_assist.sqf +++ b/addons/atragmx/functions/fnc_show_target_speed_assist.sqf @@ -24,19 +24,15 @@ if (_this) then { ctrlSetText [8004, Str(Round((GVAR(targetRange) select GVAR(currentTarget))))]; - if (GVAR(currentUnit) != 2) then - { + if (GVAR(currentUnit) == 1) then { ctrlSetText [8008, "Yards"]; - } else - { + } else { ctrlSetText [8008, "Meters"]; }; - if (GVAR(currentUnit) != 1) then - { + if (GVAR(currentUnit) == 2) then { ctrlSetText [8011, "m/s"]; - } else - { + } else { ctrlSetText [8011, "mph"]; }; }; diff --git a/addons/atragmx/functions/fnc_store_user_data.sqf b/addons/atragmx/functions/fnc_store_user_data.sqf new file mode 100644 index 0000000000..81a4476d75 --- /dev/null +++ b/addons/atragmx/functions/fnc_store_user_data.sqf @@ -0,0 +1,36 @@ +/* + * Author: Ruthberg + * Saves user data into profileNamespace + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * call ace_atragmx_fnc_store_user_data + * + * Public: No + */ +#include "script_component.hpp" + +profileNamespace setVariable ["ACE_ATragMX_currentUnit", GVAR(currentUnit)]; +profileNamespace setVariable ["ACE_ATragMX_currentGun", GVAR(currentGun)]; +profileNamespace setVariable ["ACE_ATragMX_currentTarget", GVAR(currentTarget)]; +profileNamespace setVariable ["ACE_ATragMX_currentScopeUnit", GVAR(currentScopeUnit)]; + +profileNamespace setVariable ["ACE_ATragMX_atmosphereModeTBH", GVAR(atmosphereModeTBH)]; +profileNamespace setVariable ["ACE_ATragMX_altitude", GVAR(altitude)]; +profileNamespace setVariable ["ACE_ATragMX_temperature", GVAR(temperature)]; +profileNamespace setVariable ["ACE_ATragMX_barometricPressure", GVAR(barometricPressure)]; +profileNamespace setVariable ["ACE_ATragMX_relativeHumidity", GVAR(relativeHumidity)]; + +profileNamespace setVariable ["latitude", GVAR(latitude)]; +profileNamespace setVariable ["directionOfFire", GVAR(directionOfFire)]; +profileNamespace setVariable ["ACE_ATragMX_windSpeed1", GVAR(windSpeed1)]; +profileNamespace setVariable ["ACE_ATragMX_windSpeed2", GVAR(windSpeed2)]; +profileNamespace setVariable ["ACE_ATragMX_windDirection", GVAR(windDirection)]; +profileNamespace setVariable ["ACE_ATragMX_inclinationAngle", GVAR(inclinationAngle)]; +profileNamespace setVariable ["ACE_ATragMX_targetSpeed", GVAR(targetSpeed)]; +profileNamespace setVariable ["ACE_ATragMX_targetRange", GVAR(targetRange)]; diff --git a/addons/atragmx/functions/fnc_toggle_atmo_env_data.sqf b/addons/atragmx/functions/fnc_toggle_atmo_env_data.sqf new file mode 100644 index 0000000000..ce761c2216 --- /dev/null +++ b/addons/atragmx/functions/fnc_toggle_atmo_env_data.sqf @@ -0,0 +1,28 @@ +/* + * Author: Ruthberg + * Toggles the atmospheric data screen on/off + * + * Arguments: + * Apply new data? + * + * Return Value: + * Nothing + * + * Example: + * 1 call ace_atragmx_fnc_toggle_atmo_env_data + * + * Public: No + */ +#include "script_component.hpp" + +if (ctrlVisible 13000) then { + false call FUNC(show_atmo_env_data); + true call FUNC(show_main_page); + + if (_this == 1) then { + call FUNC(calculate_target_solution); + }; +} else { + true call FUNC(show_atmo_env_data); + false call FUNC(show_main_page); +}; diff --git a/addons/atragmx/functions/fnc_toggle_gun_ammo_data.sqf b/addons/atragmx/functions/fnc_toggle_gun_ammo_data.sqf new file mode 100644 index 0000000000..0fd4b913b8 --- /dev/null +++ b/addons/atragmx/functions/fnc_toggle_gun_ammo_data.sqf @@ -0,0 +1,29 @@ +/* + * Author: Ruthberg + * Toggles the gun ammo data screen on/off + * + * Arguments: + * Apply new data? + * + * Return Value: + * Nothing + * + * Example: + * 1 call ace_atragmx_fnc_toggle_gun_ammo_data + * + * Public: No + */ +#include "script_component.hpp" + +if (ctrlVisible 12000) then { + false call FUNC(show_gun_ammo_data); + true call FUNC(show_main_page); + + if (_this == 1) then { + call FUNC(update_zero_range); + call FUNC(calculate_target_solution); + }; +} else { + true call FUNC(show_gun_ammo_data); + false call FUNC(show_main_page); +}; diff --git a/addons/atragmx/functions/fnc_toggle_gun_list.sqf b/addons/atragmx/functions/fnc_toggle_gun_list.sqf index cd4acb1f76..714e6e848d 100644 --- a/addons/atragmx/functions/fnc_toggle_gun_list.sqf +++ b/addons/atragmx/functions/fnc_toggle_gun_list.sqf @@ -3,28 +3,26 @@ * Toggles the gun list screen on/off * * Arguments: - * Nothing + * change gun? * * Return Value: * Nothing * * Example: - * call ace_atragmx_fnc_toggle_gun_list + * false call ace_atragmx_fnc_toggle_gun_list * * Public: No */ #include "script_component.hpp" -if (ctrlVisible 6000) then -{ +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); + [lbCurSel 6000, true] call FUNC(change_gun); }; -} else -{ +} else { false call FUNC(show_main_page); true call FUNC(show_gun_list); }; diff --git a/addons/atragmx/functions/fnc_toggle_range_card.sqf b/addons/atragmx/functions/fnc_toggle_range_card.sqf index 572a4fe6ae..059bc7e40b 100644 --- a/addons/atragmx/functions/fnc_toggle_range_card.sqf +++ b/addons/atragmx/functions/fnc_toggle_range_card.sqf @@ -15,12 +15,10 @@ */ #include "script_component.hpp" -if (ctrlVisible 5006) then -{ +if (ctrlVisible 5006) then { false call FUNC(show_range_card); true call FUNC(show_main_page); -} else -{ +} else { false call FUNC(show_main_page); true call FUNC(show_range_card); diff --git a/addons/atragmx/functions/fnc_toggle_range_card_setup.sqf b/addons/atragmx/functions/fnc_toggle_range_card_setup.sqf index 71da18349b..738a154d17 100644 --- a/addons/atragmx/functions/fnc_toggle_range_card_setup.sqf +++ b/addons/atragmx/functions/fnc_toggle_range_card_setup.sqf @@ -3,25 +3,23 @@ * Toggles the range card setup screen on/off * * Arguments: - * Apply new range card settings + * Apply new range card settings * * Return Value: * Nothing * * Example: - * call ace_atragmx_fnc_toggle_range_card_setup + * 1 call ace_atragmx_fnc_toggle_range_card_setup * * Public: No */ #include "script_component.hpp" -if (ctrlVisible 10000) then -{ +if (ctrlVisible 10000) then { false call FUNC(show_range_card_setup); true call FUNC(show_range_card); - if (_this == 1) then - { + 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; @@ -29,8 +27,7 @@ if (ctrlVisible 10000) then [] call FUNC(calculate_range_card); [] call FUNC(update_range_card); }; -} else -{ +} else { false call FUNC(show_range_card); true call FUNC(show_range_card_setup); }; diff --git a/addons/atragmx/functions/fnc_toggle_target_data.sqf b/addons/atragmx/functions/fnc_toggle_target_data.sqf new file mode 100644 index 0000000000..90fefbf37e --- /dev/null +++ b/addons/atragmx/functions/fnc_toggle_target_data.sqf @@ -0,0 +1,28 @@ +/* + * Author: Ruthberg + * Toggles the target data screen on/off + * + * Arguments: + * Apply new data? + * + * Return Value: + * Nothing + * + * Example: + * 1 call ace_atragmx_fnc_toggle_target_data + * + * Public: No + */ +#include "script_component.hpp" + +if (ctrlVisible 14000) then { + false call FUNC(show_target_data); + true call FUNC(show_main_page); + + if (_this == 1) then { + call FUNC(calculate_target_solution); + }; +} else { + true call FUNC(show_target_data); + false call FUNC(show_main_page); +}; diff --git a/addons/atragmx/functions/fnc_toggle_target_range_assist.sqf b/addons/atragmx/functions/fnc_toggle_target_range_assist.sqf index 04e9307ded..d13ef4fb2e 100644 --- a/addons/atragmx/functions/fnc_toggle_target_range_assist.sqf +++ b/addons/atragmx/functions/fnc_toggle_target_range_assist.sqf @@ -3,30 +3,30 @@ * Toggles the target range assist screen on/off * * Arguments: - * Nothing + * update range? * * Return Value: * Nothing * * Example: - * call ace_atragmx_fnc_toggle_target_range_assist + * 1 call ace_atragmx_fnc_toggle_target_range_assist * * Public: No */ #include "script_component.hpp" -if (ctrlVisible 7000) then -{ +if (ctrlVisible 7000) then { false call FUNC(show_target_range_assist); true call FUNC(show_main_page); - if (_this == 1) then - { + if (_this == 1) then { ctrlSetText [320, Str(parseNumber(ctrlText 7012))]; + ctrlSetText [140040, Str(parseNumber(ctrlText 7012))]; ctrlSetText [340, Str(parseNumber(ctrlText 7013))]; + ctrlSetText [140060, Str(parseNumber(ctrlText 7013))]; + [] call FUNC(calculate_target_solution); }; -} else -{ +} else { false call FUNC(show_main_page); true call FUNC(show_target_range_assist); }; diff --git a/addons/atragmx/functions/fnc_toggle_target_speed_assist.sqf b/addons/atragmx/functions/fnc_toggle_target_speed_assist.sqf index 66ffaa5d07..e227cf0716 100644 --- a/addons/atragmx/functions/fnc_toggle_target_speed_assist.sqf +++ b/addons/atragmx/functions/fnc_toggle_target_speed_assist.sqf @@ -3,30 +3,29 @@ * Toggles the target speed assist screen on/off * * Arguments: - * Nothing + * update speed? * * Return Value: * Nothing * * Example: - * call ace_atragmx_fnc_toggle_target_speed_assist + * 1 call ace_atragmx_fnc_toggle_target_speed_assist * * Public: No */ #include "script_component.hpp" -if (ctrlVisible 8000) then -{ +if (ctrlVisible 8000) then { false call FUNC(show_target_speed_assist); true call FUNC(show_main_page); - if (_this == 1) then - { + if (_this == 1) then { [] call FUNC(calculate_target_speed_assist); ctrlSetText [330, Str(parseNumber(ctrlText 8007))]; + ctrlSetText [140050, Str(parseNumber(ctrlText 8007))]; + [] call FUNC(calculate_target_solution); }; -} else -{ +} else { false call FUNC(show_main_page); true call FUNC(show_target_speed_assist); }; diff --git a/addons/atragmx/functions/fnc_update_atmo_env_data.sqf b/addons/atragmx/functions/fnc_update_atmo_env_data.sqf new file mode 100644 index 0000000000..8dcbc89280 --- /dev/null +++ b/addons/atragmx/functions/fnc_update_atmo_env_data.sqf @@ -0,0 +1,45 @@ +/* + * Author: Ruthberg + * Updates the atmospheric data fields + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * call ace_atragmx_fnc_update_atmo_env_data + * + * Public: No + */ +#include "script_component.hpp" + +ctrlSetFocus ((uiNamespace getVariable "ATragMX_Display") displayCtrl 13007); + +if (GVAR(currentUnit) != 1) then { + ctrlSetText [130040, Str(Round(GVAR(temperature) * 10) / 10)]; +} else { + ctrlSetText [130040, Str(Round((GVAR(temperature) * 1.8 + 32) * 10) / 10)]; +}; +if (GVAR(currentUnit) != 1) then { + ctrlSetText [130050, Str(Round(GVAR(barometricPressure)))]; +} else { + ctrlSetText [130050, Str(Round(GVAR(barometricPressure) / 33.8638866667 * 100) / 100)]; +}; +ctrlSetText [130060, Str(Round(GVAR(relativeHumidity) * 100 * 10) / 10)]; +if (GVAR(currentUnit) != 1) then { + ctrlSetText [130030, Str(Round(GVAR(altitude)))]; +} else { + ctrlSetText [130030, Str(Round(GVAR(altitude) * 3.2808399))]; +}; + +if (GVAR(currentUnit) == 2) then { + ctrlSetText [13003, "Altitude (m)"]; + ctrlSetText [13004, "temperature (C)"]; + ctrlSetText [13005, "Barom Pres (milibars)"]; +} else { + ctrlSetText [13003, "Altitude (ft)"]; + ctrlSetText [13004, "temperature (F)"]; + ctrlSetText [13005, "Barom Pres (in.merc.)"]; +}; diff --git a/addons/atragmx/functions/fnc_update_atmo_selection.sqf b/addons/atragmx/functions/fnc_update_atmo_selection.sqf new file mode 100644 index 0000000000..18036178b4 --- /dev/null +++ b/addons/atragmx/functions/fnc_update_atmo_selection.sqf @@ -0,0 +1,31 @@ +/* + * Author: Ruthberg + * Updates the atmospheric data input method + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * call ace_atragmx_fnc_update_atmo_selection + * + * Public: No + */ +#include "script_component.hpp" + +((uiNamespace getVariable "ATragMX_Display") displayCtrl 13001) ctrlEnable true; +((uiNamespace getVariable "ATragMX_Display") displayCtrl 13002) ctrlEnable true; + +if (GVAR(atmosphereModeTBH)) then { + ((uiNamespace getVariable "ATragMX_Display") displayCtrl 13002) ctrlEnable false; + {ctrlShow [_x, false]} forEach [13003, 130030]; + {ctrlShow [_x, true]} forEach [13005, 130050, 13006, 130060]; +} else { + ((uiNamespace getVariable "ATragMX_Display") displayCtrl 13001) ctrlEnable false; + {ctrlShow [_x, false]} forEach [13005, 130050, 13006, 130060]; + {ctrlShow [_x, true]} forEach [13003, 130030]; +}; + +[] call FUNC(update_atmo_env_data); diff --git a/addons/atragmx/functions/fnc_update_atmosphere.sqf b/addons/atragmx/functions/fnc_update_atmosphere.sqf index 68a60f72e9..fa555f50e7 100644 --- a/addons/atragmx/functions/fnc_update_atmosphere.sqf +++ b/addons/atragmx/functions/fnc_update_atmosphere.sqf @@ -15,10 +15,19 @@ */ #include "script_component.hpp" -ctrlSetText [200, Str(Round(GVAR(temperature) * 10) / 10)]; -if (GVAR(currentUnit) == 1) then { - ctrlSetText [210, Str(Round(GVAR(barometricPressure) * 100) / 100)]; +if (GVAR(currentUnit) != 1) then { + ctrlSetText [200, Str(Round(GVAR(temperature) * 10) / 10)]; } else { + ctrlSetText [200, Str(Round((GVAR(temperature) * 1.8 + 32) * 10) / 10)]; +}; +if (GVAR(currentUnit) != 1) then { ctrlSetText [210, Str(Round(GVAR(barometricPressure)))]; +} else { + ctrlSetText [210, Str(Round(GVAR(barometricPressure) / 33.8638866667 * 100) / 100)]; }; ctrlSetText [220, Str(Round(GVAR(relativeHumidity) * 100 * 10) / 10)]; +if (GVAR(currentUnit) != 1) then { + ctrlSetText [230, Str(Round(GVAR(altitude)))]; +} else { + ctrlSetText [230, Str(Round(GVAR(altitude) * 3.2808399))]; +}; diff --git a/addons/atragmx/functions/fnc_update_gun.sqf b/addons/atragmx/functions/fnc_update_gun.sqf index 1e12439878..f3d173ba11 100644 --- a/addons/atragmx/functions/fnc_update_gun.sqf +++ b/addons/atragmx/functions/fnc_update_gun.sqf @@ -16,37 +16,29 @@ #include "script_component.hpp" ctrlSetText [1000, GVAR(workingMemory) select 0]; -if (GVAR(currentUnit) == 1) then -{ - ctrlSetText [ 100, Str(Round((GVAR(workingMemory) select 5) / 2.54 * 100) / 100)]; -} else -{ - ctrlSetText [ 100, Str(Round((GVAR(workingMemory) select 5) * 100) / 100)]; +if (GVAR(currentUnit) != 2) then { + ctrlSetText [100, Str(Round((GVAR(workingMemory) select 5) / 2.54 * 100) / 100)]; +} else { + ctrlSetText [100, Str(Round((GVAR(workingMemory) select 5) * 100) / 100)]; }; -if (GVAR(currentUnit) == 1) then -{ - ctrlSetText [ 110, Str(Round((GVAR(workingMemory) select 12) * 15.4323584))]; -} else -{ - ctrlSetText [ 110, Str(Round(GVAR(workingMemory) select 12))]; +if (GVAR(currentUnit) != 2) then { + ctrlSetText [110, Str(Round((GVAR(workingMemory) select 12) * 15.4323584))]; +} else { + ctrlSetText [110, Str(Round(GVAR(workingMemory) 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 15) * 1000) / 1000)]; + ctrlSetText [120, Str(Round((GVAR(workingMemory) select 15) * 1000) / 1000)]; } else { - ctrlSetText [ 120, Str(Round((GVAR(workingMemory) select 4) * -1000 * 1000) / 1000)]; + ctrlSetText [120, Str(Round((GVAR(workingMemory) select 4) * -1000 * 1000) / 1000)]; }; -if (GVAR(currentUnit) == 1) then -{ +if (GVAR(currentUnit) != 2) then { ctrlSetText [130, Str(Round((GVAR(workingMemory) select 1) * 3.2808399))]; -} else -{ +} else { ctrlSetText [130, Str(Round(GVAR(workingMemory) select 1))]; }; -if (GVAR(currentUnit) == 2) then -{ +if (GVAR(currentUnit) != 1) then { ctrlSetText [140, Str(Round(GVAR(workingMemory) select 2))]; -} else -{ +} else { ctrlSetText [140, Str(Round((GVAR(workingMemory) select 2) * 1.0936133))]; }; diff --git a/addons/atragmx/functions/fnc_update_gun_ammo_data.sqf b/addons/atragmx/functions/fnc_update_gun_ammo_data.sqf new file mode 100644 index 0000000000..3627197185 --- /dev/null +++ b/addons/atragmx/functions/fnc_update_gun_ammo_data.sqf @@ -0,0 +1,74 @@ +/* + * Author: Ruthberg + * Updates the gun ammo data fields + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * call ace_atragmx_fnc_update_gun_ammo_data + * + * Public: No + */ +#include "script_component.hpp" + +ctrlSetFocus ((uiNamespace getVariable "ATragMX_Display") displayCtrl 12008); + +if (GVAR(currentUnit) != 2) then { + ctrlSetText [120000, Str(Round((GVAR(workingMemory) select 5) / 2.54 * 100) / 100)]; +} else { + ctrlSetText [120000, Str(Round((GVAR(workingMemory) select 5) * 100) / 100)]; +}; +if (GVAR(currentUnit) != 2) then { + ctrlSetText [120010, Str(Round((GVAR(workingMemory) select 12) * 15.4323584))]; +} else { + ctrlSetText [120010, Str(Round(GVAR(workingMemory) select 12))]; +}; +if (GVAR(currentUnit) != 2) then { + ctrlSetText [120020, Str(Round((GVAR(workingMemory) select 13) / 10 / 2.54 * 1000) / 1000)]; +} else { + ctrlSetText [120020, Str(Round((GVAR(workingMemory) select 13) * 1000) / 1000)]; +}; +if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then { + ctrlSetText [120030, Str(Round((GVAR(workingMemory) select 15) * 1000) / 1000)]; +} else { + ctrlSetText [120030, Str(Round((GVAR(workingMemory) select 4) * -1000 * 1000) / 1000)]; +}; +if (GVAR(currentUnit) != 2) then { + ctrlSetText [120040, Str(Round((GVAR(workingMemory) select 14) / 2.54 * 10) / 10)]; +} else { + ctrlSetText [120040, Str(Round((GVAR(workingMemory) select 14) * 100) / 100)]; +}; +if (GVAR(currentUnit) != 2) then { + ctrlSetText [120050, Str(Round((GVAR(workingMemory) select 1) * 3.2808399))]; +} else { + ctrlSetText [120050, Str(Round(GVAR(workingMemory) select 1))]; +}; +if (GVAR(currentUnit) == 2) then { + ctrlSetText [120060, Str(Round(GVAR(workingMemory) select 2))]; +} else { + ctrlSetText [120060, Str(Round((GVAR(workingMemory) select 2) * 1.0936133))]; +}; + +if (GVAR(currentUnit) == 2) then { + ctrlSetText [12000, "Bore (cm)"]; + ctrlSetText [12001, "Bullet Weight (grams)"]; + ctrlSetText [12002, "Bullet Diam (cm)"]; + ctrlSetText [12004, "Rifle Twist (cm/trn)"]; + ctrlSetText [12005, "Muzzle Velocity (m/s)"]; +} else { + ctrlSetText [12000, "Bore (inches)"]; + ctrlSetText [12001, "Bullet Weight (grains)"]; + ctrlSetText [12002, "Bullet Diam (inches)"]; + ctrlSetText [12004, "Rifle Twist (inches/trn)"]; + ctrlSetText [12005, "Muzzle Velocity (feet/sec)"]; +}; + +if (GVAR(currentUnit) == 1) then { + ctrlSetText [12006, "Zero Range (yards)"]; +} else { + ctrlSetText [12006, "Zero Range (meters)"]; +}; diff --git a/addons/atragmx/functions/fnc_update_range_card.sqf b/addons/atragmx/functions/fnc_update_range_card.sqf index 358a74ce5d..871e5fa268 100644 --- a/addons/atragmx/functions/fnc_update_range_card.sqf +++ b/addons/atragmx/functions/fnc_update_range_card.sqf @@ -20,11 +20,9 @@ _lastColumnOutput = ""; ctrlSetText [5006, (GVAR(rangeCardLastColumns) select GVAR(rangeCardCurrentColumn))]; -if (GVAR(currentUnit) != 2) then -{ +if (GVAR(currentUnit) == 1) then { ctrlSetText [5003, "Yards"]; -} else -{ +} else { ctrlSetText [5003, "Meters"]; }; @@ -39,22 +37,16 @@ lnbClear 5007; _velocity = _x select 5; _kineticEnergy = _x select 6; - switch (GVAR(currentScopeUnit)) do - { - case 0: - { + switch (GVAR(currentScopeUnit)) do { + case 0: { _elevation = _elevation / 3.38; _windage = _windage / 3.38; - }; - - case 2: - { + }; + case 2: { _elevation = _elevation * 1.047; _windage = _windage * 1.047; }; - - case 3: - { + case 3: { _elevationScopeStep = (GVAR(workingMemory) select 7); _windageScopeStep = (GVAR(workingMemory) select 8); @@ -67,35 +59,25 @@ lnbClear 5007; _windageOutput = Str(Round(_windage * 100) / 100); _rangeOutput = Str(_range); - if (_velocity < 340.29) then - { + if (_velocity < 340.29) then { _rangeOutput = _rangeOutput + "*"; }; - if (GVAR(currentUnit) == 1) then - { + if (GVAR(currentUnit) == 1) then { _velocity = _velocity * 3.2808399; }; - switch (GVAR(rangeCardCurrentColumn)) do - { - case 0: - { + switch (GVAR(rangeCardCurrentColumn)) do { + case 0: { _lastColumnOutput = Str(Round(_lead * 100) / 100); }; - - case 1: - { + case 1: { _lastColumnOutput = Str(Round(_velocity)); }; - - case 2: - { + case 2: { _lastColumnOutput = Str(Round(_kineticEnergy)); }; - - case 3: - { + case 3: { _lastColumnOutput = Str(Round(_TOF * 100) / 100); } }; diff --git a/addons/atragmx/functions/fnc_update_result.sqf b/addons/atragmx/functions/fnc_update_result.sqf index addd1034b2..6898920eac 100644 --- a/addons/atragmx/functions/fnc_update_result.sqf +++ b/addons/atragmx/functions/fnc_update_result.sqf @@ -27,10 +27,8 @@ _windageRel = _windageAbs - _windageCur; _lead = (GVAR(leadOutput) select GVAR(currentTarget)); -switch (GVAR(currentScopeUnit)) do -{ - case 0: - { +switch (GVAR(currentScopeUnit)) do { + case 0: { _elevationAbs = _elevationAbs / 3.38; _windageAbs = _windageAbs / 3.38; @@ -40,9 +38,7 @@ switch (GVAR(currentScopeUnit)) do _elevationCur = _elevationCur / 3.38; _windageCur = _windageCur / 3.38; }; - - case 2: - { + case 2: { _elevationAbs = _elevationAbs * 1.047; _windageAbs = _windageAbs * 1.047; @@ -52,9 +48,7 @@ switch (GVAR(currentScopeUnit)) do _elevationCur = _elevationCur * 1.047; _windageCur = _windageCur * 1.047; }; - - case 3: - { + case 3: { _elevationScopeStep = (GVAR(workingMemory) select 7); _windageScopeStep = (GVAR(workingMemory) select 8); diff --git a/addons/atragmx/functions/fnc_update_target.sqf b/addons/atragmx/functions/fnc_update_target.sqf index 18d7a72cd2..30b33eb55f 100644 --- a/addons/atragmx/functions/fnc_update_target.sqf +++ b/addons/atragmx/functions/fnc_update_target.sqf @@ -15,23 +15,8 @@ */ #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))))]; -}; +ctrlSetText [300, Str(Round((GVAR(windSpeed1) select GVAR(currentTarget)) * 100) / 100)]; +ctrlSetText [310, Str(Round((GVAR(windDirection) select GVAR(currentTarget))))]; +ctrlSetText [320, Str(Round((GVAR(inclinationAngle) select GVAR(currentTarget))))]; +ctrlSetText [330, Str(Round((GVAR(targetSpeed) select GVAR(currentTarget)) * 100) / 100)]; +ctrlSetText [340, Str(Round((GVAR(targetRange) select GVAR(currentTarget))))]; diff --git a/addons/atragmx/functions/fnc_update_target_data.sqf b/addons/atragmx/functions/fnc_update_target_data.sqf new file mode 100644 index 0000000000..35711acd5b --- /dev/null +++ b/addons/atragmx/functions/fnc_update_target_data.sqf @@ -0,0 +1,40 @@ +/* + * 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" + +ctrlSetText [140000, Str(Round((GVAR(latitude) select GVAR(currentTarget)) * 100) / 100)]; +ctrlSetText [140010, Str(Round((GVAR(directionOfFire) select GVAR(currentTarget)) * 100) / 100)]; +ctrlSetText [140020, Str(Round((GVAR(windSpeed1) select GVAR(currentTarget)) * 100) / 100)]; +ctrlSetText [140021, Str(Round((GVAR(windSpeed2) select GVAR(currentTarget)) * 100) / 100)]; +ctrlSetText [140030, Str(Round((GVAR(windDirection) select GVAR(currentTarget))))]; +ctrlSetText [140040, Str(Round((GVAR(inclinationAngle) select GVAR(currentTarget))))]; +ctrlSetText [140041, Str(floor(cos(GVAR(inclinationAngle) select GVAR(currentTarget)) * 100) / 100)]; +ctrlSetText [140050, Str(Round((GVAR(targetSpeed) select GVAR(currentTarget)) * 100) / 100)]; +ctrlSetText [140060, Str(Round((GVAR(targetRange) select GVAR(currentTarget))))]; + +if (GVAR(currentUnit) == 2) then { + ctrlSetText [14002, "Wind Speed (m/s)"]; + ctrlSetText [14005, "Target Speed (m/s)"]; +} else { + ctrlSetText [14002, "Wind Speed (mph)"]; + ctrlSetText [14005, "Target Speed (mph)"]; +}; + +if (GVAR(currentUnit) == 1) then { + ctrlSetText [14006, "Target Range (yards)"]; +} else { + ctrlSetText [14006, "Target Range (meters)"]; +}; diff --git a/addons/atragmx/functions/fnc_update_unit_selection.sqf b/addons/atragmx/functions/fnc_update_unit_selection.sqf index 2882954c5b..77d96bfdd6 100644 --- a/addons/atragmx/functions/fnc_update_unit_selection.sqf +++ b/addons/atragmx/functions/fnc_update_unit_selection.sqf @@ -22,6 +22,10 @@ ((uiNamespace getVariable "ATragMX_Display") displayCtrl 600 + GVAR(currentUnit)) ctrlEnable false; [] call FUNC(update_gun); +[] call FUNC(update_gun_ammo_data); [] call FUNC(update_atmosphere); +[] call FUNC(update_atmo_env_data); [] call FUNC(update_target); +[] call FUNC(update_target_data); + [] call FUNC(update_result); diff --git a/addons/atragmx/functions/fnc_update_zero_range.sqf b/addons/atragmx/functions/fnc_update_zero_range.sqf index e7f0c2c301..6e2a9c566c 100644 --- a/addons/atragmx/functions/fnc_update_zero_range.sqf +++ b/addons/atragmx/functions/fnc_update_zero_range.sqf @@ -28,9 +28,8 @@ _dragModel = GVAR(workingMemory) select 16; _atmosphereModel = GVAR(workingMemory) select 17; private ["_zeroRange"]; -_zeroRange = Round(parseNumber(ctrlText 140)); -if (GVAR(currentUnit) != 2) then -{ +_zeroRange = Round(parseNumber(ctrlText 120060)); +if (GVAR(currentUnit) == 1) then { _zeroRange = _zeroRange / 1.0936133; }; if (_zeroRange < 10) exitWith { @@ -38,18 +37,14 @@ if (_zeroRange < 10) exitWith { GVAR(workingMemory) set [3, 0]; }; -private ["_temperature", "_barometricPressure", "_relativeHumidity"]; +private ["_altitude", "_temperature", "_barometricPressure", "_relativeHumidity"]; +_altitude = GVAR(altitude); _temperature = GVAR(temperature); _barometricPressure = GVAR(barometricPressure); _relativeHumidity = GVAR(relativeHumidity); -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); +_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000, 0, 0, 0, 0, _zeroRange, _bc, _dragModel, _atmosphereModel, false, 1.5, 0, 0] call FUNC(calculate_solution); GVAR(workingMemory) set [2, _zeroRange]; GVAR(workingMemory) set [3, _scopeBaseAngle + (_result select 0) / 60];