diff --git a/AUTHORS.txt b/AUTHORS.txt index 7720bb24d3..906fc706a4 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -76,3 +76,4 @@ ruPaladin BlackPixxel Asgar Serran Kavinsky +BlackPixxel diff --git a/addons/atragmx/CfgEventHandlers.hpp b/addons/atragmx/CfgEventHandlers.hpp new file mode 100644 index 0000000000..3996e3371d --- /dev/null +++ b/addons/atragmx/CfgEventHandlers.hpp @@ -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) ); + }; +}; \ No newline at end of file diff --git a/addons/atragmx/CfgVehicles.hpp b/addons/atragmx/CfgVehicles.hpp new file mode 100644 index 0000000000..f015f0e0b9 --- /dev/null +++ b/addons/atragmx/CfgVehicles.hpp @@ -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); + }; + }; +}; diff --git a/addons/atragmx/CfgWeapons.hpp b/addons/atragmx/CfgWeapons.hpp new file mode 100644 index 0000000000..07d2fa4aee --- /dev/null +++ b/addons/atragmx/CfgWeapons.hpp @@ -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; + }; + }; +}; diff --git a/addons/atragmx/README.md b/addons/atragmx/README.md new file mode 100644 index 0000000000..f68b38c4a3 --- /dev/null +++ b/addons/atragmx/README.md @@ -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) \ No newline at end of file diff --git a/addons/atragmx/RscTitles.hpp b/addons/atragmx/RscTitles.hpp new file mode 100644 index 0000000000..cead81c3c0 --- /dev/null +++ b/addons/atragmx/RscTitles.hpp @@ -0,0 +1,1050 @@ +#define ST_LEFT 0 +#define ST_RIGHT 1 +#define ST_CENTER 2 + +class ATragMX_RscText { + idc=-1; + type=0; + style=256; + colorDisabled[]={0,0,0,0.0}; + colorBackground[]={0,0,0,0}; + colorText[]={0,0,0,1}; + text=""; + x=0; + y=0; + h=0.037; + w=0.30; + font="TahomaB"; + SizeEx=0.03; + shadow=0; +}; +class ATragMX_RscButton { + text=""; + colorText[]={0,0,0,1}; + colorDisabled[]={0,0,0,0.0}; + colorBackground[]={0,0,0,0}; + colorBackgroundDisabled[]={0,0,0,0}; + colorBackgroundActive[]={0,0,0,0}; + colorFocused[]={0,0,0,0}; + colorShadow[]={0,0,0,0}; + colorBorder[]={0,0,0,1}; + soundEnter[]={"",0,1}; + soundPush[]={"",0,1}; + soundClick[]={"",0,1}; + soundEscape[]={"",0,1}; + type=1; + style="0x02+0x100"; + x=0; + y=0; + w=0.03; + h=0.03; + font="TahomaB"; + SizeEx=0.025; + offsetX=0.003; + offsetY=0.003; + offsetPressedX=0.0020; + offsetPressedY=0.0020; + borderSize=0; + shadow=0; +}; +class ATragMX_RscEdit { + access=0; + type=2; + style=ST_RIGHT; + x=0; + y=0; + w=0.05; + h=0.03; + colorDisabled[]={0,0,0,0.0}; + colorBackground[]={0,0,0,0}; + colorText[]={0,0,0,1}; + colorSelection[]={0,0,0,0.25}; + font="TahomaB"; + sizeEx=0.025; + text=""; + size=0.2; + autocomplete=""; + shadow=0; +}; +class ATragMX_RscToolbox { + type=6; + style=ST_LEFT; + x=0; + y=0; + w=0.2; + h=0.03; + colorDisabled[]={0,0,0,0.0}; + colorBackground[]={1,1,1,1}; + colorText[]={0,0,0,1}; + color[]={0,0,0,0}; + colorTextSelect[]={0.8,0.8,0.8,1}; + colorSelect[]={0,0,0,1}; + colorSelectedBg[]={0,0,0,1}; + colorTextDisable[]={0.4,0.4,0.4,1}; + colorDisable[]={0.4,0.4,0.4,1}; + font="TahomaB"; + sizeEx=0.027; + rows=1; + columns=2; + strings[]={"Entry 1","Entry 2"}; + values[]={1,0}; + onToolBoxSelChanged=""; +}; +class ATragMX_RscListBox { + idc=-1; + type=5; + style=0; + font="TahomaB"; + sizeEx=0.028; + rowHeight=0.03; + colorDisabled[]={0,0,0,0.0}; + colorBackground[]={1,1,1,1}; + colorText[]={0,0,0,1}; + colorScrollbar[]={0.95,0.95,0.95,1}; + colorSelect[]={0,0,0,1}; + colorSelect2[]={0,0,0,1}; + colorSelectBackground[]={0.925,0.925,0.925,1}; + colorSelectBackground2[]={0.925,0.925,0.925,1}; + period=0; + maxHistoryDelay=1.0; + autoScrollSpeed=-1; + autoScrollDelay=5; + autoScrollRewind=0; + soundSelect[]={"",0.09,1}; + + class ScrollBar { + color[]={1,1,1,0.6}; + colorActive[]={1,1,1,1}; + colorDisabled[]={1,1,1,0.3}; + thumb="\ca\ui\data\igui_scrollbar_thumb_ca.paa"; + arrowFull="\ca\ui\data\igui_arrow_top_active_ca.paa"; + arrowEmpty="\ca\ui\data\igui_arrow_top_ca.paa"; + border="\ca\ui\data\igui_border_scroll_ca.paa"; + }; + + class ListScrollBar : ScrollBar { + }; +}; +class ATragMX_RscListNBox: ATragMX_RscListBox { + idc=-1; + type=102; + columns[]={0.0, 0.225, 0.475, 0.725}; + drawSideArrows=0; + idcLeft=-1; + idcRight=-1; +}; +class ATragMX_RscControlsGroup { + type=15; + idc=-1; + style=16; + x=0; + y=0; + w=1; + h=1; + shadow=0; + class VScrollbar { + color[]={1,1,1,0.6}; + width=0.021; + autoScrollSpeed=-1; + autoScrollDelay=5; + autoScrollRewind=0; + shadow=0; + }; + class HScrollbar { + color[]={1,1,1,0.6}; + height=0.028; + shadow=0; + }; + class ScrollBar { + color[]={1,1,1,0.6}; + colorActive[]={1,1,1,1}; + colorDisabled[]={1,1,1,0.3}; + thumb="#(argb,8,8,3)color(1,1,1,1)"; + arrowEmpty="#(argb,8,8,3)color(1,1,1,1)"; + arrowFull="#(argb,8,8,3)color(1,1,1,1)"; + border="#(argb,8,8,3)color(1,1,1,1)"; + }; + class Controls { + }; +}; +class ATragMX_RscLineBreak { + idc=-1; + type=98; + shadow=0; +}; +class ATragMX_Display { + name="ATragMX_Display"; + idd=-1; + onLoad="uiNamespace setVariable ['ATragMX_Display', (_this select 0)]"; + movingEnable=1; + controlsBackground[]={}; + objects[]={}; + class controls { + class BACKGROUND { + moving=1; + type=0; + font="TahomaB"; + SizeEX=0.025; + idc=-1; + style=48; + x=0.55*safezoneW+safezoneX-0.256; + y=0.265*safezoneH+safezoneY-0.1; + w=1.024; + h=1.024*4/3; + colorBackground[]={1,1,1,1}; + colorText[]={1,1,1,1}; + text=PATHTOF(UI\atrag.paa); + }; + class POWER: ATragMX_RscButton { + idc=-1; + x=0.55*safezoneW+safezoneX+0.145; + y=0.265*safezoneH+safezoneY+0.94; + w=0.045; + h=0.045*4/3; + colorBackground[]={0,0,0,0.0}; + action="closeDialog 0"; + }; + class BACK: POWER { + idc=-1; + w=0.06; + x=0.55*safezoneW+safezoneX+0.3122; + action=QUOTE(call FUNC(init); call FUNC(update_target_selection)); + }; + class WINDOWS: ATragMX_RscButton { + idc=-1; + x=0.55*safezoneW+safezoneX+0.130; + y=0.265*safezoneH+safezoneY+0.88; + w=0.035; + h=0.035*4/3; + colorBackground[]={0,0,0,0.0}; + }; + class OK: WINDOWS { + idc=-1; + x=0.55*safezoneW+safezoneX+0.347; + y=0.265*safezoneH+safezoneY+0.878; + }; + class TOP: ATragMX_RscButton { + idc=-1; + x=0.55*safezoneW+safezoneX+0.242; + y=0.265*safezoneH+safezoneY+0.85; + w=0.03; + h=0.03; + colorBackground[]={0,0,0,0.0}; + action=QUOTE(((GVAR(currentGun) select GVAR(currentTarget)) + (count GVAR(gunList)) - 1) % (count GVAR(gunList)) call FUNC(change_gun)); + }; + class BOTTOM: TOP { + idc=-1; + y=0.265*safezoneH+safezoneY+0.955; + action=QUOTE(((GVAR(currentGun) select GVAR(currentTarget)) + (count GVAR(gunList)) + 1) % (count GVAR(gunList)) call FUNC(change_gun)); + }; + class LEFT: ATragMX_RscButton { + idc=-1; + x=0.55*safezoneW+safezoneX+0.1925; + y=0.265*safezoneH+safezoneY+0.9; + w=0.05; + h=0.03; + colorBackground[]={0,0,0,0}; + action=QUOTE(call FUNC(parse_input); GVAR(currentTarget) = (4 + GVAR(currentTarget) - 1) % 4; call FUNC(update_target_selection)); + }; + class RIGHT: LEFT { + idc=-1; + x=0.55*safezoneW+safezoneX+0.2725; + action=QUOTE(call FUNC(parse_input); GVAR(currentTarget) = (4 + GVAR(currentTarget) + 1) % 4; call FUNC(update_target_selection)); + }; + class TOP_LEFT: ATragMX_RscButton { + idc=-1; + x=0.55*safezoneW+safezoneX+0.162; + y=0.265*safezoneH+safezoneY+0.82; + w=0.031; + h=0.031*4/3; + colorBackground[]={0,0,0,0.0}; + }; + class TOP_RIGHT: TOP_LEFT { + idc=-1; + x=0.55*safezoneW+safezoneX+0.315; + }; + + class TEXT_GUN_PROFILE: ATragMX_RscText { + idc=1000; + x=0.550*safezoneW+safezoneX+0.11; + y=0.265*safezoneH+safezoneY+0.20; + w=0.18; + h=0.03; + style=ST_LEFT; + sizeEx=0.025; + text=""; + }; + class TEXT_D: ATragMX_RscButton { + idc=600; + w=0.0231; + x=0.550*safezoneW+safezoneX+0.29; + y=0.265*safezoneH+safezoneY+0.20; + colorText[]={0,0,0,1}; + colorDisabled[]={0.8,0.8,0.8,1}; + colorBackgroundDisabled[]={0,0,0,1}; + colorBackgroundActive[]={0,0,0,0}; + text="D"; + action=QUOTE(GVAR(currentUnit)=0; call FUNC(update_unit_selection)); + }; + class TEXT_E: TEXT_D { + idc=601; + x=0.550*safezoneW+safezoneX+0.3131; + text="E"; + action=QUOTE(GVAR(currentUnit)=1; call FUNC(update_unit_selection)); + }; + class TEXT_M: TEXT_E { + idc=602; + x=0.550*safezoneW+safezoneX+0.3362; + text="M"; + action=QUOTE(GVAR(currentUnit)=2; call FUNC(update_unit_selection)); + }; + class TEXT_RANGE_CARD: TEXT_D { + idc=603; + w=0.03; + x=0.550*safezoneW+safezoneX+0.36; + colorBackground[]={0.15,0.21,0.23,0.3}; + colorFocused[]={0.15,0.21,0.23,0.2}; + text="RC"; + action=QUOTE(call FUNC(toggle_range_card)); + }; + + class TEXT_GUN: ATragMX_RscButton { + idc=4000; + w=0.0925; + x=0.550*safezoneW+safezoneX+0.11; + y=0.265*safezoneH+safezoneY+0.25; + colorBackground[]={0.15,0.21,0.23,0.3}; + colorFocused[]={0.15,0.21,0.23,0.2}; + text="Gun"; + }; + class TEXT_BORE_HEIGHT: TEXT_GUN_PROFILE { + idc=10; + style=ST_LEFT; + y=0.265*safezoneH+safezoneY+0.285; + text="BH"; + }; + class TEXT_BORE_HEIGHT_INPUT: ATragMX_RscEdit { + idc=100; + 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; + style=ST_LEFT; + y=0.265*safezoneH+safezoneY+0.320; + text="BW"; + }; + class TEXT_BULLET_MASS_INPUT: TEXT_BORE_HEIGHT_INPUT { + idc=110; + y=0.265*safezoneH+safezoneY+0.320; + }; + class TEXT_AIR_FRICTION: TEXT_BORE_HEIGHT { + idc=12; + y=0.265*safezoneH+safezoneY+0.355; + text="C1"; + }; + class TEXT_AIR_FRICTION_INPUT: TEXT_BORE_HEIGHT_INPUT { + idc=120; + y=0.265*safezoneH+safezoneY+0.355; + }; + class TEXT_MUZZLE_VELOCITY: ATragMX_RscButton { + idc=13; + style=0; + w=0.03; + x=0.550*safezoneW+safezoneX+0.11; + y=0.265*safezoneH+safezoneY+0.390; + colorBackground[]={0.15,0.21,0.23,0.3}; + colorFocused[]={0.15,0.21,0.23,0.2}; + text="MV"; + }; + class TEXT_MUZZLE_VELOCITY_INPUT: TEXT_BORE_HEIGHT_INPUT { + idc=130; + y=0.265*safezoneH+safezoneY+0.390; + }; + class TEXT_ZERO_RANGE: TEXT_BORE_HEIGHT { + idc=14; + y=0.265*safezoneH+safezoneY+0.425; + text="ZR"; + }; + class TEXT_ZERO_RANGE_INPUT: TEXT_BORE_HEIGHT_INPUT { + 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"; + }; + class TEXT_TEMPERATURE: TEXT_BULLET_MASS { + idc=20; + x=0.550*safezoneW+safezoneX+0.20; + text="Tmp"; + }; + class TEXT_TEMPERATURE_INPUT: ATragMX_RscEdit { + idc=200; + 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 { + idc=210; + y=0.265*safezoneH+safezoneY+0.355; + }; + class TEXT_RELATIVE_HUMIDITY: TEXT_AIR_FRICTION { + idc=22; + x=0.550*safezoneW+safezoneX+0.20; + y=0.265*safezoneH+safezoneY+0.390; + text="RH"; + }; + class TEXT_RELATIVE_HUMIDITY_INPUT: TEXT_TEMPERATURE_INPUT { + idc=220; + y=0.265*safezoneH+safezoneY+0.390; + }; + class TEXT_TARGET_A: ATragMX_RscButton { + idc=500; + w=0.0231; + x=0.550*safezoneW+safezoneX+0.205; + y=0.265*safezoneH+safezoneY+0.425; + colorText[]={0,0,0,1}; + colorDisabled[]={0.8,0.8,0.8,1}; + colorBackgroundDisabled[]={0,0,0,1}; + colorBackgroundActive[]={0,0,0,0}; + text="A"; + action=QUOTE(call FUNC(parse_input); GVAR(currentTarget)=0; call FUNC(update_target_selection)); + }; + class TEXT_TARGET_B: TEXT_TARGET_A { + idc=501; + x=0.550*safezoneW+safezoneX+0.2281; + text="B"; + action=QUOTE(call FUNC(parse_input); GVAR(currentTarget)=1; call FUNC(update_target_selection)); + }; + class TEXT_TARGET_C: TEXT_TARGET_B { + idc=502; + x=0.550*safezoneW+safezoneX+0.2512; + text="C"; + action=QUOTE(call FUNC(parse_input); GVAR(currentTarget)=2; call FUNC(update_target_selection)); + }; + class TEXT_TARGET_D: TEXT_TARGET_B { + idc=503; + x=0.550*safezoneW+safezoneX+0.2743; + text="D"; + action=QUOTE(call FUNC(parse_input); GVAR(currentTarget)=3; call FUNC(update_target_selection)); + }; + + class TEXT_TARGET: TEXT_GUN { + idc=4002; + x=0.550*safezoneW+safezoneX+0.3; + text="Target"; + }; + 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 { + 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 { + idc=31; + x=0.550*safezoneW+safezoneX+0.3; + text="WD"; + }; + class TEXT_WIND_DIRECTION_INPUT: TEXT_WIND_SPEED_INPUT { + idc=310; + y=0.265*safezoneH+safezoneY+0.32; + }; + class TEXT_INCLINATION_ANGLE: TEXT_AIR_FRICTION { + idc=32; + x=0.550*safezoneW+safezoneX+0.3; + text="IA"; + }; + class TEXT_INCLINATION_ANGLE_INPUT: TEXT_WIND_SPEED_INPUT { + idc=320; + y=0.265*safezoneH+safezoneY+0.355; + }; + class TEXT_TARGET_SPEED: TEXT_MUZZLE_VELOCITY { + idc=33; + x=0.550*safezoneW+safezoneX+0.3; + text="TS"; + action=QUOTE(call FUNC(toggle_target_speed_assist)); + }; + class TEXT_TARGET_SPEED_INPUT: TEXT_WIND_SPEED_INPUT { + idc=330; + y=0.265*safezoneH+safezoneY+0.39; + }; + class TEXT_TARGET_RANGE: TEXT_TARGET_SPEED { + idc=34; + y=0.265*safezoneH+safezoneY+0.425; + text="TR"; + action=QUOTE(0 call FUNC(toggle_target_range_assist)); + }; + class TEXT_TARGET_RANGE_INPUT: TEXT_WIND_SPEED_INPUT { + idc=340; + y=0.265*safezoneH+safezoneY+0.425; + }; + + class TEXT_ELEVATION: TEXT_GUN_PROFILE { + idc=40; + w=0.05; + x=0.550*safezoneW+safezoneX+0.11; + y=0.265*safezoneH+safezoneY+0.50; + text="Elev"; + }; + class TEXT_ABSOLUTE: TEXT_GUN_PROFILE { + idc=4003; + w=0.07; + style=ST_CENTER; + x=0.550*safezoneW+safezoneX+0.17; + y=0.265*safezoneH+safezoneY+0.47; + text="Abs"; + }; + class TEXT_RELATIVE: TEXT_ABSOLUTE { + idc=4004; + x=0.550*safezoneW+safezoneX+0.245; + text="Rel"; + }; + class TEXT_CURRENT: TEXT_ABSOLUTE { + idc=4005; + x=0.550*safezoneW+safezoneX+0.32; + text="Cur"; + }; + class TEXT_ELEVATION_OUTPUT_ABSOLUTE: ATragMX_RscEdit { + idc=400; + w=0.07; + x=0.550*safezoneW+safezoneX+0.17; + y=0.265*safezoneH+safezoneY+0.50; + text=""; + }; + class TEXT_ELEVATION_OUTPUT_RELATIVE: TEXT_ELEVATION_OUTPUT_ABSOLUTE { + idc=401; + x=0.550*safezoneW+safezoneX+0.2465; + }; + class TEXT_ELEVATION_INPUT_CURRENT: TEXT_ELEVATION_OUTPUT_ABSOLUTE { + idc=402; + x=0.550*safezoneW+safezoneX+0.323; + onKeyUp=QUOTE(if (_this select 1 == 28) then {call FUNC(parse_input); call FUNC(update_result)}); + }; + class TEXT_WINDAGE: TEXT_ELEVATION { + idc=41; + y=0.265*safezoneH+safezoneY+0.535; + text="Wind"; + }; + class TEXT_WINDAGE_OUTPUT_ABSOLUTE: TEXT_ELEVATION_OUTPUT_ABSOLUTE { + idc=410; + y=0.265*safezoneH+safezoneY+0.535; + }; + class TEXT_WINDAGE_OUTPUT_RELATIVE: TEXT_WINDAGE_OUTPUT_ABSOLUTE { + idc=411; + x=0.550*safezoneW+safezoneX+0.2465; + }; + class TEXT_WINDAGE_INPUT_CURRENT: TEXT_WINDAGE_OUTPUT_ABSOLUTE { + idc=412; + x=0.550*safezoneW+safezoneX+0.323; + onKeyUp=QUOTE(if (_this select 1 == 28) then {call FUNC(parse_input); call FUNC(update_result)}); + }; + class TEXT_LEAD: TEXT_GUN { + idc=42; + w=0.05; + x=0.550*safezoneW+safezoneX+0.11; + y=0.265*safezoneH+safezoneY+0.57; + text="Lead"; + }; + class TEXT_LEAD_OUTPUT: TEXT_ELEVATION_OUTPUT_ABSOLUTE { + idc=420; + y=0.265*safezoneH+safezoneY+0.57; + }; + class TEXT_RESET_SCOPE_ZERO: TEXT_GUN { + idc=4006; + w=0.07; + style=ST_CENTER; + colorBackground[]={0,0,0,0}; + x=0.550*safezoneW+safezoneX+0.2465; + y=0.265*safezoneH+safezoneY+0.57; + text="Reset"; + action=QUOTE(call FUNC(reset_relative_click_memory)); + }; + class TEXT_UPDATE_SCOPE_ZERO: TEXT_RESET_SCOPE_ZERO { + idc=4007; + x=0.550*safezoneW+safezoneX+0.323; + text="Update"; + action=QUOTE(call FUNC(update_relative_click_memory)); + }; + class TEXT_GUN_LIST: TEXT_GUN { + idc=4008; + style=ST_LEFT; + y=0.265*safezoneH+safezoneY+0.65; + text="GunList"; + action=QUOTE(call FUNC(toggle_gun_list)); + }; + class TEXT_SCOPE_UNIT: TEXT_GUN_LIST { + idc=2000; + style=ST_CENTER; + x=0.550*safezoneW+safezoneX+0.205; + colorBackground[]={0,0,0,0}; + text="TMOA"; + action=QUOTE(call FUNC(cycle_scope_unit)); + }; + class TEXT_CALCULATE: TEXT_SCOPE_UNIT { + idc=3000; + style=ST_RIGHT; + x=0.550*safezoneW+safezoneX+0.3; + text="Calc"; + action=QUOTE(call FUNC(calculate_target_solution)); + }; + + class TEXT_RANGE_CARD_SCOPE_UNIT: TEXT_GUN_PROFILE { + idc=5000; + text=""; + }; + class TEXT_RANGE_CARD_SETUP: ATragMX_RscButton { + idc=5001; + w=0.055675; + x=0.550*safezoneW+safezoneX+0.28; + y=0.265*safezoneH+safezoneY+0.20; + colorBackground[]={0.15,0.21,0.23,0.3}; + colorFocused[]={0.15,0.21,0.23,0.2}; + text="Setup"; + action=QUOTE(call FUNC(toggle_range_card_setup)); + }; + class TEXT_RANGE_CARD_DONE: TEXT_RANGE_CARD_SETUP { + idc=5002; + x=0.550*safezoneW+safezoneX+0.3362; + text="Done"; + action=QUOTE(call FUNC(toggle_range_card)); + }; + class TEXT_RANGE_CARD_COLUMN_1_CAPTION: ATragMX_RscButton { + idc=5003; + style=ST_LEFT; + w=0.07; + x=0.550*safezoneW+safezoneX+0.11; + y=0.265*safezoneH+safezoneY+0.24; + colorBackground[]={0.15,0.21,0.23,0.3}; + text="Meters"; + }; + class TEXT_RANGE_CARD_COLUMN_2_CAPTION: TEXT_RANGE_CARD_COLUMN_1_CAPTION { + idc=5004; + x=0.550*safezoneW+safezoneX+0.180625; + text="Elev"; + }; + class TEXT_RANGE_CARD_COLUMN_3_CAPTION: TEXT_RANGE_CARD_COLUMN_1_CAPTION { + idc=5005; + x=0.550*safezoneW+safezoneX+0.25125; + text="Wind"; + }; + class TEXT_RANGE_CARD_COLUMN_4_CAPTION: TEXT_RANGE_CARD_COLUMN_1_CAPTION { + idc=5006; + x=0.550*safezoneW+safezoneX+0.321875; + text="TmFlt"; + action=QUOTE(call FUNC(cycle_range_card_columns)); + }; + class TEXT_RANGE_CARD_OUTPUT: ATragMX_RscListNBox { + idc=5007; + idcLeft=50061; + idcRight=50062; + w=0.285; + h=0.42; + x=0.550*safezoneW+safezoneX+0.11; + y=0.265*safezoneH+safezoneY+0.27; + }; + + class TEXT_GUN_LIST_OUTPUT: ATragMX_RscListBox { + idc=6000; + w=0.16; + h=0.45; + x=0.550*safezoneW+safezoneX+0.11; + y=0.265*safezoneH+safezoneY+0.24; + colorSelectBackground[]={0.15,0.21,0.23,0.3}; + colorSelectBackground2[]={0.15,0.21,0.23,0.3}; + onMouseButtonDblClick=QUOTE(true call FUNC(toggle_gun_list)); + }; + class TEXT_GUN_LIST_COLUMN_CAPTION: TEXT_GUN_PROFILE { + idc=6001; + w=0.16; + colorBackground[]={0.15,0.21,0.23,0.3}; + text="AtragGun.gun"; + }; + class TEXT_GUN_LIST_OPEN_GUN: ATragMX_RscButton { + idc=6002; + style=ST_RIGHT; + w=0.115; + x=0.550*safezoneW+safezoneX+0.28; + y=0.265*safezoneH+safezoneY+0.20; + colorBackground[]={0.15,0.21,0.23,0.3}; + colorFocused[]={0.15,0.21,0.23,0.2}; + sizeEx=0.024; + text="Open Gun"; + action=QUOTE(true call FUNC(toggle_gun_list)); + }; + class TEXT_GUN_LIST_SAVE_GUN: TEXT_GUN_LIST_OPEN_GUN { + idc=6003; + y=0.265*safezoneH+safezoneY+0.24; + text="Save Gun"; + action=QUOTE(call FUNC(save_gun)); + }; + class TEXT_GUN_LIST_ADD_NEW_GUN: TEXT_GUN_LIST_OPEN_GUN { + idc=6004; + y=0.265*safezoneH+safezoneY+0.28; + text="Add New Gun"; + action=QUOTE(false call FUNC(show_gun_list); true call FUNC(show_add_new_gun)); + }; + class TEXT_GUN_LIST_DELETE_GUN: TEXT_GUN_LIST_OPEN_GUN { + idc=6005; + y=0.265*safezoneH+safezoneY+0.34; + text="Delete Gun"; + action=QUOTE(call FUNC(delete_gun)); + }; + class TEXT_GUN_LIST_NOTE: TEXT_GUN_LIST_OPEN_GUN { + idc=6006; + y=0.265*safezoneH+safezoneY+0.40; + text="Note"; + }; + class TEXT_GUN_LIST_DONE: TEXT_GUN_LIST_OPEN_GUN { + idc=6007; + y=0.265*safezoneH+safezoneY+0.65; + text="Done"; + action=QUOTE(false call FUNC(toggle_gun_list)); + }; + + class TEXT_TARGET_RANGE_ASSIST_CAPTION: ATragMX_RscText { + idc=7000; + style=16+0x200; + lineSpacing=1.0; + x=0.550*safezoneW+safezoneX+0.11; + y=0.265*safezoneH+safezoneY+0.24; + w=0.29; + h=0.10; + sizeEx=0.022; + text="When using WIDTH to size a target, UP/Down Angle does not effect range calculation but will effect bullet drop."; + }; + class TEXT_TARGET_RANGE_ASSIST_MEASUREMENT_METHOD: TEXT_TARGET_RANGE_ASSIST_CAPTION { + idc=7001; + style=ST_LEFT; + x=0.550*safezoneW+safezoneX+0.115; + y=0.265*safezoneH+safezoneY+0.35; + w=0.12; + h=0.03; + sizeEx=0.027; + text="Using Target:"; + }; + class TEXT_TARGET_RANGE_ASSIST_WIDTH_HEIGHT: ATragMX_RscToolbox { + idc=7002; + w=0.14; + x=0.550*safezoneW+safezoneX+0.24; + y=0.265*safezoneH+safezoneY+0.35; + strings[]={"Height","Width"}; + values[]={1,0}; + onToolBoxSelChanged="GVAR(rangeAssistUseTargetHeight)=((_this select 1)==0)"; + }; + class TEXT_TARGET_RANGE_ASSIST_TARGET_SIZE: TEXT_TARGET_RANGE_ASSIST_MEASUREMENT_METHOD { + idc=7003; + style=ST_RIGHT; + x=0.550*safezoneW+safezoneX+0.10; + y=0.265*safezoneH+safezoneY+0.4; + text="Target Size"; + }; + class TEXT_TARGET_RANGE_ASSIST_IMAGE_SIZE: TEXT_TARGET_RANGE_ASSIST_TARGET_SIZE { + idc=7004; + y=0.265*safezoneH+safezoneY+0.45; + text="Image Size"; + }; + class TEXT_TARGET_RANGE_ASSIST_ANGLE: TEXT_TARGET_RANGE_ASSIST_TARGET_SIZE { + idc=7005; + y=0.265*safezoneH+safezoneY+0.5; + text="Angle"; + }; + class TEXT_TARGET_RANGE_ASSIST_ESTIMATED_RANGE: TEXT_TARGET_RANGE_ASSIST_TARGET_SIZE { + idc=7006; + y=0.265*safezoneH+safezoneY+0.55; + text="Est Range"; + }; + class TEXT_TARGET_RANGE_ASSIST_CALC_1: TEXT_MUZZLE_VELOCITY { + idc=7007; + w=0.0231; + x=0.550*safezoneW+safezoneX+0.22; + y=0.265*safezoneH+safezoneY+0.4; + sizeEx=0.03; + text="!"; + action=QUOTE(0 call FUNC(calculate_target_range_assist)); + }; + class TEXT_TARGET_RANGE_ASSIST_CALC_2: TEXT_TARGET_RANGE_ASSIST_CALC_1 { + idc=7008; + y=0.265*safezoneH+safezoneY+0.45; + action=QUOTE(1 call FUNC(calculate_target_range_assist)); + }; + class TEXT_TARGET_RANGE_ASSIST_CALC_3: TEXT_TARGET_RANGE_ASSIST_CALC_1 { + idc=7009; + y=0.265*safezoneH+safezoneY+0.55; + action=QUOTE(2 call FUNC(calculate_target_range_assist)); + }; + class TEXT_TARGET_RANGE_ASSIST_TARGET_SIZE_INPUT: ATragMX_RscEdit { + idc=7010; + w=0.065; + x=0.550*safezoneW+safezoneX+0.2475; + y=0.265*safezoneH+safezoneY+0.4; + }; + class TEXT_TARGET_RANGE_ASSIST_IMAGE_SIZE_INPUT: TEXT_TARGET_RANGE_ASSIST_TARGET_SIZE_INPUT { + idc=7011; + y=0.265*safezoneH+safezoneY+0.45; + }; + class TEXT_TARGET_RANGE_ASSIST_ANGLE_INPUT: TEXT_TARGET_RANGE_ASSIST_TARGET_SIZE_INPUT { + idc=7012; + y=0.265*safezoneH+safezoneY+0.5; + }; + class TEXT_TARGET_RANGE_ASSIST_ESTIMATED_RANGE_INPUT: TEXT_TARGET_RANGE_ASSIST_TARGET_SIZE_INPUT { + idc=7013; + y=0.265*safezoneH+safezoneY+0.55; + }; + class TEXT_TARGET_RANGE_ASSIST_TARGET_SIZE_UNIT: TEXT_TARGET_RANGE_ASSIST_CALC_1 { + idc=7014; + 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)]); + }; + 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)]); + }; + class TEXT_TARGET_RANGE_ASSIST_ESTIMATED_RANGE_UNIT: TEXT_TARGET_RANGE_ASSIST_ESTIMATED_RANGE { + idc=7016; + style=ST_LEFT; + w=0.07; + x=0.550*safezoneW+safezoneX+0.32; + text="Meters"; + }; + class TEXT_TARGET_RANGE_ASSIST_DONE: ATragMX_RscButton { + idc=7017; + style=ST_CENTER; + w=0.07; + x=0.550*safezoneW+safezoneX+0.11; + y=0.265*safezoneH+safezoneY+0.60; + colorBackground[]={0.15,0.21,0.23,0.3}; + colorFocused[]={0.15,0.21,0.23,0.2}; + text="Done"; + action=QUOTE(1 call FUNC(toggle_target_range_assist)); + }; + class TEXT_TARGET_RANGE_ASSIST_CANCEL: TEXT_TARGET_RANGE_ASSIST_DONE { + idc=7018; + x=0.550*safezoneW+safezoneX+0.180625; + text="Cancel"; + action=QUOTE(0 call FUNC(toggle_target_range_assist)); + }; + class TEXT_TARGET_RANGE_ASSIST_PREV: TEXT_TARGET_RANGE_ASSIST_DONE { + idc=7019; + x=0.550*safezoneW+safezoneX+0.25125; + text="Prev"; + action=""; + }; + class TEXT_TARGET_RANGE_ASSIST_NEXT: TEXT_TARGET_RANGE_ASSIST_DONE { + idc=7020; + x=0.550*safezoneW+safezoneX+0.321875; + text="Next"; + action=""; + }; + + class TEXT_TARGET_SPEED_ASSIST_TARGET_RANGE: TEXT_TARGET_RANGE_ASSIST_TARGET_SIZE { + idc=8000; + x=0.550*safezoneW+safezoneX+0.12; + 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; + text="Num Ticks"; + }; + class TEXT_TARGET_SPEED_ASSIST_TIME: TEXT_TARGET_RANGE_ASSIST_ANGLE { + idc=8002; + x=0.550*safezoneW+safezoneX+0.12; + 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; + text="Est Speed"; + }; + class TEXT_TARGET_SPEED_ASSIST_TARGET_RANGE_INPUT: TEXT_TARGET_RANGE_ASSIST_TARGET_SIZE_INPUT { + idc=8004; + onKeyUp=QUOTE(if (_this select 1 == 28) then {call FUNC(calculate_target_speed_assist)}); + }; + class TEXT_TARGET_SPEED_ASSIST_NUM_TICKS_INPUT: TEXT_TARGET_RANGE_ASSIST_IMAGE_SIZE_INPUT { + idc=8005; + onKeyUp=QUOTE(if (_this select 1 == 28) then {call FUNC(calculate_target_speed_assist)}); + }; + class TEXT_TARGET_SPEED_ASSIST_TIME_INPUT: TEXT_TARGET_RANGE_ASSIST_ANGLE_INPUT { + idc=8006; + onKeyUp=QUOTE(if (_this select 1 == 28) then {call FUNC(calculate_target_speed_assist)}); + }; + class TEXT_TARGET_SPEED_ASSIST_TARGET_ESTIMATED_SPEED_OUTPUT: TEXT_TARGET_RANGE_ASSIST_ESTIMATED_RANGE { + idc=8007; + w=0.065; + x=0.550*safezoneW+safezoneX+0.2475; + y=0.265*safezoneH+safezoneY+0.55; + colorBackground[]={0.15,0.21,0.23,0.3}; + text="0"; + }; + class TEXT_TARGET_SPEED_ASSIST_TARGET_RANGE_UNIT: TEXT_TARGET_RANGE_ASSIST_ESTIMATED_RANGE_UNIT { + idc=8008; + y=0.265*safezoneH+safezoneY+0.4; + text="Meters"; + }; + 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)); + }; + class TEXT_TARGET_SPEED_ASSIST_TIMER_START: TEXT_TARGET_RANGE_ASSIST_IMAGE_SIZE_UNIT { + idc=8010; + y=0.265*safezoneH+safezoneY+0.5; + text="Start"; + action=QUOTE(call FUNC(target_speed_assist_timer)); + }; + class TEXT_TARGET_SPEED_ASSIST_TARGET_ESTIMATED_SPEED_UNIT: TEXT_TARGET_RANGE_ASSIST_ESTIMATED_RANGE_UNIT { + idc=8011; + text="m/s"; + }; + class TEXT_TARGET_SPEED_ASSIST_DONE: TEXT_TARGET_RANGE_ASSIST_DONE { + idc=8012; + action=QUOTE(1 call FUNC(toggle_target_speed_assist)); + }; + class TEXT_TARGET_SPEED_ASSIST_CANCEL: TEXT_TARGET_RANGE_ASSIST_CANCEL { + idc=8013; + action=QUOTE(0 call FUNC(toggle_target_speed_assist)); + }; + class TEXT_TARGET_SPEED_ASSIST_PREV: TEXT_TARGET_RANGE_ASSIST_PREV { + idc=8014; + }; + class TEXT_TARGET_SPEED_ASSIST_NEXT: TEXT_TARGET_RANGE_ASSIST_NEXT { + idc=8015; + }; + + class TEXT_TARGET_SPEED_ASSIST_TIMER_STOP_BACKGROUND: ATragMX_RscButton { + idc=9000; + w=0.285; + h=0.49; + x=0.550*safezoneW+safezoneX+0.11; + y=0.265*safezoneH+safezoneY+0.2; + colorBackground[]={0,0,0,0}; + colorBackgroundActive[]={0,0,0,0}; + action=QUOTE(GVAR(speedAssistTimer)=false); + }; + class TEXT_TARGET_SPEED_ASSIST_TIME_OUTPUT: ATragMX_RscText { + idc=9001; + x=0.550*safezoneW+safezoneX+0.22; + y=0.265*safezoneH+safezoneY+0.51; + w=0.08; + h=0.09; + style=ST_CENTER; + sizeEx=0.05; + text="0.0"; + }; + class TEXT_TARGET_SPEED_ASSIST_TIMER_STOP: ATragMX_RscButton { + idc=9002; + style=ST_CENTER; + w=0.07; + h=0.04; + x=0.550*safezoneW+safezoneX+0.225; + y=0.265*safezoneH+safezoneY+0.60; + colorBackground[]={0.15,0.21,0.23,0.3}; + colorFocused[]={0.15,0.21,0.23,0.2}; + text="Stop"; + action=QUOTE(GVAR(speedAssistTimer)=false); + }; + + class TEXT_RANGE_CARD_SETUP_START_RANGE: TEXT_TARGET_RANGE_ASSIST_TARGET_SIZE { + idc=10000; + x=0.550*safezoneW+safezoneX+0.12; + text="Start Range"; + }; + class TEXT_RANGE_CARD_SETUP_END_RANGE: TEXT_TARGET_RANGE_ASSIST_IMAGE_SIZE { + idc=10001; + x=0.550*safezoneW+safezoneX+0.12; + text="End Range"; + }; + class TEXT_RANGE_CARD_SETUP_INCREMENT: TEXT_TARGET_RANGE_ASSIST_ANGLE { + idc=10002; + x=0.550*safezoneW+safezoneX+0.12; + text="Increment"; + }; + class TEXT_RANGE_CARD_SETUP_START_RANGE_INPUT: TEXT_TARGET_RANGE_ASSIST_TARGET_SIZE_INPUT { + idc=10003; + onKeyUp=QUOTE(if (_this select 1 == 28) then {1 call FUNC(toggle_range_card_setup)}); + }; + class TEXT_RANGE_CARD_SETUP_END_RANGE_INPUT: TEXT_TARGET_RANGE_ASSIST_IMAGE_SIZE_INPUT { + idc=10004; + onKeyUp=QUOTE(if (_this select 1 == 28) then {1 call FUNC(toggle_range_card_setup)}); + }; + class TEXT_RANGE_CARD_SETUP_INCREMENT_INPUT: TEXT_TARGET_RANGE_ASSIST_ANGLE_INPUT { + idc=10005; + onKeyUp=QUOTE(if (_this select 1 == 28) then {1 call FUNC(toggle_range_card_setup)}); + }; + class TEXT_RANGE_CARD_SETUP_DONE: TEXT_TARGET_SPEED_ASSIST_DONE { + idc=10006; + action=QUOTE(1 call FUNC(toggle_range_card_setup)); + }; + class TEXT_RANGE_CARD_SETUP_CANCEL: TEXT_TARGET_SPEED_ASSIST_CANCEL { + idc=10007; + action=QUOTE(0 call FUNC(toggle_range_card_setup)); + }; + class TEXT_RANGE_CARD_SETUP_PREV: TEXT_TARGET_SPEED_ASSIST_PREV { + idc=10008; + }; + class TEXT_RANGE_CARD_SETUP_NEXT: TEXT_TARGET_SPEED_ASSIST_NEXT { + idc=10009; + }; + + class TEXT_ADD_NEW_GUN_CAPTION: ATragMX_RscText { + idc=11000; + style=ST_LEFT; + w=0.25; + h=0.04; + x=0.550*safezoneW+safezoneX+0.12; + y=0.265*safezoneH+safezoneY+0.24; + sizeEx=0.025; + text="New Gun Name"; + }; + class TEXT_ADD_NEW_GUN_GUN_NAME_INPUT: ATragMX_RscEdit { + idc=11001; + style=ST_LEFT; + w=0.225; + h=0.04; + x=0.550*safezoneW+safezoneX+0.12; + y=0.265*safezoneH+safezoneY+0.28; + text=""; + }; + class TEXT_ADD_NEW_GUN_OK: ATragMX_RscButton { + idc=11002; + style=ST_CENTER; + w=0.1; + h=0.04; + x=0.550*safezoneW+safezoneX+0.12; + y=0.265*safezoneH+safezoneY+0.33; + colorBackground[]={0.15,0.21,0.23,0.3}; + colorFocused[]={0.15,0.21,0.23,0.2}; + text="OK"; + action=QUOTE(call FUNC(add_new_gun); false call FUNC(show_add_new_gun); true call FUNC(show_gun_list)); + }; + class TEXT_ADD_NEW_GUN_CANCEL: TEXT_ADD_NEW_GUN_OK { + idc=11003; + x=0.550*safezoneW+safezoneX+0.245; + text="Cancel"; + action=QUOTE(false call FUNC(show_add_new_gun); true call FUNC(show_gun_list)); + }; + }; +}; \ No newline at end of file diff --git a/addons/atragmx/UI/ATRAG.paa b/addons/atragmx/UI/ATRAG.paa new file mode 100644 index 0000000000..5708a35786 Binary files /dev/null and b/addons/atragmx/UI/ATRAG.paa differ diff --git a/addons/atragmx/UI/ATRAG_Icon.paa b/addons/atragmx/UI/ATRAG_Icon.paa new file mode 100644 index 0000000000..e233e510ef Binary files /dev/null and b/addons/atragmx/UI/ATRAG_Icon.paa differ diff --git a/addons/atragmx/XEH_postInit.sqf b/addons/atragmx/XEH_postInit.sqf new file mode 100644 index 0000000000..6875b4382e --- /dev/null +++ b/addons/atragmx/XEH_postInit.sqf @@ -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); diff --git a/addons/atragmx/XEH_preInit.sqf b/addons/atragmx/XEH_preInit.sqf new file mode 100644 index 0000000000..91024d05a3 --- /dev/null +++ b/addons/atragmx/XEH_preInit.sqf @@ -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; diff --git a/addons/atragmx/config.cpp b/addons/atragmx/config.cpp new file mode 100644 index 0000000000..3abe32ba34 --- /dev/null +++ b/addons/atragmx/config.cpp @@ -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" \ No newline at end of file diff --git a/addons/atragmx/data/tdsrecon.p3d b/addons/atragmx/data/tdsrecon.p3d new file mode 100644 index 0000000000..d82ac22f42 Binary files /dev/null and b/addons/atragmx/data/tdsrecon.p3d differ diff --git a/addons/atragmx/data/tdsrecon.rvmat b/addons/atragmx/data/tdsrecon.rvmat new file mode 100644 index 0000000000..5bd4ef36e5 --- /dev/null +++ b/addons/atragmx/data/tdsrecon.rvmat @@ -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"; +}; diff --git a/addons/atragmx/data/tdsrecon_co.paa b/addons/atragmx/data/tdsrecon_co.paa new file mode 100644 index 0000000000..0938d580de Binary files /dev/null and b/addons/atragmx/data/tdsrecon_co.paa differ diff --git a/addons/atragmx/data/tdsrecon_nohq.paa b/addons/atragmx/data/tdsrecon_nohq.paa new file mode 100644 index 0000000000..89744d13af Binary files /dev/null and b/addons/atragmx/data/tdsrecon_nohq.paa differ diff --git a/addons/atragmx/functions/fnc_add_new_gun.sqf b/addons/atragmx/functions/fnc_add_new_gun.sqf new file mode 100644 index 0000000000..bac04c2e07 --- /dev/null +++ b/addons/atragmx/functions/fnc_add_new_gun.sqf @@ -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)]; +}; diff --git a/addons/atragmx/functions/fnc_calculate_range_card.sqf b/addons/atragmx/functions/fnc_calculate_range_card.sqf new file mode 100644 index 0000000000..05625a53f6 --- /dev/null +++ b/addons/atragmx/functions/fnc_calculate_range_card.sqf @@ -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); diff --git a/addons/atragmx/functions/fnc_calculate_scope_base_angle.sqf b/addons/atragmx/functions/fnc_calculate_scope_base_angle.sqf new file mode 100644 index 0000000000..4822b08b37 --- /dev/null +++ b/addons/atragmx/functions/fnc_calculate_scope_base_angle.sqf @@ -0,0 +1,39 @@ +/* + * Author: Ruthberg + * Calculates a new scope base angle + * + * Arguments: + * 0: Bullet mass + * 1: Bore height + * 2: air friction + * 3: muzzle velocity + * 4: zero range + * + * Return Value: + * scope base angle + * + * 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 diff --git a/addons/atragmx/functions/fnc_calculate_solution.sqf b/addons/atragmx/functions/fnc_calculate_solution.sqf new file mode 100644 index 0000000000..90263a608c --- /dev/null +++ b/addons/atragmx/functions/fnc_calculate_solution.sqf @@ -0,0 +1,157 @@ +/* + * Author: Ruthberg + * Calculates the fireing solution + * + * Arguments: + * 0: Scope base angle + * 1: Bullet mass + * 2: Bore height + * 3: air friction + * 4: muzzle velocity + * 5: temperature + * 6: barometric pressure + * 7: relative humidity + * 8: simulation steps + * 9: wind speed + * 10: wind direction + * 11: inclination angle + * 12: target speed + * 13: target range + * 14: ballistic coefficient + * 15: drag model + * 16: atmosphere model + * 17: Store range card data? + * + * Return Value: + * 0: Elevation + * 1: Windage + * 2: Lead + * 3: Time of fligth + * 4: Remaining velocity + * 4: Remaining kinetic energy + * + * 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] diff --git a/addons/atragmx/functions/fnc_calculate_target_range_assist.sqf b/addons/atragmx/functions/fnc_calculate_target_range_assist.sqf new file mode 100644 index 0000000000..6280f19339 --- /dev/null +++ b/addons/atragmx/functions/fnc_calculate_target_range_assist.sqf @@ -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))]; + }; +}; diff --git a/addons/atragmx/functions/fnc_calculate_target_solution.sqf b/addons/atragmx/functions/fnc_calculate_target_solution.sqf new file mode 100644 index 0000000000..57783d9cca --- /dev/null +++ b/addons/atragmx/functions/fnc_calculate_target_solution.sqf @@ -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); diff --git a/addons/atragmx/functions/fnc_calculate_target_speed_assist.sqf b/addons/atragmx/functions/fnc_calculate_target_speed_assist.sqf new file mode 100644 index 0000000000..7ee7e9ff78 --- /dev/null +++ b/addons/atragmx/functions/fnc_calculate_target_speed_assist.sqf @@ -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)]; diff --git a/addons/atragmx/functions/fnc_can_show.sqf b/addons/atragmx/functions/fnc_can_show.sqf new file mode 100644 index 0000000000..7054e85cf9 --- /dev/null +++ b/addons/atragmx/functions/fnc_can_show.sqf @@ -0,0 +1,18 @@ +/* + * Authors: Ruthberg + * Tests if the ATragMX dialog can be shown + * + * Arguments: + * Nothing + * + * Return Value: + * can_show + * + * 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); diff --git a/addons/atragmx/functions/fnc_change_gun.sqf b/addons/atragmx/functions/fnc_change_gun.sqf new file mode 100644 index 0000000000..259441d51d --- /dev/null +++ b/addons/atragmx/functions/fnc_change_gun.sqf @@ -0,0 +1,38 @@ +/* + * Author: Ruthberg + * Selects a new gun profile and updates the gun column and the result input/output fields + * + * Arguments: + * gunID + * + * 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); diff --git a/addons/atragmx/functions/fnc_create_dialog.sqf b/addons/atragmx/functions/fnc_create_dialog.sqf new file mode 100644 index 0000000000..01cdcba184 --- /dev/null +++ b/addons/atragmx/functions/fnc_create_dialog.sqf @@ -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 diff --git a/addons/atragmx/functions/fnc_cycle_range_card_columns.sqf b/addons/atragmx/functions/fnc_cycle_range_card_columns.sqf new file mode 100644 index 0000000000..9de1baee61 --- /dev/null +++ b/addons/atragmx/functions/fnc_cycle_range_card_columns.sqf @@ -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); diff --git a/addons/atragmx/functions/fnc_cycle_scope_unit.sqf b/addons/atragmx/functions/fnc_cycle_scope_unit.sqf new file mode 100644 index 0000000000..99704220d4 --- /dev/null +++ b/addons/atragmx/functions/fnc_cycle_scope_unit.sqf @@ -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); diff --git a/addons/atragmx/functions/fnc_delete_gun.sqf b/addons/atragmx/functions/fnc_delete_gun.sqf new file mode 100644 index 0000000000..d16e1f84a0 --- /dev/null +++ b/addons/atragmx/functions/fnc_delete_gun.sqf @@ -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)]; diff --git a/addons/atragmx/functions/fnc_init.sqf b/addons/atragmx/functions/fnc_init.sqf new file mode 100644 index 0000000000..3f46a71fe2 --- /dev/null +++ b/addons/atragmx/functions/fnc_init.sqf @@ -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]; diff --git a/addons/atragmx/functions/fnc_parse_input.sqf b/addons/atragmx/functions/fnc_parse_input.sqf new file mode 100644 index 0000000000..4a525dcad8 --- /dev/null +++ b/addons/atragmx/functions/fnc_parse_input.sqf @@ -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); diff --git a/addons/atragmx/functions/fnc_reset_relative_click_memory.sqf b/addons/atragmx/functions/fnc_reset_relative_click_memory.sqf new file mode 100644 index 0000000000..1a20af7452 --- /dev/null +++ b/addons/atragmx/functions/fnc_reset_relative_click_memory.sqf @@ -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); diff --git a/addons/atragmx/functions/fnc_save_gun.sqf b/addons/atragmx/functions/fnc_save_gun.sqf new file mode 100644 index 0000000000..d797939991 --- /dev/null +++ b/addons/atragmx/functions/fnc_save_gun.sqf @@ -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)]; diff --git a/addons/atragmx/functions/fnc_show_add_new_gun.sqf b/addons/atragmx/functions/fnc_show_add_new_gun.sqf new file mode 100644 index 0000000000..12815194dd --- /dev/null +++ b/addons/atragmx/functions/fnc_show_add_new_gun.sqf @@ -0,0 +1,18 @@ +/* + * Author: Ruthberg + * Shows/Hides add new gun controls + * + * Arguments: + * visible - + * + * 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]; \ No newline at end of file diff --git a/addons/atragmx/functions/fnc_show_gun_list.sqf b/addons/atragmx/functions/fnc_show_gun_list.sqf new file mode 100644 index 0000000000..c34784e27a --- /dev/null +++ b/addons/atragmx/functions/fnc_show_gun_list.sqf @@ -0,0 +1,18 @@ +/* + * Author: Ruthberg + * Shows/Hides the gun list controls + * + * Arguments: + * visible - + * + * 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]; \ No newline at end of file diff --git a/addons/atragmx/functions/fnc_show_main_page.sqf b/addons/atragmx/functions/fnc_show_main_page.sqf new file mode 100644 index 0000000000..5eaf5eb560 --- /dev/null +++ b/addons/atragmx/functions/fnc_show_main_page.sqf @@ -0,0 +1,19 @@ +/* + * Author: Ruthberg + * Shows/Hides the main menu controls + * + * Arguments: + * visible - + * + * 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]; diff --git a/addons/atragmx/functions/fnc_show_range_card.sqf b/addons/atragmx/functions/fnc_show_range_card.sqf new file mode 100644 index 0000000000..655630f6c5 --- /dev/null +++ b/addons/atragmx/functions/fnc_show_range_card.sqf @@ -0,0 +1,18 @@ +/* + * Author: Ruthberg + * Shows/Hides the range card controls + * + * Arguments: + * visible - + * + * 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]; diff --git a/addons/atragmx/functions/fnc_show_range_card_setup.sqf b/addons/atragmx/functions/fnc_show_range_card_setup.sqf new file mode 100644 index 0000000000..3ed8cb5184 --- /dev/null +++ b/addons/atragmx/functions/fnc_show_range_card_setup.sqf @@ -0,0 +1,18 @@ +/* + * Author: Ruthberg + * Shows/Hides the range card setup controls + * + * Arguments: + * visible - + * + * 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]; diff --git a/addons/atragmx/functions/fnc_show_target_range_assist.sqf b/addons/atragmx/functions/fnc_show_target_range_assist.sqf new file mode 100644 index 0000000000..964e5f93d0 --- /dev/null +++ b/addons/atragmx/functions/fnc_show_target_range_assist.sqf @@ -0,0 +1,18 @@ +/* + * Author: Ruthberg + * Shows/Hides the target range assist controls + * + * Arguments: + * visible - + * + * 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]; diff --git a/addons/atragmx/functions/fnc_show_target_speed_assist.sqf b/addons/atragmx/functions/fnc_show_target_speed_assist.sqf new file mode 100644 index 0000000000..ce1e8588b9 --- /dev/null +++ b/addons/atragmx/functions/fnc_show_target_speed_assist.sqf @@ -0,0 +1,18 @@ +/* + * Author: Ruthberg + * Shows/Hides the target speed assist controls + * + * Arguments: + * visible - + * + * 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]; diff --git a/addons/atragmx/functions/fnc_show_target_speed_assist_timer.sqf b/addons/atragmx/functions/fnc_show_target_speed_assist_timer.sqf new file mode 100644 index 0000000000..5b809b7ca9 --- /dev/null +++ b/addons/atragmx/functions/fnc_show_target_speed_assist_timer.sqf @@ -0,0 +1,18 @@ +/* + * Author: Ruthberg + * Shows/Hides the target speed assist timer controls + * + * Arguments: + * visible - + * + * 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]; diff --git a/addons/atragmx/functions/fnc_sord.sqf b/addons/atragmx/functions/fnc_sord.sqf new file mode 100644 index 0000000000..650993cff3 --- /dev/null +++ b/addons/atragmx/functions/fnc_sord.sqf @@ -0,0 +1,27 @@ +/* + * Author: Ruthberg + * Handles incoming data packets from the Vectronix Vector LRF + * + * Arguments: + * 0: Slope distance (Meters) + * 1: Azimuth (Degrees) + * 2: Inclination (Degrees) + * + * 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]; diff --git a/addons/atragmx/functions/fnc_target_speed_assist_timer.sqf b/addons/atragmx/functions/fnc_target_speed_assist_timer.sqf new file mode 100644 index 0000000000..90acd1a84f --- /dev/null +++ b/addons/atragmx/functions/fnc_target_speed_assist_timer.sqf @@ -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; +}; diff --git a/addons/atragmx/functions/fnc_toggle_gun_list.sqf b/addons/atragmx/functions/fnc_toggle_gun_list.sqf new file mode 100644 index 0000000000..4e24e4cb77 --- /dev/null +++ b/addons/atragmx/functions/fnc_toggle_gun_list.sqf @@ -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))]; +}; diff --git a/addons/atragmx/functions/fnc_toggle_range_card.sqf b/addons/atragmx/functions/fnc_toggle_range_card.sqf new file mode 100644 index 0000000000..6a5c386de7 --- /dev/null +++ b/addons/atragmx/functions/fnc_toggle_range_card.sqf @@ -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); +}; diff --git a/addons/atragmx/functions/fnc_toggle_range_card_setup.sqf b/addons/atragmx/functions/fnc_toggle_range_card_setup.sqf new file mode 100644 index 0000000000..28534c9dd9 --- /dev/null +++ b/addons/atragmx/functions/fnc_toggle_range_card_setup.sqf @@ -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)))]; +}; diff --git a/addons/atragmx/functions/fnc_toggle_target_range_assist.sqf b/addons/atragmx/functions/fnc_toggle_target_range_assist.sqf new file mode 100644 index 0000000000..352a6d0e1f --- /dev/null +++ b/addons/atragmx/functions/fnc_toggle_target_range_assist.sqf @@ -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"]; + }; +}; diff --git a/addons/atragmx/functions/fnc_toggle_target_speed_assist.sqf b/addons/atragmx/functions/fnc_toggle_target_speed_assist.sqf new file mode 100644 index 0000000000..0bda7ad019 --- /dev/null +++ b/addons/atragmx/functions/fnc_toggle_target_speed_assist.sqf @@ -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"]; + }; +}; diff --git a/addons/atragmx/functions/fnc_update_atmosphere.sqf b/addons/atragmx/functions/fnc_update_atmosphere.sqf new file mode 100644 index 0000000000..91f1831b04 --- /dev/null +++ b/addons/atragmx/functions/fnc_update_atmosphere.sqf @@ -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)]; diff --git a/addons/atragmx/functions/fnc_update_gun.sqf b/addons/atragmx/functions/fnc_update_gun.sqf new file mode 100644 index 0000000000..cd80e5f122 --- /dev/null +++ b/addons/atragmx/functions/fnc_update_gun.sqf @@ -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); diff --git a/addons/atragmx/functions/fnc_update_range_card.sqf b/addons/atragmx/functions/fnc_update_range_card.sqf new file mode 100644 index 0000000000..546c38d24c --- /dev/null +++ b/addons/atragmx/functions/fnc_update_range_card.sqf @@ -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); diff --git a/addons/atragmx/functions/fnc_update_relative_click_memory.sqf b/addons/atragmx/functions/fnc_update_relative_click_memory.sqf new file mode 100644 index 0000000000..378124ad4f --- /dev/null +++ b/addons/atragmx/functions/fnc_update_relative_click_memory.sqf @@ -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); diff --git a/addons/atragmx/functions/fnc_update_result.sqf b/addons/atragmx/functions/fnc_update_result.sqf new file mode 100644 index 0000000000..11ff8a314e --- /dev/null +++ b/addons/atragmx/functions/fnc_update_result.sqf @@ -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)]; diff --git a/addons/atragmx/functions/fnc_update_scope_unit.sqf b/addons/atragmx/functions/fnc_update_scope_unit.sqf new file mode 100644 index 0000000000..2a4435c376 --- /dev/null +++ b/addons/atragmx/functions/fnc_update_scope_unit.sqf @@ -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))]; diff --git a/addons/atragmx/functions/fnc_update_target.sqf b/addons/atragmx/functions/fnc_update_target.sqf new file mode 100644 index 0000000000..18d7a72cd2 --- /dev/null +++ b/addons/atragmx/functions/fnc_update_target.sqf @@ -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))))]; +}; diff --git a/addons/atragmx/functions/fnc_update_target_selection.sqf b/addons/atragmx/functions/fnc_update_target_selection.sqf new file mode 100644 index 0000000000..d48412def0 --- /dev/null +++ b/addons/atragmx/functions/fnc_update_target_selection.sqf @@ -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); diff --git a/addons/atragmx/functions/fnc_update_unit_selection.sqf b/addons/atragmx/functions/fnc_update_unit_selection.sqf new file mode 100644 index 0000000000..dacc228032 --- /dev/null +++ b/addons/atragmx/functions/fnc_update_unit_selection.sqf @@ -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); diff --git a/addons/atragmx/functions/fnc_update_zero_range.sqf b/addons/atragmx/functions/fnc_update_zero_range.sqf new file mode 100644 index 0000000000..15e65c38a6 --- /dev/null +++ b/addons/atragmx/functions/fnc_update_zero_range.sqf @@ -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]; diff --git a/addons/atragmx/functions/script_component.hpp b/addons/atragmx/functions/script_component.hpp new file mode 100644 index 0000000000..6e49f39695 --- /dev/null +++ b/addons/atragmx/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\atragmx\script_component.hpp" \ No newline at end of file diff --git a/addons/atragmx/initKeybinds.sqf b/addons/atragmx/initKeybinds.sqf new file mode 100644 index 0000000000..28616b872f --- /dev/null +++ b/addons/atragmx/initKeybinds.sqf @@ -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) \ No newline at end of file diff --git a/addons/atragmx/script_component.hpp b/addons/atragmx/script_component.hpp new file mode 100644 index 0000000000..062df59d19 --- /dev/null +++ b/addons/atragmx/script_component.hpp @@ -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" \ No newline at end of file diff --git a/addons/atragmx/stringtable.xml b/addons/atragmx/stringtable.xml new file mode 100644 index 0000000000..7385eee22f --- /dev/null +++ b/addons/atragmx/stringtable.xml @@ -0,0 +1,26 @@ + + + + + ATragMX + ATragMX + ATragMX + ATragMX + ATragMX + ATragMX + ATragMX + ATragMX + ATragMX + ATragMX + + + Open ATragMX + + + Rugged PDA with ATragMX + + + Open ATragMX + + + diff --git a/extras/manual_Horus_ATrag-v385.pdf b/extras/manual_Horus_ATrag-v385.pdf new file mode 100644 index 0000000000..e3b4a0555d Binary files /dev/null and b/extras/manual_Horus_ATrag-v385.pdf differ