diff --git a/addons/atragmx/RscTitles.hpp b/addons/atragmx/RscTitles.hpp index 2194b2b27a..94416aba23 100644 --- a/addons/atragmx/RscTitles.hpp +++ b/addons/atragmx/RscTitles.hpp @@ -1338,6 +1338,16 @@ class ATragMX_Display { idc=140050; y=0.265*safezoneH+safezoneY+0.480; }; + class TEXT_TARGET_DATA_TARGET_SPEED_DIRECTION: ATragMX_RscButton { + idc=140051; + colorBackground[]={0.15,0.21,0.23,0.3}; + colorFocused[]={0.15,0.21,0.23,0.2}; + w=0.0231; + x=0.550*safezoneW+safezoneX+0.305; + y=0.265*safezoneH+safezoneY+0.480; + text=">"; + action=QUOTE(call FUNC(cycle_target_speed_direction)); + }; class TEXT_TARGET_DATA_TARGET_RANGE: TEXT_TARGET_DATA_LATITUDE { idc=14006; y=0.265*safezoneH+safezoneY+0.520; diff --git a/addons/atragmx/XEH_preInit.sqf b/addons/atragmx/XEH_preInit.sqf index 4718e6c31a..6ec288b9c7 100644 --- a/addons/atragmx/XEH_preInit.sqf +++ b/addons/atragmx/XEH_preInit.sqf @@ -20,6 +20,7 @@ PREP(cycle_num_ticks_units); PREP(cycle_range_card_columns); PREP(cycle_scope_unit); PREP(cycle_target_size_units); +PREP(cycle_target_speed_direction); PREP(delete_gun); PREP(init); PREP(parse_input); diff --git a/addons/atragmx/functions/fnc_clear_user_data.sqf b/addons/atragmx/functions/fnc_clear_user_data.sqf index f805ce66b1..308b5bbf12 100644 --- a/addons/atragmx/functions/fnc_clear_user_data.sqf +++ b/addons/atragmx/functions/fnc_clear_user_data.sqf @@ -36,6 +36,7 @@ profileNamespace setVariable ["ACE_ATragMX_windSpeed2", nil]; profileNamespace setVariable ["ACE_ATragMX_windDirection", nil]; profileNamespace setVariable ["ACE_ATragMX_inclinationAngle", nil]; profileNamespace setVariable ["ACE_ATragMX_targetSpeed", nil]; +profileNamespace setVariable ["ACE_ATragMX_targetSpeedDirection", nil]; profileNamespace setVariable ["ACE_ATragMX_targetRange", nil]; profileNamespace setVariable ["ACE_ATragMX_rangeCardStartRange", nil]; diff --git a/addons/atragmx/functions/fnc_cycle_target_speed_direction.sqf b/addons/atragmx/functions/fnc_cycle_target_speed_direction.sqf new file mode 100644 index 0000000000..3c77fab792 --- /dev/null +++ b/addons/atragmx/functions/fnc_cycle_target_speed_direction.sqf @@ -0,0 +1,22 @@ +/* + * Author: Ruthberg + * Cycles through the target directions left/right + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * call ace_atragmx_cycle_target_direction + * + * Public: No + */ +#include "script_component.hpp" + +if ((ctrlText 140051) == ">") then { + ctrlSetText [140051, "<"]; +} else { + ctrlSetText [140051, ">"]; +}; diff --git a/addons/atragmx/functions/fnc_init.sqf b/addons/atragmx/functions/fnc_init.sqf index 16c0b7eb86..e4fe1b67a4 100644 --- a/addons/atragmx/functions/fnc_init.sqf +++ b/addons/atragmx/functions/fnc_init.sqf @@ -59,6 +59,7 @@ GVAR(windSpeed2) = [0, 0, 0, 0]; GVAR(windDirection) = [12, 12, 12, 12]; GVAR(inclinationAngle) = [0, 0, 0, 0]; GVAR(targetSpeed) = [0, 0, 0, 0]; +GVAR(targetSpeedDirection) = [1, 1, 1, 1]; GVAR(targetRange) = [0, 0, 0, 0]; GVAR(showWind2) = false; diff --git a/addons/atragmx/functions/fnc_parse_input.sqf b/addons/atragmx/functions/fnc_parse_input.sqf index ca289302c9..25ff7d764c 100644 --- a/addons/atragmx/functions/fnc_parse_input.sqf +++ b/addons/atragmx/functions/fnc_parse_input.sqf @@ -40,7 +40,12 @@ if (_inclinationAngleDegree != GVAR(inclinationAngle) select GVAR(currentTarget) GVAR(inclinationAngle) set [GVAR(currentTarget), round(acos(_inclinationAngleCosine))]; }; }; -GVAR(targetSpeed) set [GVAR(currentTarget), -50 max abs(parseNumber(ctrlText 140050)) min 50]; +GVAR(targetSpeed) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 140050)) min 50]; +if ((ctrlText 140051) == ">") then { + GVAR(targetSpeedDirection) set [GVAR(currentTarget), +1]; +} else { + GVAR(targetSpeedDirection) set [GVAR(currentTarget), -1]; +}; GVAR(targetRange) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 140060)) min 4000]; if (GVAR(currentUnit) != 2) then { GVAR(windSpeed1) set [GVAR(currentTarget), (GVAR(windSpeed1) select GVAR(currentTarget)) * 0.44704]; diff --git a/addons/atragmx/functions/fnc_restore_user_data.sqf b/addons/atragmx/functions/fnc_restore_user_data.sqf index 7204f17426..896455ec7a 100644 --- a/addons/atragmx/functions/fnc_restore_user_data.sqf +++ b/addons/atragmx/functions/fnc_restore_user_data.sqf @@ -33,6 +33,7 @@ GVAR(windSpeed2) = profileNamespace getVariable ["ACE_ATragMX_windSpeed2", [0, 0 GVAR(windDirection) = profileNamespace getVariable ["ACE_ATragMX_windDirection", [12, 12, 12, 12]]; GVAR(inclinationAngle) = profileNamespace getVariable ["ACE_ATragMX_inclinationAngle", [0, 0, 0, 0]]; GVAR(targetSpeed) = profileNamespace getVariable ["ACE_ATragMX_targetSpeed", [0, 0, 0, 0]]; +GVAR(targetSpeedDirection) = profileNamespace getVariable ["ACE_ATragMX_targetSpeedDirection", [1, 1, 1, 1]]; GVAR(targetRange) = profileNamespace getVariable ["ACE_ATragMX_targetRange", [0, 0, 0, 0]]; GVAR(rangeCardStartRange) = 0 max (profileNamespace getVariable ["ACE_ATragMX_rangeCardStartRange", 200]) min 3000; diff --git a/addons/atragmx/functions/fnc_show_target_data.sqf b/addons/atragmx/functions/fnc_show_target_data.sqf index 48e419f65f..f1b432edf8 100644 --- a/addons/atragmx/functions/fnc_show_target_data.sqf +++ b/addons/atragmx/functions/fnc_show_target_data.sqf @@ -17,7 +17,7 @@ GVAR(showTargetData) = _this; -{ctrlShow [_x, _this]} forEach [14000, 140000, 14001, 140010, 14002, 141020, 140020, 141021, 140021, 14003, 140030, 14004, 140040, 141040, 141041, 140041, 14005, 140050, 14006, 140060, 140061, 14007, 14008, 14009, 14010, 14011]; +{ctrlShow [_x, _this]} forEach [14000, 140000, 14001, 140010, 14002, 141020, 140020, 141021, 140021, 14003, 140030, 14004, 140040, 141040, 141041, 140041, 14005, 140050, 140051, 14006, 140060, 140061, 14007, 14008, 14009, 14010, 14011]; if (_this) then { [] call FUNC(update_target_data); diff --git a/addons/atragmx/functions/fnc_store_user_data.sqf b/addons/atragmx/functions/fnc_store_user_data.sqf index 01a5810fe2..5cfe7f2ae0 100644 --- a/addons/atragmx/functions/fnc_store_user_data.sqf +++ b/addons/atragmx/functions/fnc_store_user_data.sqf @@ -35,6 +35,7 @@ profileNamespace setVariable ["ACE_ATragMX_windSpeed2", GVAR(windSpeed2)]; profileNamespace setVariable ["ACE_ATragMX_windDirection", GVAR(windDirection)]; profileNamespace setVariable ["ACE_ATragMX_inclinationAngle", GVAR(inclinationAngle)]; profileNamespace setVariable ["ACE_ATragMX_targetSpeed", GVAR(targetSpeed)]; +profileNamespace setVariable ["ACE_ATragMX_targetSpeedDirection", GVAR(targetSpeedDirection)]; profileNamespace setVariable ["ACE_ATragMX_targetRange", GVAR(targetRange)]; profileNamespace setVariable ["ACE_ATragMX_rangeCardStartRange", GVAR(rangeCardStartRange)]; diff --git a/addons/atragmx/functions/fnc_update_result.sqf b/addons/atragmx/functions/fnc_update_result.sqf index 64f121bc86..bb708efaab 100644 --- a/addons/atragmx/functions/fnc_update_result.sqf +++ b/addons/atragmx/functions/fnc_update_result.sqf @@ -82,16 +82,88 @@ if (GVAR(showWind2)) then { ctrlSetText [42, "Lead"]; }; -ctrlSetText [400, Str(Round(_elevationAbs * 100) / 100)]; -ctrlSetText [401, Str(Round(_elevationRel * 100) / 100)]; -ctrlSetText [402, Str(Round(_elevationCur * 100) / 100)]; +_elevationAbs = Round(_elevationAbs * 100) / 100; +if (_elevationAbs > 0) then { + ctrlSetText [400, format["%1", abs(_elevationAbs)]]; +} else { + if (_elevationAbs < 0) then { + ctrlSetText [400, format["%1D", abs(_elevationAbs)]]; + } else { + ctrlSetText [400, "0.0"]; + }; +}; +_elevationRel = Round(_elevationRel * 100) / 100; +if (_elevationRel > 0) then { + ctrlSetText [401, format["%1", abs(_elevationRel)]]; +} else { + if (_elevationRel < 0) then { + ctrlSetText [401, format["%1D", abs(_elevationRel)]]; + } else { + ctrlSetText [401, "0.0"]; + }; +}; +_elevationCur = Round(_elevationCur * 100) / 100; +if (_elevationCur > 0) then { + ctrlSetText [402, format["%1", abs(_elevationCur)]]; +} else { + if (_elevationCur < 0) then { + ctrlSetText [402, format["%1D", abs(_elevationCur)]]; + } else { + ctrlSetText [402, "0.0"]; + }; +}; -ctrlSetText [410, Str(Round(_windageAbs * 100) / 100)]; -ctrlSetText [411, Str(Round(_windageRel * 100) / 100)]; -ctrlSetText [412, Str(Round(_windageCur * 100) / 100)]; +_windageAbs = Round(_windageAbs * 100) / 100; +if (_windageAbs > 0) then { + ctrlSetText [410, format["%1R", abs(_windageAbs)]]; +} else { + if (_windageAbs < 0) then { + ctrlSetText [410, format["%1L", abs(_windageAbs)]]; + } else { + ctrlSetText [410, "0.0"]; + }; +}; +_windageRel = Round(_windageRel * 100) / 100; +if (_windageRel > 0) then { + ctrlSetText [411, format["%1R", abs(_windageRel)]]; +} else { + if (_windageRel < 0) then { + ctrlSetText [411, format["%1L", abs(_windageRel)]]; + } else { + ctrlSetText [411, "0.0"]; + }; +}; +_windageCur = Round(_windageCur * 100) / 100; +if (_windageCur > 0) then { + ctrlSetText [412, format["%1R", abs(_windageCur)]]; +} else { + if (_windageCur < 0) then { + ctrlSetText [412, format["%1L", abs(_windageCur)]]; + } else { + ctrlSetText [412, "0.0"]; + }; +}; if (GVAR(showWind2)) then { - ctrlSetText [420, Str(Round(_wind2 * 100) / 100)]; + _wind2 = Round(_wind2 * 100) / 100; + if (_wind2 > 0) then { + ctrlSetText [420, format["%1R", abs(_wind2)]]; + } else { + if (_wind2 < 0) then { + ctrlSetText [420, format["%1L", abs(_wind2)]]; + } else { + ctrlSetText [420, "0.0"]; + }; + }; } else { - ctrlSetText [420, Str(Round(_lead * 100) / 100)]; + _lead = Round(_lead * 100) / 100; + if (_lead > 0) then { + if ((GVAR(targetSpeedDirection) select GVAR(currentTarget)) == 1) then { + ctrlSetText [420, format["%1R", abs(_lead)]]; + } else { + ctrlSetText [420, format["%1L", abs(_lead)]]; + }; + } else { + ctrlSetText [420, "0.0"]; + }; }; \ No newline at end of file diff --git a/addons/atragmx/functions/fnc_update_target_data.sqf b/addons/atragmx/functions/fnc_update_target_data.sqf index b5e6dcf85a..6fa9035a62 100644 --- a/addons/atragmx/functions/fnc_update_target_data.sqf +++ b/addons/atragmx/functions/fnc_update_target_data.sqf @@ -32,6 +32,11 @@ if (GVAR(currentUnit) != 2) then { } else { ctrlSetText [140050, Str(Round((GVAR(targetSpeed) select GVAR(currentTarget)) * 100) / 100)]; }; +if ((GVAR(targetSpeedDirection) select GVAR(currentTarget)) == 1) then { + ctrlSetText [140051, ">"]; +} else { + ctrlSetText [140051, "<"]; +}; if (GVAR(currentUnit) == 1) then { ctrlSetText [140060, Str(Round((GVAR(targetRange) select GVAR(currentTarget)) * 1.0936133))]; } else {