From 721898d9fb117297a73efc27475f287ba1503387 Mon Sep 17 00:00:00 2001 From: jaynus Date: Fri, 10 Apr 2015 13:57:44 -0700 Subject: [PATCH 01/12] Constraint dialogs working. --- addons/wep_javelin/RscInGameUI.hpp | 330 +++++++++--------- .../wep_javelin/functions/fnc_onOpticDraw.sqf | 4 +- .../wep_javelin/functions/fnc_onOpticLoad.sqf | 4 + 3 files changed, 172 insertions(+), 166 deletions(-) diff --git a/addons/wep_javelin/RscInGameUI.hpp b/addons/wep_javelin/RscInGameUI.hpp index 811548a9d2..714db0c940 100644 --- a/addons/wep_javelin/RscInGameUI.hpp +++ b/addons/wep_javelin/RscInGameUI.hpp @@ -12,7 +12,7 @@ class RscLine; class RscInGameUI { class RscOptics_titan { idd = 300; - controls[] = {"ACE_javelin_elements_group"}; + controls[] = {"ACE_javelin_elements_group", "CA_Distance", "ACE_TargetingConstrains", "ACE_TargetingGate", "ACE_TargetingLines"}; onLoad = QUOTE(_this call FUNC(onOpticLoad)); onUnload = "uiNameSpace setVariable ['ACE_RscOptics_javelin',nil];"; @@ -26,6 +26,169 @@ class RscInGameUI { h = 0; }; + class ACE_TargetingConstrains: RscControlsGroup { + idc = 699100; + x = "SafezoneX"; + y = "SafezoneY"; + w = "SafezoneW-SafezoneX"; + h = "SafezoneH-SafezoneY"; + enabled = 0; + class VScrollbar { + autoScrollSpeed = -1; + autoScrollDelay = 5; + autoScrollRewind = 0; + color[] = {1,1,1,0}; + width = 0.001; + }; + class HScrollbar { + color[] = {1,1,1,0}; + height = 0.001; + }; + class Controls { + class Top: RscPicture { + idc = 699101; + text = "#(argb,8,8,3)color(1,1,1,1)"; + colorText[] = {0.2941,0.2941,0.2941,1}; + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.15*SafezoneH-SafezoneY"; + w = "(3/4)*SafezoneH"; + h = "0.21*SafezoneH"; + }; + class Bottom: Top { + idc = 699102; + y = "0.64*SafezoneH-SafezoneY"; + }; + class Left: Top { + idc = 699103; + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.36*SafezoneH-SafezoneY"; + w = "0.31*(3/4)*SafezoneH"; + h = "0.28*SafezoneH"; + }; + class Right: Left { + idc = 699104; + x = "((SafezoneW -(3/4)*SafezoneH)/2)+ 0.69*(3/4)*SafezoneH - SafezoneX"; + }; + class OpticsBorders: RscPicture { + idc = 699105; + text = PATHTOF(data\javelin_ui_border_ca.paa); + colorText[] = {0,0,0,1}; + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.15*SafezoneH-SafezoneY"; + w = "(3/4)*SafezoneH"; + h = "0.7*SafezoneH"; + }; + }; + }; + + class ACE_TargetingGate : ACE_TargetingConstrains { + idc = 699200; + class Controls { + class TargetingGateTL: TargetingConstrains { + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.15*SafezoneH - SafezoneY"; + idc = 699201; + class Controls { + class LineH: RscLine { + idc = 699210; + x = "0"; + y = "0"; + w = "0.025*(3/4)*SafezoneH"; + h = "0"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + class LineV: LineH { + idc = 699211; + w = "0"; + h = "0.025*SafezoneH"; + }; + }; + }; + class TargetingGateTR: TargetingGateTL { + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX + 0.975*(3/4)*SafezoneH"; + y = "0.15*SafezoneH - SafezoneY"; + idc = 699202; + class Controls { + class LineH: RscLine { + idc = 699220; + x = "0"; + y = "0"; + w = "0.025*(3/4)*SafezoneH"; + h = "0"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + class LineV: LineH { + idc = 699221; + x = "0.025*(3/4)*SafezoneH"; + w = "0"; + h = "0.025*SafezoneH"; + }; + }; + }; + class TargetingGateBL: TargetingGateTL { + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.825*SafezoneH - SafezoneY"; + idc = 699203; + class Controls { + class LineH: RscLine { + x = "0"; + y = "0.025*SafezoneH"; + w = "0.025*(3/4)*SafezoneH"; + h = "0"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + class LineV: LineH { + y = "0"; + w = "0"; + h = "0.025*SafezoneH"; + }; + }; + }; + class TargetingGateBR: TargetingGateBL { + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX + 0.975*(3/4)*SafezoneH"; + y = "0.825*SafezoneH - SafezoneY"; + idc = 699204; + class Controls { + class LineH: RscLine { + x = "0"; + y = "0.025*SafezoneH"; + w = "0.025*(3/4)*SafezoneH"; + h = "0"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + class LineV: LineH { + x = "0.025*(3/4)*SafezoneH"; + y = "0"; + w = "0"; + h = "0.025*SafezoneH"; + }; + }; + }; + }; + }; + + class ACE_TargetingLines: ACE_TargetingConstrains { + idc = 699300; + class Controls { + class LineH: RscLine { + idc = 699301; + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.5*SafezoneH - SafezoneY"; + w = "(3/4)*SafezoneH"; + h = "0"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + class LineV: RscLine { + idc = 699302; + x = "0.5*SafezoneW - SafezoneX"; + y = "0.15*SafezoneH - SafezoneY"; + w = "0"; + h = "0.7*SafezoneH"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + }; + }; + class ACE_javelin_elements_group: RscControlsGroup { x = "SafezoneX"; @@ -211,170 +374,7 @@ class RscInGameUI { }; }; }; - /* - class TargetingConstrains: RscControlsGroup { - idc = 699100; - x = "SafezoneX"; - y = "SafezoneY"; - w = "SafezoneW-SafezoneX"; - h = "SafezoneH-SafezoneY"; - class VScrollbar { - autoScrollSpeed = -1; - autoScrollDelay = 5; - autoScrollRewind = 0; - color[] = {1,1,1,0}; - width = 0.001; - }; - class HScrollbar { - color[] = {1,1,1,0}; - height = 0.001; - }; - class Controls { - class Top: RscPicture { - idc = 699101; - text = "#(argb,8,8,3)color(1,1,1,1)"; - colorText[] = {0.2941,0.2941,0.2941,1}; - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.15*SafezoneH-SafezoneY"; - w = "(3/4)*SafezoneH"; - h = "0.21*SafezoneH"; - }; - class Bottom: Top { - idc = 699102; - y = "0.64*SafezoneH-SafezoneY"; - }; - class Left: Top { - idc = 699103; - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.36*SafezoneH-SafezoneY"; - w = "0.31*(3/4)*SafezoneH"; - h = "0.28*SafezoneH"; - }; - class Right: Left { - idc = 699104; - x = "((SafezoneW -(3/4)*SafezoneH)/2)+ 0.69*(3/4)*SafezoneH - SafezoneX"; - }; - class OpticsBorders: RscPicture { - idc = 699105; - text = PATHTOF(data\javelin_ui_border_ca.paa); - colorText[] = {0,0,0,1}; - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.15*SafezoneH-SafezoneY"; - w = "(3/4)*SafezoneH"; - h = "0.7*SafezoneH"; - }; - }; - }; - - class TargetingGate: TargetingConstrains { - idc = 699200; - class Controls { - class TargetingGateTL: TargetingConstrains { - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.15*SafezoneH - SafezoneY"; - idc = 699201; - class Controls { - class LineH: RscLine { - idc = 699210; - x = "0"; - y = "0"; - w = "0.025*(3/4)*SafezoneH"; - h = "0"; - colorText[] = {0.8745,0.8745,0.8745,1}; - }; - class LineV: LineH { - idc = 699211; - w = "0"; - h = "0.025*SafezoneH"; - }; - }; - }; - class TargetingGateTR: TargetingGateTL { - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX + 0.975*(3/4)*SafezoneH"; - y = "0.15*SafezoneH - SafezoneY"; - idc = 699202; - class Controls { - class LineH: RscLine { - idc = 699220; - x = "0"; - y = "0"; - w = "0.025*(3/4)*SafezoneH"; - h = "0"; - colorText[] = {0.8745,0.8745,0.8745,1}; - }; - class LineV: LineH { - idc = 699221; - x = "0.025*(3/4)*SafezoneH"; - w = "0"; - h = "0.025*SafezoneH"; - }; - }; - }; - class TargetingGateBL: TargetingGateTL { - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.825*SafezoneH - SafezoneY"; - idc = 699203; - class Controls { - class LineH: RscLine { - x = "0"; - y = "0.025*SafezoneH"; - w = "0.025*(3/4)*SafezoneH"; - h = "0"; - colorText[] = {0.8745,0.8745,0.8745,1}; - }; - class LineV: LineH { - y = "0"; - w = "0"; - h = "0.025*SafezoneH"; - }; - }; - }; - class TargetingGateBR: TargetingGateBL { - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX + 0.975*(3/4)*SafezoneH"; - y = "0.825*SafezoneH - SafezoneY"; - idc = 699204; - class Controls { - class LineH: RscLine { - x = "0"; - y = "0.025*SafezoneH"; - w = "0.025*(3/4)*SafezoneH"; - h = "0"; - colorText[] = {0.8745,0.8745,0.8745,1}; - }; - class LineV: LineH { - x = "0.025*(3/4)*SafezoneH"; - y = "0"; - w = "0"; - h = "0.025*SafezoneH"; - }; - }; - }; - }; - }; - - class TargetingLines: TargetingConstrains { - idc = 699300; - class Controls { - class LineH: RscLine { - idc = 699301; - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.5*SafezoneH - SafezoneY"; - w = "(3/4)*SafezoneH"; - h = "0"; - colorText[] = {0.8745,0.8745,0.8745,1}; - }; - class LineV: RscLine { - idc = 699302; - x = "0.5*SafezoneW - SafezoneX"; - y = "0.15*SafezoneH - SafezoneY"; - w = "0"; - h = "0.7*SafezoneH"; - colorText[] = {0.8745,0.8745,0.8745,1}; - }; - }; - }; - */ - + class ACE_javelin_SEEK_off: ACE_javelin_Day_mode_off { idc = 699000; x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (0.863/4)*3*SafezoneH - SafezoneX"; diff --git a/addons/wep_javelin/functions/fnc_onOpticDraw.sqf b/addons/wep_javelin/functions/fnc_onOpticDraw.sqf index 586f4cb99e..acd37faaa3 100644 --- a/addons/wep_javelin/functions/fnc_onOpticDraw.sqf +++ b/addons/wep_javelin/functions/fnc_onOpticDraw.sqf @@ -1,7 +1,9 @@ -//#define DEBUG_MODE_FULL +#define DEBUG_MODE_FULL #include "script_component.hpp" //TRACE_1("enter", _this); +TRACE_1("Control", (__JavelinIGUITargetingConstrains)); + #define __TRACKINTERVAL 0.1 // how frequent the check should be. #define __LOCKONTIME 1.85 // Lock on won't occur sooner #define __LOCKONTIMERANDOM 0.3 // Deviation in lock on time diff --git a/addons/wep_javelin/functions/fnc_onOpticLoad.sqf b/addons/wep_javelin/functions/fnc_onOpticLoad.sqf index b2192b8883..3dfa3e2f9a 100644 --- a/addons/wep_javelin/functions/fnc_onOpticLoad.sqf +++ b/addons/wep_javelin/functions/fnc_onOpticLoad.sqf @@ -11,6 +11,10 @@ ACE_player setVariable ["ace_missileguidance_target",nil, false]; __JavelinIGUISeek ctrlSetTextColor __ColorGray; __JavelinIGUINFOV ctrlSetTextColor __ColorGray; +__JavelinIGUITargetingConstrains ctrlShow false; +__JavelinIGUITargetingGate ctrlShow false; +__JavelinIGUITargetingLines ctrlShow false; + uiNameSpace setVariable [QGVAR(arguments), [ 0, // Last runtime From 0a88220fc2b1c9c5df52c213a397242b35938a15 Mon Sep 17 00:00:00 2001 From: jaynus Date: Fri, 10 Apr 2015 14:20:06 -0700 Subject: [PATCH 02/12] Constraints work, added worldToScreenBounds to common. --- addons/common/XEH_preInit.sqf | 3 ++ .../functions/fnc_worldToScreenBounds.sqf | 52 +++++++++++++++++++ addons/wep_javelin/RscInGameUI.hpp | 2 +- addons/wep_javelin/XEH_pre_init.sqf | 3 -- .../wep_javelin/functions/fnc_onOpticDraw.sqf | 50 ++++++++++++++++++ .../functions/fnc_translateToModelSpace.sqf | 20 ------- .../functions/fnc_translateToWeaponSpace.sqf | 26 ---------- 7 files changed, 106 insertions(+), 50 deletions(-) create mode 100644 addons/common/functions/fnc_worldToScreenBounds.sqf delete mode 100644 addons/wep_javelin/functions/fnc_translateToModelSpace.sqf delete mode 100644 addons/wep_javelin/functions/fnc_translateToWeaponSpace.sqf diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index e7169f1d23..397973edfc 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -178,6 +178,9 @@ PREP(useItem); PREP(useMagazine); PREP(waitAndExecute); +// Model and drawing helpers +PREP(worldToScreenBounds); + // config items PREP(getConfigType); PREP(getItemType); diff --git a/addons/common/functions/fnc_worldToScreenBounds.sqf b/addons/common/functions/fnc_worldToScreenBounds.sqf new file mode 100644 index 0000000000..7b88350c6a --- /dev/null +++ b/addons/common/functions/fnc_worldToScreenBounds.sqf @@ -0,0 +1,52 @@ +// (c) zGuba 2011 +// Function helper for framing objects on screen. +// Input: [_object,_margins3D,_offset3D] (object, 3 * float array, 3 * float array) +// Output: [_minX,_minY,_minY,_maxY] (4 * float) + +#include "script_component.hpp" + +private ["_minX","_minY","_maxX","_maxY"]; + +PARAMS_3(_object,_margins,_offsets); + +_minX = 10; +_minY = 10; +_maxX = -10; +_maxY = -10; + +if (true) then { + _bounds = boundingBox _object; + + _boundsMin = _bounds select 0; + _boundsMinX = (_boundsMin select 0) - (_margins select 0) + (_offsets select 0); + _boundsMinY = (_boundsMin select 1) - (_margins select 1) + (_offsets select 1); + _boundsMinZ = (_boundsMin select 2) - (_margins select 2) + (_offsets select 2); + _boundsMax = _bounds select 1; + _boundsMaxX = (_boundsMax select 0) + (_margins select 0) + (_offsets select 0); + _boundsMaxY = (_boundsMax select 1) + (_margins select 1) + (_offsets select 1); + _boundsMaxZ = (_boundsMax select 2) + (_margins select 2) + (_offsets select 2); + + _boundsCorners = [ + [_boundsMinX,_boundsMinY,_boundsMinZ], + [_boundsMinX,_boundsMinY,_boundsMaxZ], + [_boundsMinX,_boundsMaxY,_boundsMinZ], + [_boundsMinX,_boundsMaxY,_boundsMaxZ], + [_boundsMaxX,_boundsMinY,_boundsMinZ], + [_boundsMaxX,_boundsMinY,_boundsMaxZ], + [_boundsMaxX,_boundsMaxY,_boundsMinZ], + [_boundsMaxX,_boundsMaxY,_boundsMaxZ] + ]; + + + { + _ppos = worldToScreen (_object modelToWorld _x); + _pposX = _ppos select 0; + _pposY = _ppos select 1; + if (_pposX < _minX) then {_minX = _pposX}; + if (_pposX > _maxX) then {_maxX = _pposX}; + if (_pposY < _minY) then {_minY = _pposY}; + if (_pposY > _maxY) then {_maxY = _pposY}; + } forEach _boundsCorners; +}; + +[_minX,_minY,_maxX,_maxY] diff --git a/addons/wep_javelin/RscInGameUI.hpp b/addons/wep_javelin/RscInGameUI.hpp index 714db0c940..457c7ac414 100644 --- a/addons/wep_javelin/RscInGameUI.hpp +++ b/addons/wep_javelin/RscInGameUI.hpp @@ -84,7 +84,7 @@ class RscInGameUI { class ACE_TargetingGate : ACE_TargetingConstrains { idc = 699200; class Controls { - class TargetingGateTL: TargetingConstrains { + class TargetingGateTL: ACE_TargetingConstrains { x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; y = "0.15*SafezoneH - SafezoneY"; idc = 699201; diff --git a/addons/wep_javelin/XEH_pre_init.sqf b/addons/wep_javelin/XEH_pre_init.sqf index 119eb25975..2b2e980191 100644 --- a/addons/wep_javelin/XEH_pre_init.sqf +++ b/addons/wep_javelin/XEH_pre_init.sqf @@ -1,8 +1,5 @@ #include "script_component.hpp" -PREP(translateToWeaponSpace); -PREP(translateToModelSpace); - PREP(lockKeyDown); PREP(lockKeyUp); diff --git a/addons/wep_javelin/functions/fnc_onOpticDraw.sqf b/addons/wep_javelin/functions/fnc_onOpticDraw.sqf index acd37faaa3..33f6c93c39 100644 --- a/addons/wep_javelin/functions/fnc_onOpticDraw.sqf +++ b/addons/wep_javelin/functions/fnc_onOpticDraw.sqf @@ -83,9 +83,59 @@ if (isNull _newTarget) then { } else { if(diag_tickTime - _lockTime > 3) then { TRACE_2("LOCKED!", _currentTarget, _lockTime); + __JavelinIGUISeek ctrlSetTextColor __ColorGreen; __JavelinIGUINFOV ctrlSetTextColor __ColorNull; __JavelinIGUITargetingConstrains ctrlShow true; + __JavelinIGUITargetingGate ctrlShow true; + __JavelinIGUITargetingLines ctrlShow true; + + + _apos = worldToScreen (_newTarget modelToWorld _randomPosWithinBounds); + + _aposX = 0; + _aposY = 0; + if (count _apos < 2) then { + _aposX = 1; + _aposY = 0; + } else { + _aposX = (_apos select 0) + _offsetX; + _aposY = (_apos select 1) + _offsetY; + }; + + // Move target marker to coords. + __JavelinIGUITargetingLineV ctrlSetPosition [_aposX,ctrlPosition __JavelinIGUITargetingLineV select 1]; + __JavelinIGUITargetingLineH ctrlSetPosition [ctrlPosition __JavelinIGUITargetingLineH select 0,_aposY]; + {_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingLineH,__JavelinIGUITargetingLineV]; + + _boundsInput = if (_currentTarget isKindOf "CAManBase") then { + [_currentTarget,[-1,-1,-2],_currentTarget selectionPosition "body"]; + } else { + [_currentTarget,[-1,-1,-2],_currentTarget selectionPosition "zamerny"]; + }; + + _bpos = _boundsInput call FUNC(worldToScreenBounds); + + _constraintTop = __ConstraintTop; + _constraintLeft = __ConstraintLeft; + _constraintBottom = __ConstraintBottom; + _constraintRight = __ConstraintRight; + + _offsetX = __OffsetX; + _offsetY = __OffsetY; + + _minX = ((_bpos select 0) + _offsetX) max _constraintLeft; + _minY = ((_bpos select 1) + _offsetY) max _constraintTop; + _maxX = ((_bpos select 2) + _offsetX) min (_constraintRight - 0.025*(3/4)*SafezoneH); + _maxY = ((_bpos select 3) + _offsetY) min (_constraintBottom - 0.025*SafezoneH); + + __JavelinIGUITargetingGateTL ctrlSetPosition [_minX,_minY]; + __JavelinIGUITargetingGateTR ctrlSetPosition [_maxX,_minY]; + __JavelinIGUITargetingGateBL ctrlSetPosition [_minX,_maxY]; + __JavelinIGUITargetingGateBR ctrlSetPosition [_maxX,_maxY]; + + {_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingGateTL,__JavelinIGUITargetingGateTR,__JavelinIGUITargetingGateBL,__JavelinIGUITargetingGateBR]; + ACE_player setVariable["ace_missileguidance_target", _currentTarget, false]; diff --git a/addons/wep_javelin/functions/fnc_translateToModelSpace.sqf b/addons/wep_javelin/functions/fnc_translateToModelSpace.sqf deleted file mode 100644 index 12f828769a..0000000000 --- a/addons/wep_javelin/functions/fnc_translateToModelSpace.sqf +++ /dev/null @@ -1,20 +0,0 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" -TRACE_1("enter", _this); - -_object = _this select 0; -_origin = getPosASL _object; -_matrix = _this select 1; -_xVec = _matrix select 0; -_yVec = _matrix select 1; -_zVec = _matrix select 2; - -_offset = _this select 2; - -_x = _offset select 0; -_y = _offset select 1; -_z = _offset select 2; - -_out = (((_xVec vectorMultiply _x) vectorAdd (_yVec vectorMultiply _y)) vectorAdd (_zVec vectorMultiply _z)) vectorAdd _origin; - -_out; \ No newline at end of file diff --git a/addons/wep_javelin/functions/fnc_translateToWeaponSpace.sqf b/addons/wep_javelin/functions/fnc_translateToWeaponSpace.sqf deleted file mode 100644 index 8f85005d48..0000000000 --- a/addons/wep_javelin/functions/fnc_translateToWeaponSpace.sqf +++ /dev/null @@ -1,26 +0,0 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" -TRACE_1("enter", _this); - -_object = _this select 0; -_origin = getPosASL _object; -_matrix = _this select 1; -_xVec = _matrix select 0; -_yVec = _matrix select 1; -_zVec = _matrix select 2; - -_offset = _this select 2; - -_offset = _offset vectorDiff _origin; - -_x = _offset select 0; -_y = _offset select 1; -_z = _offset select 2; - -_out = [ - ((_xVec select 0)*_x) + ((_xVec select 1)*_y) + ((_xVec select 2)*_z), - ((_yVec select 0)*_x) + ((_yVec select 1)*_y) + ((_yVec select 2)*_z), - ((_zVec select 0)*_x) + ((_zVec select 1)*_y) + ((_zVec select 2)*_z) - ]; - -_out; \ No newline at end of file From efaee770bbb56a836672a0c098eff78d09832348 Mon Sep 17 00:00:00 2001 From: jaynus Date: Sat, 11 Apr 2015 10:44:13 -0700 Subject: [PATCH 03/12] rename wep_javelin to javelin --- addons/{wep_javelin => javelin}/$PBOPREFIX$ | 0 .../CfgEventhandlers.hpp | 0 addons/{wep_javelin => javelin}/CfgSounds.hpp | 0 addons/{wep_javelin => javelin}/README.md | 0 .../{wep_javelin => javelin}/RscInGameUI.hpp | 0 .../XEH_clientInit.sqf | 0 .../XEH_post_init.sqf | 0 .../{wep_javelin => javelin}/XEH_pre_init.sqf | 0 addons/{wep_javelin => javelin}/config.cpp | 0 .../data/jav_disp.paa | Bin .../data/jav_ring.paa | Bin .../data/javelin_ui_border_ca.paa | Bin .../data/sounds/javelin_locked.ogg | Bin .../data/sounds/javelin_locking.ogg | Bin .../functions/fnc_cycleFireMode.sqf | 0 .../functions/fnc_lockKeyDown.sqf | 0 .../functions/fnc_lockKeyUp.sqf | 0 .../functions/fnc_onOpticDraw.sqf | 31 ++++++++++-------- .../functions/fnc_onOpticLoad.sqf | 0 .../functions/fnc_showFireMode.sqf | 0 .../functions/script_component.hpp | 0 .../{wep_javelin => javelin}/initKeybinds.sqf | 0 .../script_component.hpp | 4 --- .../{wep_javelin => javelin}/stringtable.xml | 0 24 files changed, 18 insertions(+), 17 deletions(-) rename addons/{wep_javelin => javelin}/$PBOPREFIX$ (100%) rename addons/{wep_javelin => javelin}/CfgEventhandlers.hpp (100%) rename addons/{wep_javelin => javelin}/CfgSounds.hpp (100%) rename addons/{wep_javelin => javelin}/README.md (100%) rename addons/{wep_javelin => javelin}/RscInGameUI.hpp (100%) rename addons/{wep_javelin => javelin}/XEH_clientInit.sqf (100%) rename addons/{wep_javelin => javelin}/XEH_post_init.sqf (100%) rename addons/{wep_javelin => javelin}/XEH_pre_init.sqf (100%) rename addons/{wep_javelin => javelin}/config.cpp (100%) rename addons/{wep_javelin => javelin}/data/jav_disp.paa (100%) rename addons/{wep_javelin => javelin}/data/jav_ring.paa (100%) rename addons/{wep_javelin => javelin}/data/javelin_ui_border_ca.paa (100%) rename addons/{wep_javelin => javelin}/data/sounds/javelin_locked.ogg (100%) rename addons/{wep_javelin => javelin}/data/sounds/javelin_locking.ogg (100%) rename addons/{wep_javelin => javelin}/functions/fnc_cycleFireMode.sqf (100%) rename addons/{wep_javelin => javelin}/functions/fnc_lockKeyDown.sqf (100%) rename addons/{wep_javelin => javelin}/functions/fnc_lockKeyUp.sqf (100%) rename addons/{wep_javelin => javelin}/functions/fnc_onOpticDraw.sqf (87%) rename addons/{wep_javelin => javelin}/functions/fnc_onOpticLoad.sqf (100%) rename addons/{wep_javelin => javelin}/functions/fnc_showFireMode.sqf (100%) rename addons/{wep_javelin => javelin}/functions/script_component.hpp (100%) rename addons/{wep_javelin => javelin}/initKeybinds.sqf (100%) rename addons/{wep_javelin => javelin}/script_component.hpp (90%) rename addons/{wep_javelin => javelin}/stringtable.xml (100%) diff --git a/addons/wep_javelin/$PBOPREFIX$ b/addons/javelin/$PBOPREFIX$ similarity index 100% rename from addons/wep_javelin/$PBOPREFIX$ rename to addons/javelin/$PBOPREFIX$ diff --git a/addons/wep_javelin/CfgEventhandlers.hpp b/addons/javelin/CfgEventhandlers.hpp similarity index 100% rename from addons/wep_javelin/CfgEventhandlers.hpp rename to addons/javelin/CfgEventhandlers.hpp diff --git a/addons/wep_javelin/CfgSounds.hpp b/addons/javelin/CfgSounds.hpp similarity index 100% rename from addons/wep_javelin/CfgSounds.hpp rename to addons/javelin/CfgSounds.hpp diff --git a/addons/wep_javelin/README.md b/addons/javelin/README.md similarity index 100% rename from addons/wep_javelin/README.md rename to addons/javelin/README.md diff --git a/addons/wep_javelin/RscInGameUI.hpp b/addons/javelin/RscInGameUI.hpp similarity index 100% rename from addons/wep_javelin/RscInGameUI.hpp rename to addons/javelin/RscInGameUI.hpp diff --git a/addons/wep_javelin/XEH_clientInit.sqf b/addons/javelin/XEH_clientInit.sqf similarity index 100% rename from addons/wep_javelin/XEH_clientInit.sqf rename to addons/javelin/XEH_clientInit.sqf diff --git a/addons/wep_javelin/XEH_post_init.sqf b/addons/javelin/XEH_post_init.sqf similarity index 100% rename from addons/wep_javelin/XEH_post_init.sqf rename to addons/javelin/XEH_post_init.sqf diff --git a/addons/wep_javelin/XEH_pre_init.sqf b/addons/javelin/XEH_pre_init.sqf similarity index 100% rename from addons/wep_javelin/XEH_pre_init.sqf rename to addons/javelin/XEH_pre_init.sqf diff --git a/addons/wep_javelin/config.cpp b/addons/javelin/config.cpp similarity index 100% rename from addons/wep_javelin/config.cpp rename to addons/javelin/config.cpp diff --git a/addons/wep_javelin/data/jav_disp.paa b/addons/javelin/data/jav_disp.paa similarity index 100% rename from addons/wep_javelin/data/jav_disp.paa rename to addons/javelin/data/jav_disp.paa diff --git a/addons/wep_javelin/data/jav_ring.paa b/addons/javelin/data/jav_ring.paa similarity index 100% rename from addons/wep_javelin/data/jav_ring.paa rename to addons/javelin/data/jav_ring.paa diff --git a/addons/wep_javelin/data/javelin_ui_border_ca.paa b/addons/javelin/data/javelin_ui_border_ca.paa similarity index 100% rename from addons/wep_javelin/data/javelin_ui_border_ca.paa rename to addons/javelin/data/javelin_ui_border_ca.paa diff --git a/addons/wep_javelin/data/sounds/javelin_locked.ogg b/addons/javelin/data/sounds/javelin_locked.ogg similarity index 100% rename from addons/wep_javelin/data/sounds/javelin_locked.ogg rename to addons/javelin/data/sounds/javelin_locked.ogg diff --git a/addons/wep_javelin/data/sounds/javelin_locking.ogg b/addons/javelin/data/sounds/javelin_locking.ogg similarity index 100% rename from addons/wep_javelin/data/sounds/javelin_locking.ogg rename to addons/javelin/data/sounds/javelin_locking.ogg diff --git a/addons/wep_javelin/functions/fnc_cycleFireMode.sqf b/addons/javelin/functions/fnc_cycleFireMode.sqf similarity index 100% rename from addons/wep_javelin/functions/fnc_cycleFireMode.sqf rename to addons/javelin/functions/fnc_cycleFireMode.sqf diff --git a/addons/wep_javelin/functions/fnc_lockKeyDown.sqf b/addons/javelin/functions/fnc_lockKeyDown.sqf similarity index 100% rename from addons/wep_javelin/functions/fnc_lockKeyDown.sqf rename to addons/javelin/functions/fnc_lockKeyDown.sqf diff --git a/addons/wep_javelin/functions/fnc_lockKeyUp.sqf b/addons/javelin/functions/fnc_lockKeyUp.sqf similarity index 100% rename from addons/wep_javelin/functions/fnc_lockKeyUp.sqf rename to addons/javelin/functions/fnc_lockKeyUp.sqf diff --git a/addons/wep_javelin/functions/fnc_onOpticDraw.sqf b/addons/javelin/functions/fnc_onOpticDraw.sqf similarity index 87% rename from addons/wep_javelin/functions/fnc_onOpticDraw.sqf rename to addons/javelin/functions/fnc_onOpticDraw.sqf index 33f6c93c39..cb62327396 100644 --- a/addons/wep_javelin/functions/fnc_onOpticDraw.sqf +++ b/addons/javelin/functions/fnc_onOpticDraw.sqf @@ -2,13 +2,14 @@ #include "script_component.hpp" //TRACE_1("enter", _this); -TRACE_1("Control", (__JavelinIGUITargetingConstrains)); - #define __TRACKINTERVAL 0.1 // how frequent the check should be. #define __LOCKONTIME 1.85 // Lock on won't occur sooner #define __LOCKONTIMERANDOM 0.3 // Deviation in lock on time #define __SENSORSQUARE 1 // Locking on sensor square side in angles +#define __OffsetX ((ctrlPosition __JavelinIGUITargetingLineV) select 0) - 0.5 +#define __OffsetY ((ctrlPosition __JavelinIGUITargetingLineH) select 1) - 0.5 + private["_args", "_lastTick", "_runTime", "_soundTime", "_lockTime", "_newTarget", "_currentTarget", "_range", "_pos", "_targetArray"]; // Reset arguments if we havnt rendered in over a second @@ -90,8 +91,18 @@ if (isNull _newTarget) then { __JavelinIGUITargetingGate ctrlShow true; __JavelinIGUITargetingLines ctrlShow true; + _constraintTop = __ConstraintTop; + _constraintLeft = __ConstraintLeft; + _constraintBottom = __ConstraintBottom; + _constraintRight = __ConstraintRight; + + _offsetX = __OffsetX; + _offsetY = __OffsetY; + + _zamerny = if (_currentTarget isKindOf "CAManBase") then {_currentTarget selectionPosition "body"} else {_currentTarget selectionPosition "zamerny"}; + _randomPosWithinBounds = [(_zamerny select 0) + 1 - (random 2.0),(_zamerny select 1) + 1 - (random 2.0),(_zamerny select 2) + 0.5 - (random 1.0)]; - _apos = worldToScreen (_newTarget modelToWorld _randomPosWithinBounds); + _apos = worldToScreen (_currentTarget modelToWorld _randomPosWithinBounds); _aposX = 0; _aposY = 0; @@ -114,21 +125,15 @@ if (isNull _newTarget) then { [_currentTarget,[-1,-1,-2],_currentTarget selectionPosition "zamerny"]; }; - _bpos = _boundsInput call FUNC(worldToScreenBounds); - - _constraintTop = __ConstraintTop; - _constraintLeft = __ConstraintLeft; - _constraintBottom = __ConstraintBottom; - _constraintRight = __ConstraintRight; - - _offsetX = __OffsetX; - _offsetY = __OffsetY; - + _bpos = _boundsInput call EFUNC(common,worldToScreenBounds); + _minX = ((_bpos select 0) + _offsetX) max _constraintLeft; _minY = ((_bpos select 1) + _offsetY) max _constraintTop; _maxX = ((_bpos select 2) + _offsetX) min (_constraintRight - 0.025*(3/4)*SafezoneH); _maxY = ((_bpos select 3) + _offsetY) min (_constraintBottom - 0.025*SafezoneH); + TRACE_4("", _boundsInput, _bpos, _minX, _minY); + __JavelinIGUITargetingGateTL ctrlSetPosition [_minX,_minY]; __JavelinIGUITargetingGateTR ctrlSetPosition [_maxX,_minY]; __JavelinIGUITargetingGateBL ctrlSetPosition [_minX,_maxY]; diff --git a/addons/wep_javelin/functions/fnc_onOpticLoad.sqf b/addons/javelin/functions/fnc_onOpticLoad.sqf similarity index 100% rename from addons/wep_javelin/functions/fnc_onOpticLoad.sqf rename to addons/javelin/functions/fnc_onOpticLoad.sqf diff --git a/addons/wep_javelin/functions/fnc_showFireMode.sqf b/addons/javelin/functions/fnc_showFireMode.sqf similarity index 100% rename from addons/wep_javelin/functions/fnc_showFireMode.sqf rename to addons/javelin/functions/fnc_showFireMode.sqf diff --git a/addons/wep_javelin/functions/script_component.hpp b/addons/javelin/functions/script_component.hpp similarity index 100% rename from addons/wep_javelin/functions/script_component.hpp rename to addons/javelin/functions/script_component.hpp diff --git a/addons/wep_javelin/initKeybinds.sqf b/addons/javelin/initKeybinds.sqf similarity index 100% rename from addons/wep_javelin/initKeybinds.sqf rename to addons/javelin/initKeybinds.sqf diff --git a/addons/wep_javelin/script_component.hpp b/addons/javelin/script_component.hpp similarity index 90% rename from addons/wep_javelin/script_component.hpp rename to addons/javelin/script_component.hpp index 69fe7efe57..ca9cbaaad5 100644 --- a/addons/wep_javelin/script_component.hpp +++ b/addons/javelin/script_component.hpp @@ -51,10 +51,6 @@ #define __ConstraintLeft (((ctrlPosition __JavelinIGUITargetingConstrainLeft) select 0) + ((ctrlPosition (__JavelinIGUITargetingConstrainLeft)) select 2)) #define __ConstraintRight ((ctrlPosition __JavelinIGUITargetingConstrainRight) select 0) -#define __OffsetX ((ctrlPosition __JavelinIGUITargetingLineV) select 0) - 0.5 -#define __OffsetY ((ctrlPosition __JavelinIGUITargetingLineH) select 1) - 0.5 - - // Colors for controls #define __ColorOrange [0.9255,0.5216,0.1216,1] #define __ColorGreen [0.2941,0.8745,0.2157,1] diff --git a/addons/wep_javelin/stringtable.xml b/addons/javelin/stringtable.xml similarity index 100% rename from addons/wep_javelin/stringtable.xml rename to addons/javelin/stringtable.xml From fb6c99d69b113a45f42ac264613fa7110a8c4617 Mon Sep 17 00:00:00 2001 From: jaynus Date: Sat, 11 Apr 2015 10:56:58 -0700 Subject: [PATCH 04/12] re-path. Wtf safezones. --- addons/javelin/$PBOPREFIX$ | 2 +- addons/javelin/README.md | 2 +- addons/javelin/RscInGameUI.hpp | 8 ++++---- addons/javelin/functions/script_component.hpp | 2 +- addons/javelin/initKeybinds.sqf | 4 ++-- addons/javelin/script_component.hpp | 8 ++++---- addons/javelin/stringtable.xml | 6 +++--- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/addons/javelin/$PBOPREFIX$ b/addons/javelin/$PBOPREFIX$ index 311c0dad43..3497b9aaf6 100644 --- a/addons/javelin/$PBOPREFIX$ +++ b/addons/javelin/$PBOPREFIX$ @@ -1 +1 @@ -z\ace\addons\wep_javelin \ No newline at end of file +z\ace\addons\javelin \ No newline at end of file diff --git a/addons/javelin/README.md b/addons/javelin/README.md index df3ad9b29d..cfa7a4cd5d 100644 --- a/addons/javelin/README.md +++ b/addons/javelin/README.md @@ -1,4 +1,4 @@ -ace_wep_javelin +ace_javelin =============== Adds the Javelin AT launcher. diff --git a/addons/javelin/RscInGameUI.hpp b/addons/javelin/RscInGameUI.hpp index 457c7ac414..dd50558a5d 100644 --- a/addons/javelin/RscInGameUI.hpp +++ b/addons/javelin/RscInGameUI.hpp @@ -28,10 +28,10 @@ class RscInGameUI { class ACE_TargetingConstrains: RscControlsGroup { idc = 699100; - x = "SafezoneX"; - y = "SafezoneY"; - w = "SafezoneW-SafezoneX"; - h = "SafezoneH-SafezoneY"; + x = "SafezoneX-SafezoneW"; + y = "SafezoneY-SafezoneH"; + w = "SafezoneW"; + h = "SafezoneH"; enabled = 0; class VScrollbar { autoScrollSpeed = -1; diff --git a/addons/javelin/functions/script_component.hpp b/addons/javelin/functions/script_component.hpp index fdc194ff7b..21c6597c86 100644 --- a/addons/javelin/functions/script_component.hpp +++ b/addons/javelin/functions/script_component.hpp @@ -1 +1 @@ -#include "\z\ace\addons\wep_javelin\script_component.hpp" \ No newline at end of file +#include "\z\ace\addons\javelin\script_component.hpp" \ No newline at end of file diff --git a/addons/javelin/initKeybinds.sqf b/addons/javelin/initKeybinds.sqf index 126b1395a3..6634b1f623 100644 --- a/addons/javelin/initKeybinds.sqf +++ b/addons/javelin/initKeybinds.sqf @@ -1,6 +1,6 @@ // by commy2 -["ACE3", QGVAR(lockTarget), localize "STR_ACE_WEP_JAVELIN_LockTarget", +["ACE3", QGVAR(lockTarget), localize "STR_ACE_JAVELIN_LockTarget", { if (GETGVAR(isLockKeyDown,false)) exitWith {false}; @@ -21,7 +21,7 @@ }, [15, [false, false, false]], false] call cba_fnc_addKeybind; //Tab Key -["ACE3", QGVAR(cycleFireMode), localize "STR_ACE_WEP_JAVELIN_CycleFireMode", +["ACE3", QGVAR(cycleFireMode), localize "STR_ACE_JAVELIN_CycleFireMode", { false }, { [ACE_player] call FUNC(cycleFireMode); diff --git a/addons/javelin/script_component.hpp b/addons/javelin/script_component.hpp index ca9cbaaad5..a0199e28d7 100644 --- a/addons/javelin/script_component.hpp +++ b/addons/javelin/script_component.hpp @@ -1,12 +1,12 @@ -#define COMPONENT wep_javelin +#define COMPONENT javelin #include "\z\ace\Addons\main\script_mod.hpp" -#ifdef DEBUG_ENABLED_WEP_JAVELIN +#ifdef DEBUG_ENABLED_JAVELIN #define DEBUG_MODE_FULL #endif -#ifdef DEBUG_SETTINGS_WEP_JAVELIN - #define DEBUG_SETTINGS DEBUG_SETTINGS_WEP_JAVELIN +#ifdef DEBUG_SETTINGS_JAVELIN + #define DEBUG_SETTINGS DEBUG_SETTINGS_JAVELIN #endif #include "\z\ace\Addons\main\script_macros.hpp" diff --git a/addons/javelin/stringtable.xml b/addons/javelin/stringtable.xml index a691c750cb..503b876855 100644 --- a/addons/javelin/stringtable.xml +++ b/addons/javelin/stringtable.xml @@ -1,8 +1,8 @@ - - + + Lock Target (Hold) Lock Target (Hold) Lock Target (Hold) @@ -11,7 +11,7 @@ Fijar objetivo (Mantener) Lock Target (Hold) - + Cycle Fire Mode Cycle Fire Mode Cycle Fire Mode From aa53a1815c7a27ef1ce1a67a6cfebbfa4fa9c102 Mon Sep 17 00:00:00 2001 From: jaynus Date: Sat, 11 Apr 2015 10:58:27 -0700 Subject: [PATCH 05/12] scaling. --- addons/javelin/RscInGameUI.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/javelin/RscInGameUI.hpp b/addons/javelin/RscInGameUI.hpp index dd50558a5d..457c7ac414 100644 --- a/addons/javelin/RscInGameUI.hpp +++ b/addons/javelin/RscInGameUI.hpp @@ -28,10 +28,10 @@ class RscInGameUI { class ACE_TargetingConstrains: RscControlsGroup { idc = 699100; - x = "SafezoneX-SafezoneW"; - y = "SafezoneY-SafezoneH"; - w = "SafezoneW"; - h = "SafezoneH"; + x = "SafezoneX"; + y = "SafezoneY"; + w = "SafezoneW-SafezoneX"; + h = "SafezoneH-SafezoneY"; enabled = 0; class VScrollbar { autoScrollSpeed = -1; From 458958ef09e774c898d3aa82e560e66306b058ad Mon Sep 17 00:00:00 2001 From: jaynus Date: Sat, 11 Apr 2015 11:17:34 -0700 Subject: [PATCH 06/12] Target gating implemented. --- addons/javelin/RscInGameUI.hpp | 293 ++++++++++--------- addons/javelin/functions/fnc_onOpticDraw.sqf | 2 + addons/javelin/functions/fnc_onOpticLoad.sqf | 2 + addons/javelin/script_component.hpp | 2 + 4 files changed, 158 insertions(+), 141 deletions(-) diff --git a/addons/javelin/RscInGameUI.hpp b/addons/javelin/RscInGameUI.hpp index 457c7ac414..b324ed1609 100644 --- a/addons/javelin/RscInGameUI.hpp +++ b/addons/javelin/RscInGameUI.hpp @@ -12,7 +12,7 @@ class RscLine; class RscInGameUI { class RscOptics_titan { idd = 300; - controls[] = {"ACE_javelin_elements_group", "CA_Distance", "ACE_TargetingConstrains", "ACE_TargetingGate", "ACE_TargetingLines"}; + controls[] = {"ACE_javelin_elements_group", "CA_Distance", "ACE_Targeting" }; //, "ACE_TargetingConstrains", "ACE_TargetingGate", "ACE_TargetingLines"}; onLoad = QUOTE(_this call FUNC(onOpticLoad)); onUnload = "uiNameSpace setVariable ['ACE_RscOptics_javelin',nil];"; @@ -25,170 +25,181 @@ class RscInGameUI { w = 0; h = 0; }; - - class ACE_TargetingConstrains: RscControlsGroup { - idc = 699100; + class ACE_Targeting : RscControlsGroup { + idc = 6999; + x = "SafezoneX"; - y = "SafezoneY"; - w = "SafezoneW-SafezoneX"; - h = "SafezoneH-SafezoneY"; - enabled = 0; - class VScrollbar { - autoScrollSpeed = -1; - autoScrollDelay = 5; - autoScrollRewind = 0; - color[] = {1,1,1,0}; - width = 0.001; - }; - class HScrollbar { - color[] = {1,1,1,0}; - height = 0.001; - }; + y = "SafezoneY"; + w = "SafezoneW"; + h = "SafezoneH"; + + enabled = 1; class Controls { - class Top: RscPicture { - idc = 699101; - text = "#(argb,8,8,3)color(1,1,1,1)"; - colorText[] = {0.2941,0.2941,0.2941,1}; - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.15*SafezoneH-SafezoneY"; - w = "(3/4)*SafezoneH"; - h = "0.21*SafezoneH"; - }; - class Bottom: Top { - idc = 699102; - y = "0.64*SafezoneH-SafezoneY"; - }; - class Left: Top { - idc = 699103; - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.36*SafezoneH-SafezoneY"; - w = "0.31*(3/4)*SafezoneH"; - h = "0.28*SafezoneH"; - }; - class Right: Left { - idc = 699104; - x = "((SafezoneW -(3/4)*SafezoneH)/2)+ 0.69*(3/4)*SafezoneH - SafezoneX"; - }; - class OpticsBorders: RscPicture { - idc = 699105; - text = PATHTOF(data\javelin_ui_border_ca.paa); - colorText[] = {0,0,0,1}; - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.15*SafezoneH-SafezoneY"; - w = "(3/4)*SafezoneH"; - h = "0.7*SafezoneH"; - }; - }; - }; - - class ACE_TargetingGate : ACE_TargetingConstrains { - idc = 699200; - class Controls { - class TargetingGateTL: ACE_TargetingConstrains { - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.15*SafezoneH - SafezoneY"; - idc = 699201; + class ACE_TargetingConstrains: RscControlsGroup { + x = "SafezoneX"; + y = "SafezoneY"; + w = "SafezoneW-SafezoneX"; + h = "SafezoneH-SafezoneY"; + + enabled = 1; + class VScrollbar { + autoScrollSpeed = -1; + autoScrollDelay = 5; + autoScrollRewind = 0; + color[] = {1,1,1,0}; + width = 0.001; + }; + class HScrollbar { + color[] = {1,1,1,0}; + height = 0.001; + }; class Controls { - class LineH: RscLine { - idc = 699210; - x = "0"; - y = "0"; - w = "0.025*(3/4)*SafezoneH"; - h = "0"; - colorText[] = {0.8745,0.8745,0.8745,1}; + class Top: RscPicture { + idc = 699101; + text = "#(argb,8,8,3)color(1,1,1,1)"; + colorText[] = {0.2941,0.2941,0.2941,1}; + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.15*SafezoneH-SafezoneY"; + w = "(3/4)*SafezoneH"; + h = "0.21*SafezoneH"; }; - class LineV: LineH { - idc = 699211; - w = "0"; - h = "0.025*SafezoneH"; + class Bottom: Top { + idc = 699102; + y = "0.64*SafezoneH-SafezoneY"; + }; + class Left: Top { + idc = 699103; + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.36*SafezoneH-SafezoneY"; + w = "0.31*(3/4)*SafezoneH"; + h = "0.28*SafezoneH"; + }; + class Right: Left { + idc = 699104; + x = "((SafezoneW -(3/4)*SafezoneH)/2)+ 0.69*(3/4)*SafezoneH - SafezoneX"; + }; + class OpticsBorders: RscPicture { + idc = 699105; + text = PATHTOF(data\javelin_ui_border_ca.paa); + colorText[] = {0,0,0,1}; + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.15*SafezoneH-SafezoneY"; + w = "(3/4)*SafezoneH"; + h = "0.7*SafezoneH"; }; }; }; - class TargetingGateTR: TargetingGateTL { - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX + 0.975*(3/4)*SafezoneH"; - y = "0.15*SafezoneH - SafezoneY"; - idc = 699202; + + class ACE_TargetingGate : ACE_TargetingConstrains { + idc = 699200; class Controls { - class LineH: RscLine { - idc = 699220; - x = "0"; - y = "0"; - w = "0.025*(3/4)*SafezoneH"; - h = "0"; - colorText[] = {0.8745,0.8745,0.8745,1}; + class TargetingGateTL: ACE_TargetingConstrains { + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.15*SafezoneH - SafezoneY"; + idc = 699201; + class Controls { + class LineH: RscLine { + idc = 699210; + x = "0"; + y = "0"; + w = "0.025*(3/4)*SafezoneH"; + h = "0"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + class LineV: LineH { + idc = 699211; + w = "0"; + h = "0.025*SafezoneH"; + }; + }; }; - class LineV: LineH { - idc = 699221; - x = "0.025*(3/4)*SafezoneH"; - w = "0"; - h = "0.025*SafezoneH"; + class TargetingGateTR: TargetingGateTL { + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX + 0.975*(3/4)*SafezoneH"; + y = "0.15*SafezoneH - SafezoneY"; + idc = 699202; + class Controls { + class LineH: RscLine { + idc = 699220; + x = "0"; + y = "0"; + w = "0.025*(3/4)*SafezoneH"; + h = "0"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + class LineV: LineH { + idc = 699221; + x = "0.025*(3/4)*SafezoneH"; + w = "0"; + h = "0.025*SafezoneH"; + }; + }; + }; + class TargetingGateBL: TargetingGateTL { + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.825*SafezoneH - SafezoneY"; + idc = 699203; + class Controls { + class LineH: RscLine { + x = "0"; + y = "0.025*SafezoneH"; + w = "0.025*(3/4)*SafezoneH"; + h = "0"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + class LineV: LineH { + y = "0"; + w = "0"; + h = "0.025*SafezoneH"; + }; + }; + }; + class TargetingGateBR: TargetingGateBL { + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX + 0.975*(3/4)*SafezoneH"; + y = "0.825*SafezoneH - SafezoneY"; + idc = 699204; + class Controls { + class LineH: RscLine { + x = "0"; + y = "0.025*SafezoneH"; + w = "0.025*(3/4)*SafezoneH"; + h = "0"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + class LineV: LineH { + x = "0.025*(3/4)*SafezoneH"; + y = "0"; + w = "0"; + h = "0.025*SafezoneH"; + }; + }; }; }; }; - class TargetingGateBL: TargetingGateTL { - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.825*SafezoneH - SafezoneY"; - idc = 699203; + + + class ACE_TargetingLines: ACE_TargetingConstrains { + idc = 699300; class Controls { class LineH: RscLine { - x = "0"; - y = "0.025*SafezoneH"; - w = "0.025*(3/4)*SafezoneH"; + idc = 699301; + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.5*SafezoneH - SafezoneY"; + w = "(3/4)*SafezoneH"; h = "0"; colorText[] = {0.8745,0.8745,0.8745,1}; }; - class LineV: LineH { - y = "0"; + class LineV: RscLine { + idc = 699302; + x = "0.5*SafezoneW - SafezoneX"; + y = "0.15*SafezoneH - SafezoneY"; w = "0"; - h = "0.025*SafezoneH"; - }; - }; - }; - class TargetingGateBR: TargetingGateBL { - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX + 0.975*(3/4)*SafezoneH"; - y = "0.825*SafezoneH - SafezoneY"; - idc = 699204; - class Controls { - class LineH: RscLine { - x = "0"; - y = "0.025*SafezoneH"; - w = "0.025*(3/4)*SafezoneH"; - h = "0"; + h = "0.7*SafezoneH"; colorText[] = {0.8745,0.8745,0.8745,1}; }; - class LineV: LineH { - x = "0.025*(3/4)*SafezoneH"; - y = "0"; - w = "0"; - h = "0.025*SafezoneH"; - }; }; }; }; }; - - class ACE_TargetingLines: ACE_TargetingConstrains { - idc = 699300; - class Controls { - class LineH: RscLine { - idc = 699301; - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.5*SafezoneH - SafezoneY"; - w = "(3/4)*SafezoneH"; - h = "0"; - colorText[] = {0.8745,0.8745,0.8745,1}; - }; - class LineV: RscLine { - idc = 699302; - x = "0.5*SafezoneW - SafezoneX"; - y = "0.15*SafezoneH - SafezoneY"; - w = "0"; - h = "0.7*SafezoneH"; - colorText[] = {0.8745,0.8745,0.8745,1}; - }; - }; - }; - class ACE_javelin_elements_group: RscControlsGroup { x = "SafezoneX"; diff --git a/addons/javelin/functions/fnc_onOpticDraw.sqf b/addons/javelin/functions/fnc_onOpticDraw.sqf index cb62327396..393dd04b6d 100644 --- a/addons/javelin/functions/fnc_onOpticDraw.sqf +++ b/addons/javelin/functions/fnc_onOpticDraw.sqf @@ -61,6 +61,7 @@ if (isNull _newTarget) then { __JavelinIGUISeek ctrlSetTextColor __ColorGray; __JavelinIGUINFOV ctrlSetTextColor __ColorGreen; + __JavelinIGUITargeting ctrlShow false; __JavelinIGUITargetingConstrains ctrlShow false; __JavelinIGUITargetingGate ctrlShow false; __JavelinIGUITargetingLines ctrlShow false; @@ -87,6 +88,7 @@ if (isNull _newTarget) then { __JavelinIGUISeek ctrlSetTextColor __ColorGreen; __JavelinIGUINFOV ctrlSetTextColor __ColorNull; + __JavelinIGUITargeting ctrlShow true; __JavelinIGUITargetingConstrains ctrlShow true; __JavelinIGUITargetingGate ctrlShow true; __JavelinIGUITargetingLines ctrlShow true; diff --git a/addons/javelin/functions/fnc_onOpticLoad.sqf b/addons/javelin/functions/fnc_onOpticLoad.sqf index 3dfa3e2f9a..352e6bfd12 100644 --- a/addons/javelin/functions/fnc_onOpticLoad.sqf +++ b/addons/javelin/functions/fnc_onOpticLoad.sqf @@ -2,6 +2,7 @@ #include "script_component.hpp" TRACE_1("enter", _this); + if((count _this) > 0) then { uiNameSpace setVariable ['ACE_RscOptics_javelin',_this select 0]; }; @@ -11,6 +12,7 @@ ACE_player setVariable ["ace_missileguidance_target",nil, false]; __JavelinIGUISeek ctrlSetTextColor __ColorGray; __JavelinIGUINFOV ctrlSetTextColor __ColorGray; +__JavelinIGUITargeting ctrlShow false; __JavelinIGUITargetingConstrains ctrlShow false; __JavelinIGUITargetingGate ctrlShow false; __JavelinIGUITargetingLines ctrlShow false; diff --git a/addons/javelin/script_component.hpp b/addons/javelin/script_component.hpp index a0199e28d7..6aa34b6bc8 100644 --- a/addons/javelin/script_component.hpp +++ b/addons/javelin/script_component.hpp @@ -19,6 +19,8 @@ #define __JavelinIGUI (uinamespace getVariable "ACE_RscOptics_javelin") // Custom controls +#define __JavelinIGUITargeting (__JavelinIGUI displayCtrl 6999) + #define __JavelinIGUISeek (__JavelinIGUI displayCtrl 699000) #define __JavelinIGUITop (__JavelinIGUI displayCtrl 699001) #define __JavelinIGUIDir (__JavelinIGUI displayCtrl 699002) From 505005891d76390cc506464b708564a6c36966f5 Mon Sep 17 00:00:00 2001 From: jaynus Date: Sat, 11 Apr 2015 12:42:30 -0700 Subject: [PATCH 07/12] Remove debug, targeting constraints working. --- addons/javelin/RscInGameUI.hpp | 353 ++++++++++--------- addons/javelin/functions/fnc_onOpticDraw.sqf | 7 +- 2 files changed, 180 insertions(+), 180 deletions(-) diff --git a/addons/javelin/RscInGameUI.hpp b/addons/javelin/RscInGameUI.hpp index b324ed1609..929838d373 100644 --- a/addons/javelin/RscInGameUI.hpp +++ b/addons/javelin/RscInGameUI.hpp @@ -12,7 +12,7 @@ class RscLine; class RscInGameUI { class RscOptics_titan { idd = 300; - controls[] = {"ACE_javelin_elements_group", "CA_Distance", "ACE_Targeting" }; //, "ACE_TargetingConstrains", "ACE_TargetingGate", "ACE_TargetingLines"}; + controls[] = { "ACE_javelin_elements_group", "CA_Distance", "ACE_Targeting" }; //, "ACE_TargetingConstrains", "ACE_TargetingGate", "ACE_TargetingLines"}; onLoad = QUOTE(_this call FUNC(onOpticLoad)); onUnload = "uiNameSpace setVariable ['ACE_RscOptics_javelin',nil];"; @@ -25,181 +25,7 @@ class RscInGameUI { w = 0; h = 0; }; - class ACE_Targeting : RscControlsGroup { - idc = 6999; - - x = "SafezoneX"; - y = "SafezoneY"; - w = "SafezoneW"; - h = "SafezoneH"; - - enabled = 1; - class Controls { - class ACE_TargetingConstrains: RscControlsGroup { - x = "SafezoneX"; - y = "SafezoneY"; - w = "SafezoneW-SafezoneX"; - h = "SafezoneH-SafezoneY"; - - enabled = 1; - class VScrollbar { - autoScrollSpeed = -1; - autoScrollDelay = 5; - autoScrollRewind = 0; - color[] = {1,1,1,0}; - width = 0.001; - }; - class HScrollbar { - color[] = {1,1,1,0}; - height = 0.001; - }; - class Controls { - class Top: RscPicture { - idc = 699101; - text = "#(argb,8,8,3)color(1,1,1,1)"; - colorText[] = {0.2941,0.2941,0.2941,1}; - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.15*SafezoneH-SafezoneY"; - w = "(3/4)*SafezoneH"; - h = "0.21*SafezoneH"; - }; - class Bottom: Top { - idc = 699102; - y = "0.64*SafezoneH-SafezoneY"; - }; - class Left: Top { - idc = 699103; - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.36*SafezoneH-SafezoneY"; - w = "0.31*(3/4)*SafezoneH"; - h = "0.28*SafezoneH"; - }; - class Right: Left { - idc = 699104; - x = "((SafezoneW -(3/4)*SafezoneH)/2)+ 0.69*(3/4)*SafezoneH - SafezoneX"; - }; - class OpticsBorders: RscPicture { - idc = 699105; - text = PATHTOF(data\javelin_ui_border_ca.paa); - colorText[] = {0,0,0,1}; - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.15*SafezoneH-SafezoneY"; - w = "(3/4)*SafezoneH"; - h = "0.7*SafezoneH"; - }; - }; - }; - - class ACE_TargetingGate : ACE_TargetingConstrains { - idc = 699200; - class Controls { - class TargetingGateTL: ACE_TargetingConstrains { - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.15*SafezoneH - SafezoneY"; - idc = 699201; - class Controls { - class LineH: RscLine { - idc = 699210; - x = "0"; - y = "0"; - w = "0.025*(3/4)*SafezoneH"; - h = "0"; - colorText[] = {0.8745,0.8745,0.8745,1}; - }; - class LineV: LineH { - idc = 699211; - w = "0"; - h = "0.025*SafezoneH"; - }; - }; - }; - class TargetingGateTR: TargetingGateTL { - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX + 0.975*(3/4)*SafezoneH"; - y = "0.15*SafezoneH - SafezoneY"; - idc = 699202; - class Controls { - class LineH: RscLine { - idc = 699220; - x = "0"; - y = "0"; - w = "0.025*(3/4)*SafezoneH"; - h = "0"; - colorText[] = {0.8745,0.8745,0.8745,1}; - }; - class LineV: LineH { - idc = 699221; - x = "0.025*(3/4)*SafezoneH"; - w = "0"; - h = "0.025*SafezoneH"; - }; - }; - }; - class TargetingGateBL: TargetingGateTL { - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.825*SafezoneH - SafezoneY"; - idc = 699203; - class Controls { - class LineH: RscLine { - x = "0"; - y = "0.025*SafezoneH"; - w = "0.025*(3/4)*SafezoneH"; - h = "0"; - colorText[] = {0.8745,0.8745,0.8745,1}; - }; - class LineV: LineH { - y = "0"; - w = "0"; - h = "0.025*SafezoneH"; - }; - }; - }; - class TargetingGateBR: TargetingGateBL { - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX + 0.975*(3/4)*SafezoneH"; - y = "0.825*SafezoneH - SafezoneY"; - idc = 699204; - class Controls { - class LineH: RscLine { - x = "0"; - y = "0.025*SafezoneH"; - w = "0.025*(3/4)*SafezoneH"; - h = "0"; - colorText[] = {0.8745,0.8745,0.8745,1}; - }; - class LineV: LineH { - x = "0.025*(3/4)*SafezoneH"; - y = "0"; - w = "0"; - h = "0.025*SafezoneH"; - }; - }; - }; - }; - }; - - - class ACE_TargetingLines: ACE_TargetingConstrains { - idc = 699300; - class Controls { - class LineH: RscLine { - idc = 699301; - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.5*SafezoneH - SafezoneY"; - w = "(3/4)*SafezoneH"; - h = "0"; - colorText[] = {0.8745,0.8745,0.8745,1}; - }; - class LineV: RscLine { - idc = 699302; - x = "0.5*SafezoneW - SafezoneX"; - y = "0.15*SafezoneH - SafezoneY"; - w = "0"; - h = "0.7*SafezoneH"; - colorText[] = {0.8745,0.8745,0.8745,1}; - }; - }; - }; - }; - }; + class ACE_javelin_elements_group: RscControlsGroup { x = "SafezoneX"; @@ -442,6 +268,181 @@ class RscInGameUI { }; }; }; + class ACE_Targeting : RscControlsGroup { + idc = 6999; + + x = "SafezoneX"; + y = "SafezoneY"; + w = "SafezoneW"; + h = "SafezoneH"; + + enabled = 1; + class Controls { + class ACE_TargetingConstrains: RscControlsGroup { + x = "SafezoneX"; + y = "SafezoneY"; + w = "SafezoneW-SafezoneX"; + h = "SafezoneH-SafezoneY"; + + enabled = 1; + class VScrollbar { + autoScrollSpeed = -1; + autoScrollDelay = 5; + autoScrollRewind = 0; + color[] = {1,1,1,0}; + width = 0.001; + }; + class HScrollbar { + color[] = {1,1,1,0}; + height = 0.001; + }; + class Controls { + class Top: RscPicture { + idc = 699101; + text = "#(argb,8,8,3)color(1,1,1,1)"; + colorText[] = {0.2941,0.2941,0.2941,1}; + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.15*SafezoneH-SafezoneY"; + w = "(3/4)*SafezoneH"; + h = "0.21*SafezoneH"; + }; + class Bottom: Top { + idc = 699102; + y = "0.64*SafezoneH-SafezoneY"; + }; + class Left: Top { + idc = 699103; + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.36*SafezoneH-SafezoneY"; + w = "0.31*(3/4)*SafezoneH"; + h = "0.28*SafezoneH"; + }; + class Right: Left { + idc = 699104; + x = "((SafezoneW -(3/4)*SafezoneH)/2)+ 0.69*(3/4)*SafezoneH - SafezoneX"; + }; + class OpticsBorders: RscPicture { + idc = 699105; + text = PATHTOF(data\javelin_ui_border_ca.paa); + colorText[] = {0,0,0,1}; + x = "((SafezoneW -(3.1/4)*SafezoneH)/2) - SafezoneX"; + y = "0.15*SafezoneH-SafezoneY"; + w = "(3.1/4)*SafezoneH"; + h = "0.7*SafezoneH"; + }; + }; + }; + + class ACE_TargetingGate : ACE_TargetingConstrains { + idc = 699200; + class Controls { + class TargetingGateTL: ACE_TargetingConstrains { + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.15*SafezoneH - SafezoneY"; + idc = 699201; + class Controls { + class LineH: RscLine { + idc = 699210; + x = "0"; + y = "0"; + w = "0.025*(3/4)*SafezoneH"; + h = "0"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + class LineV: LineH { + idc = 699211; + w = "0"; + h = "0.025*SafezoneH"; + }; + }; + }; + class TargetingGateTR: TargetingGateTL { + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX + 0.975*(3/4)*SafezoneH"; + y = "0.15*SafezoneH - SafezoneY"; + idc = 699202; + class Controls { + class LineH: RscLine { + idc = 699220; + x = "0"; + y = "0"; + w = "0.025*(3/4)*SafezoneH"; + h = "0"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + class LineV: LineH { + idc = 699221; + x = "0.025*(3/4)*SafezoneH"; + w = "0"; + h = "0.025*SafezoneH"; + }; + }; + }; + class TargetingGateBL: TargetingGateTL { + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.825*SafezoneH - SafezoneY"; + idc = 699203; + class Controls { + class LineH: RscLine { + x = "0"; + y = "0.025*SafezoneH"; + w = "0.025*(3/4)*SafezoneH"; + h = "0"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + class LineV: LineH { + y = "0"; + w = "0"; + h = "0.025*SafezoneH"; + }; + }; + }; + class TargetingGateBR: TargetingGateBL { + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX + 0.975*(3/4)*SafezoneH"; + y = "0.825*SafezoneH - SafezoneY"; + idc = 699204; + class Controls { + class LineH: RscLine { + x = "0"; + y = "0.025*SafezoneH"; + w = "0.025*(3/4)*SafezoneH"; + h = "0"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + class LineV: LineH { + x = "0.025*(3/4)*SafezoneH"; + y = "0"; + w = "0"; + h = "0.025*SafezoneH"; + }; + }; + }; + }; + }; + + + class ACE_TargetingLines: ACE_TargetingConstrains { + idc = 699300; + class Controls { + class LineH: RscLine { + idc = 699301; + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.5*SafezoneH - SafezoneY"; + w = "(3/4)*SafezoneH"; + h = "0"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + class LineV: RscLine { + idc = 699302; + x = "0.5*SafezoneW - SafezoneX"; + y = "0.15*SafezoneH - SafezoneY"; + w = "0"; + h = "0.7*SafezoneH"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + }; + }; + }; + }; }; }; diff --git a/addons/javelin/functions/fnc_onOpticDraw.sqf b/addons/javelin/functions/fnc_onOpticDraw.sqf index 393dd04b6d..90772cf9e3 100644 --- a/addons/javelin/functions/fnc_onOpticDraw.sqf +++ b/addons/javelin/functions/fnc_onOpticDraw.sqf @@ -1,9 +1,9 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" //TRACE_1("enter", _this); #define __TRACKINTERVAL 0.1 // how frequent the check should be. -#define __LOCKONTIME 1.85 // Lock on won't occur sooner +#define __LOCKONTIME 3.0 // Lock on won't occur sooner #define __LOCKONTIMERANDOM 0.3 // Deviation in lock on time #define __SENSORSQUARE 1 // Locking on sensor square side in angles @@ -83,7 +83,7 @@ if (isNull _newTarget) then { playSound "ACE_Javelin_Locking"; } else { - if(diag_tickTime - _lockTime > 3) then { + if(diag_tickTime - _lockTime > __LOCKONTIME) then { TRACE_2("LOCKED!", _currentTarget, _lockTime); __JavelinIGUISeek ctrlSetTextColor __ColorGreen; @@ -143,7 +143,6 @@ if (isNull _newTarget) then { {_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingGateTL,__JavelinIGUITargetingGateTR,__JavelinIGUITargetingGateBL,__JavelinIGUITargetingGateBR]; - ACE_player setVariable["ace_missileguidance_target", _currentTarget, false]; if(diag_tickTime > _soundTime) then { From 2999ff55e1bd9edad5cdf084917a53da14ddf450 Mon Sep 17 00:00:00 2001 From: jaynus Date: Sat, 11 Apr 2015 13:37:55 -0700 Subject: [PATCH 08/12] Working javelin targeting and gating. Still has red center target optic because I cant do optic p3d's. TODO: We need an optic p3d. --- addons/javelin/CfgWeapons.hpp | 13 +++++ addons/javelin/RscInGameUI.hpp | 6 ++- addons/javelin/config.cpp | 3 +- addons/javelin/functions/fnc_onOpticDraw.sqf | 52 +++++++++++++++----- 4 files changed, 60 insertions(+), 14 deletions(-) create mode 100644 addons/javelin/CfgWeapons.hpp diff --git a/addons/javelin/CfgWeapons.hpp b/addons/javelin/CfgWeapons.hpp new file mode 100644 index 0000000000..eccdd30623 --- /dev/null +++ b/addons/javelin/CfgWeapons.hpp @@ -0,0 +1,13 @@ +class CfgWeapons { + class Launcher; + class Launcher_Base_F : Launcher { + class WeaponSlotsInfo; + }; + + class launch_Titan_base : Launcher_Base_F { + weaponInfoType = "ACE_RscOptics_javelin"; + + lockingTargetSound[] = {"",0,1}; + lockedTargetSound[] = {"",0,1}; + }; +}; \ No newline at end of file diff --git a/addons/javelin/RscInGameUI.hpp b/addons/javelin/RscInGameUI.hpp index 929838d373..2f5e0b2007 100644 --- a/addons/javelin/RscInGameUI.hpp +++ b/addons/javelin/RscInGameUI.hpp @@ -10,7 +10,7 @@ class RscLine; // Taken from AGM for optics management. class RscInGameUI { - class RscOptics_titan { + class ACE_RscOptics_javelin { idd = 300; controls[] = { "ACE_javelin_elements_group", "CA_Distance", "ACE_Targeting" }; //, "ACE_TargetingConstrains", "ACE_TargetingGate", "ACE_TargetingLines"}; onLoad = QUOTE(_this call FUNC(onOpticLoad)); @@ -94,6 +94,7 @@ class RscInGameUI { x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.307/4)*3*SafezoneH - SafezoneX"; colorText[] = {0.2941,0.8745,0.2157,1}; }; + /* class StadiaL: RscLine { x = "0.4899*SafezoneW - SafezoneX"; y = "0.171*SafezoneH - SafezoneY"; @@ -136,6 +137,7 @@ class RscInGameUI { h = 0; colorText[] = {0.2941,0.8745,0.2157,1}; }; + */ }; }; class ACE_javelin_NFOV_mode_off: ACE_javelin_Day_mode_off { @@ -167,6 +169,7 @@ class RscInGameUI { y = "0.031*SafezoneH - SafezoneY"; colorText[] = {0.2941,0.8745,0.2157,1}; }; + /* class StadiaL: RscLine { x = "0.4788*SafezoneW - SafezoneX"; y = "0.171*SafezoneH - SafezoneY"; @@ -209,6 +212,7 @@ class RscInGameUI { h = "0.1895*SafezoneH"; colorText[] = {0.2941,0.8745,0.2157,1}; }; + */ }; }; diff --git a/addons/javelin/config.cpp b/addons/javelin/config.cpp index 0a38583ed9..9d7c14e448 100644 --- a/addons/javelin/config.cpp +++ b/addons/javelin/config.cpp @@ -12,4 +12,5 @@ class CfgPatches { #include "CfgEventhandlers.hpp" #include "RscInGameUI.hpp" -#include "CfgSounds.hpp" \ No newline at end of file +#include "CfgSounds.hpp" +#include "CfgWeapons.hpp" \ No newline at end of file diff --git a/addons/javelin/functions/fnc_onOpticDraw.sqf b/addons/javelin/functions/fnc_onOpticDraw.sqf index 90772cf9e3..a319c61de5 100644 --- a/addons/javelin/functions/fnc_onOpticDraw.sqf +++ b/addons/javelin/functions/fnc_onOpticDraw.sqf @@ -2,7 +2,7 @@ #include "script_component.hpp" //TRACE_1("enter", _this); -#define __TRACKINTERVAL 0.1 // how frequent the check should be. +#define __TRACKINTERVAL 0 // how frequent the check should be. #define __LOCKONTIME 3.0 // Lock on won't occur sooner #define __LOCKONTIMERANDOM 0.3 // Deviation in lock on time #define __SENSORSQUARE 1 // Locking on sensor square side in angles @@ -54,6 +54,18 @@ if (isNull _newTarget) then { _newTarget = cursorTarget; }; +// Create constants +_constraintTop = __ConstraintTop; +_constraintLeft = __ConstraintLeft; +_constraintBottom = __ConstraintBottom; +_constraintRight = __ConstraintRight; + +_offsetX = __OffsetX; +_offsetY = __OffsetY; + +__JavelinIGUITargeting ctrlShow true; +__JavelinIGUITargetingConstrains ctrlShow true; + if (isNull _newTarget) then { // No targets found _currentTarget = objNull; @@ -61,8 +73,6 @@ if (isNull _newTarget) then { __JavelinIGUISeek ctrlSetTextColor __ColorGray; __JavelinIGUINFOV ctrlSetTextColor __ColorGreen; - __JavelinIGUITargeting ctrlShow false; - __JavelinIGUITargetingConstrains ctrlShow false; __JavelinIGUITargetingGate ctrlShow false; __JavelinIGUITargetingLines ctrlShow false; @@ -92,15 +102,7 @@ if (isNull _newTarget) then { __JavelinIGUITargetingConstrains ctrlShow true; __JavelinIGUITargetingGate ctrlShow true; __JavelinIGUITargetingLines ctrlShow true; - - _constraintTop = __ConstraintTop; - _constraintLeft = __ConstraintLeft; - _constraintBottom = __ConstraintBottom; - _constraintRight = __ConstraintRight; - - _offsetX = __OffsetX; - _offsetY = __OffsetY; - + _zamerny = if (_currentTarget isKindOf "CAManBase") then {_currentTarget selectionPosition "body"} else {_currentTarget selectionPosition "zamerny"}; _randomPosWithinBounds = [(_zamerny select 0) + 1 - (random 2.0),(_zamerny select 1) + 1 - (random 2.0),(_zamerny select 2) + 0.5 - (random 1.0)]; @@ -150,6 +152,32 @@ if (isNull _newTarget) then { _soundTime = diag_tickTime + 0.25; }; } else { + __JavelinIGUITargeting ctrlShow true; + __JavelinIGUITargetingGate ctrlShow true; + __JavelinIGUITargetingLines ctrlShow false; + + ACE_player setVariable["ace_missileguidance_target", nil, false]; + + _boundsInput = if (_currentTarget isKindOf "CAManBase") then { + [_newTarget,[-1,-1,-2],_currentTarget selectionPosition "body"]; + } else { + [_newTarget,[-1,-1,-1],_currentTarget selectionPosition "zamerny"]; + }; + + _bpos = _boundsInput call EFUNC(common,worldToScreenBounds); + + _minX = ((_bpos select 0) + _offsetX) max _constraintLeft; + _minY = ((_bpos select 1) + _offsetY) max _constraintTop; + _maxX = ((_bpos select 2) + _offsetX) min (_constraintRight - 0.025*(3/4)*SafezoneH); + _maxY = ((_bpos select 3) + _offsetY) min (_constraintBottom - 0.025*SafezoneH); + + __JavelinIGUITargetingGateTL ctrlSetPosition [_minX,_minY]; + __JavelinIGUITargetingGateTR ctrlSetPosition [_maxX,_minY]; + __JavelinIGUITargetingGateBL ctrlSetPosition [_minX,_maxY]; + __JavelinIGUITargetingGateBR ctrlSetPosition [_maxX,_maxY]; + + {_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingGateTL,__JavelinIGUITargetingGateTR,__JavelinIGUITargetingGateBL,__JavelinIGUITargetingGateBR]; + if(diag_tickTime > _soundTime) then { playSound "ACE_Javelin_Locking"; _soundTime = diag_tickTime + 0.25; From 75216c2f8bc1a2c1adc022f1da754ac78458fd94 Mon Sep 17 00:00:00 2001 From: jaynus Date: Sat, 11 Apr 2015 13:39:16 -0700 Subject: [PATCH 09/12] readme, authors. --- AUTHORS.txt | 1 + addons/javelin/README.md | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index 86245ccd90..86c3c6ef9a 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -66,3 +66,4 @@ Sniperwolf572 Tonic Tourorist Valentin Torikian +zGuba \ No newline at end of file diff --git a/addons/javelin/README.md b/addons/javelin/README.md index cfa7a4cd5d..37685d9cce 100644 --- a/addons/javelin/README.md +++ b/addons/javelin/README.md @@ -9,4 +9,3 @@ Adds the Javelin AT launcher. The people responsible for merging changes to this component or answering potential questions. - [jaynus](https://github.com/walterpearce) -- [NouberNou](https://github.com/NouberNou) From 2418d99f9724c28faee9857c3989272b1b931e74 Mon Sep 17 00:00:00 2001 From: jaynus Date: Sat, 11 Apr 2015 13:41:00 -0700 Subject: [PATCH 10/12] Finalizes port. Closes #75 --- addons/javelin/functions/fnc_onOpticLoad.sqf | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/javelin/functions/fnc_onOpticLoad.sqf b/addons/javelin/functions/fnc_onOpticLoad.sqf index 352e6bfd12..49e9a25e61 100644 --- a/addons/javelin/functions/fnc_onOpticLoad.sqf +++ b/addons/javelin/functions/fnc_onOpticLoad.sqf @@ -2,7 +2,6 @@ #include "script_component.hpp" TRACE_1("enter", _this); - if((count _this) > 0) then { uiNameSpace setVariable ['ACE_RscOptics_javelin',_this select 0]; }; From d744074b2f8d2662c46fed08014fb410b92d707d Mon Sep 17 00:00:00 2001 From: jaynus Date: Sat, 11 Apr 2015 13:48:46 -0700 Subject: [PATCH 11/12] localization. --- addons/javelin/stringtable.xml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/addons/javelin/stringtable.xml b/addons/javelin/stringtable.xml index 503b876855..7e7201c35e 100644 --- a/addons/javelin/stringtable.xml +++ b/addons/javelin/stringtable.xml @@ -3,22 +3,22 @@ - Lock Target (Hold) - Lock Target (Hold) - Lock Target (Hold) - Lock Target (Hold) - Lock Target (Hold) - Fijar objetivo (Mantener) - Lock Target (Hold) + Lock Target (Javelin) + + + + + + - Cycle Fire Mode - Cycle Fire Mode - Cycle Fire Mode - Cycle Fire Mode - Cycle Fire Mode - Cambiar modo de fuego - Cycle Fire Mode + Cycle Attack Mode (Javelin) + + + + + + From 6e28b3b9b7e40481fbf4884c36d740f87091f675 Mon Sep 17 00:00:00 2001 From: jaynus Date: Sat, 11 Apr 2015 13:59:17 -0700 Subject: [PATCH 12/12] Disable gates (reload) --- addons/javelin/RscInGameUI.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/javelin/RscInGameUI.hpp b/addons/javelin/RscInGameUI.hpp index 2f5e0b2007..e208e18834 100644 --- a/addons/javelin/RscInGameUI.hpp +++ b/addons/javelin/RscInGameUI.hpp @@ -280,7 +280,7 @@ class RscInGameUI { w = "SafezoneW"; h = "SafezoneH"; - enabled = 1; + enabled = 0; class Controls { class ACE_TargetingConstrains: RscControlsGroup { x = "SafezoneX"; @@ -288,7 +288,7 @@ class RscInGameUI { w = "SafezoneW-SafezoneX"; h = "SafezoneH-SafezoneY"; - enabled = 1; + enabled = 0; class VScrollbar { autoScrollSpeed = -1; autoScrollDelay = 5;