Merge pull request #488 from acemod/javelinLocking

Javelin locking and CLU interface
This commit is contained in:
jaynus 2015-04-11 14:02:41 -07:00
commit ffb7c0fbaa
34 changed files with 405 additions and 280 deletions

View File

@ -66,3 +66,4 @@ Sniperwolf572 <tenga6@gmail.com>
Tonic Tonic
Tourorist <tourorist@gmail.com> Tourorist <tourorist@gmail.com>
Valentin Torikian <valentin.torikian@gmail.com> Valentin Torikian <valentin.torikian@gmail.com>
zGuba

View File

@ -182,6 +182,9 @@ PREP(waitAndExecute);
PREP(translateToWeaponSpace); PREP(translateToWeaponSpace);
PREP(translateToModelSpace); PREP(translateToModelSpace);
// Model and drawing helpers
PREP(worldToScreenBounds);
// config items // config items
PREP(getConfigType); PREP(getConfigType);
PREP(getItemType); PREP(getItemType);

View File

@ -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]

View File

@ -0,0 +1 @@
z\ace\addons\javelin

View File

@ -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};
};
};

View File

@ -1,4 +1,4 @@
ace_wep_javelin ace_javelin
=============== ===============
Adds the Javelin AT launcher. Adds the Javelin AT launcher.
@ -9,4 +9,3 @@ Adds the Javelin AT launcher.
The people responsible for merging changes to this component or answering potential questions. The people responsible for merging changes to this component or answering potential questions.
- [jaynus](https://github.com/walterpearce) - [jaynus](https://github.com/walterpearce)
- [NouberNou](https://github.com/NouberNou)

View File

@ -10,9 +10,9 @@ class RscLine;
// Taken from AGM for optics management. // Taken from AGM for optics management.
class RscInGameUI { class RscInGameUI {
class RscOptics_titan { class ACE_RscOptics_javelin {
idd = 300; idd = 300;
controls[] = {"ACE_javelin_elements_group"}; controls[] = { "ACE_javelin_elements_group", "CA_Distance", "ACE_Targeting" }; //, "ACE_TargetingConstrains", "ACE_TargetingGate", "ACE_TargetingLines"};
onLoad = QUOTE(_this call FUNC(onOpticLoad)); onLoad = QUOTE(_this call FUNC(onOpticLoad));
onUnload = "uiNameSpace setVariable ['ACE_RscOptics_javelin',nil];"; onUnload = "uiNameSpace setVariable ['ACE_RscOptics_javelin',nil];";
@ -94,6 +94,7 @@ class RscInGameUI {
x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.307/4)*3*SafezoneH - SafezoneX"; x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.307/4)*3*SafezoneH - SafezoneX";
colorText[] = {0.2941,0.8745,0.2157,1}; colorText[] = {0.2941,0.8745,0.2157,1};
}; };
/*
class StadiaL: RscLine { class StadiaL: RscLine {
x = "0.4899*SafezoneW - SafezoneX"; x = "0.4899*SafezoneW - SafezoneX";
y = "0.171*SafezoneH - SafezoneY"; y = "0.171*SafezoneH - SafezoneY";
@ -136,6 +137,7 @@ class RscInGameUI {
h = 0; h = 0;
colorText[] = {0.2941,0.8745,0.2157,1}; colorText[] = {0.2941,0.8745,0.2157,1};
}; };
*/
}; };
}; };
class ACE_javelin_NFOV_mode_off: ACE_javelin_Day_mode_off { class ACE_javelin_NFOV_mode_off: ACE_javelin_Day_mode_off {
@ -167,6 +169,7 @@ class RscInGameUI {
y = "0.031*SafezoneH - SafezoneY"; y = "0.031*SafezoneH - SafezoneY";
colorText[] = {0.2941,0.8745,0.2157,1}; colorText[] = {0.2941,0.8745,0.2157,1};
}; };
/*
class StadiaL: RscLine { class StadiaL: RscLine {
x = "0.4788*SafezoneW - SafezoneX"; x = "0.4788*SafezoneW - SafezoneX";
y = "0.171*SafezoneH - SafezoneY"; y = "0.171*SafezoneH - SafezoneY";
@ -209,15 +212,83 @@ class RscInGameUI {
h = "0.1895*SafezoneH"; h = "0.1895*SafezoneH";
colorText[] = {0.2941,0.8745,0.2157,1}; colorText[] = {0.2941,0.8745,0.2157,1};
}; };
*/
}; };
}; };
/*
class TargetingConstrains: RscControlsGroup { class ACE_javelin_SEEK_off: ACE_javelin_Day_mode_off {
idc = 699100; idc = 699000;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (0.863/4)*3*SafezoneH - SafezoneX";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\seek_co.paa";
};
class ACE_javelin_SEEK: ACE_javelin_SEEK_off {
idc = 166;
colorText[] = {0.2941,0.8745,0.2157,0};
};
class ACE_javelin_Missle_off: ACE_javelin_Day_mode_off {
idc = 1032;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (-0.134/4)*3*SafezoneH - SafezoneX";
y = "(SafezoneY + 0.208*SafezoneH) - SafezoneY";
colorText[] = {0.2941,0.2941,0.2941,1};
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\missle_co.paa";
};
class ACE_javelin_Missle: ACE_javelin_Missle_off {
idc = 167;
colorText[] = {0.9255,0.5216,0.1216,0};
};
class ACE_javelin_CLU_off: ACE_javelin_Missle_off {
idc = 1027;
y = "(SafezoneY + 0.436*SafezoneH) - SafezoneY";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\clu_co.paa";
};
class ACE_javelin_HangFire_off: ACE_javelin_Missle_off {
idc = 1028;
y = "(SafezoneY + 0.669*SafezoneH) - SafezoneY";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\hangfire_co.paa";
};
class ACE_javelin_TOP_off: ACE_javelin_Day_mode_off {
idc = 699001;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (1.023/4)*3*SafezoneH - SafezoneX";
y = "(SafezoneY + 0.208*SafezoneH) - SafezoneY";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\top_co.paa";
colorText[] = {0.2941,0.8745,0.2157,1};
};
class ACE_javelin_DIR: ACE_javelin_Day_mode {
idc = 699002;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (1.023/4)*3*SafezoneH - SafezoneX";
y = "(SafezoneY + 0.436*SafezoneH) - SafezoneY";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\dir_co.paa";
colorText[] = {0.2941,0.2941,0.2941,1};
};
class ACE_javelin_FLTR_mode_off: ACE_javelin_Day_mode_off {
idc = 1002;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (1.023/4)*3*SafezoneH - SafezoneX";
y = "(SafezoneY + 0.669*SafezoneH) - SafezoneY";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\fltr_co.paa";
};
class ACE_javelin_FLTR_mode: ACE_javelin_FLTR_mode_off {
idc = 161;
colorText[] = {0.2941,0.8745,0.2157,1};
};
};
};
class ACE_Targeting : RscControlsGroup {
idc = 6999;
x = "SafezoneX";
y = "SafezoneY";
w = "SafezoneW";
h = "SafezoneH";
enabled = 0;
class Controls {
class ACE_TargetingConstrains: RscControlsGroup {
x = "SafezoneX"; x = "SafezoneX";
y = "SafezoneY"; y = "SafezoneY";
w = "SafezoneW-SafezoneX"; w = "SafezoneW-SafezoneX";
h = "SafezoneH-SafezoneY"; h = "SafezoneH-SafezoneY";
enabled = 0;
class VScrollbar { class VScrollbar {
autoScrollSpeed = -1; autoScrollSpeed = -1;
autoScrollDelay = 5; autoScrollDelay = 5;
@ -258,18 +329,18 @@ class RscInGameUI {
idc = 699105; idc = 699105;
text = PATHTOF(data\javelin_ui_border_ca.paa); text = PATHTOF(data\javelin_ui_border_ca.paa);
colorText[] = {0,0,0,1}; colorText[] = {0,0,0,1};
x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; x = "((SafezoneW -(3.1/4)*SafezoneH)/2) - SafezoneX";
y = "0.15*SafezoneH-SafezoneY"; y = "0.15*SafezoneH-SafezoneY";
w = "(3/4)*SafezoneH"; w = "(3.1/4)*SafezoneH";
h = "0.7*SafezoneH"; h = "0.7*SafezoneH";
}; };
}; };
}; };
class TargetingGate: TargetingConstrains { class ACE_TargetingGate : ACE_TargetingConstrains {
idc = 699200; idc = 699200;
class Controls { class Controls {
class TargetingGateTL: TargetingConstrains { class TargetingGateTL: ACE_TargetingConstrains {
x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX";
y = "0.15*SafezoneH - SafezoneY"; y = "0.15*SafezoneH - SafezoneY";
idc = 699201; idc = 699201;
@ -351,8 +422,9 @@ class RscInGameUI {
}; };
}; };
}; };
class TargetingLines: TargetingConstrains {
class ACE_TargetingLines: ACE_TargetingConstrains {
idc = 699300; idc = 699300;
class Controls { class Controls {
class LineH: RscLine { class LineH: RscLine {
@ -373,62 +445,6 @@ class RscInGameUI {
}; };
}; };
}; };
*/
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";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\seek_co.paa";
};
class ACE_javelin_SEEK: ACE_javelin_SEEK_off {
idc = 166;
colorText[] = {0.2941,0.8745,0.2157,0};
};
class ACE_javelin_Missle_off: ACE_javelin_Day_mode_off {
idc = 1032;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (-0.134/4)*3*SafezoneH - SafezoneX";
y = "(SafezoneY + 0.208*SafezoneH) - SafezoneY";
colorText[] = {0.2941,0.2941,0.2941,1};
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\missle_co.paa";
};
class ACE_javelin_Missle: ACE_javelin_Missle_off {
idc = 167;
colorText[] = {0.9255,0.5216,0.1216,0};
};
class ACE_javelin_CLU_off: ACE_javelin_Missle_off {
idc = 1027;
y = "(SafezoneY + 0.436*SafezoneH) - SafezoneY";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\clu_co.paa";
};
class ACE_javelin_HangFire_off: ACE_javelin_Missle_off {
idc = 1028;
y = "(SafezoneY + 0.669*SafezoneH) - SafezoneY";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\hangfire_co.paa";
};
class ACE_javelin_TOP_off: ACE_javelin_Day_mode_off {
idc = 699001;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (1.023/4)*3*SafezoneH - SafezoneX";
y = "(SafezoneY + 0.208*SafezoneH) - SafezoneY";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\top_co.paa";
colorText[] = {0.2941,0.8745,0.2157,1};
};
class ACE_javelin_DIR: ACE_javelin_Day_mode {
idc = 699002;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (1.023/4)*3*SafezoneH - SafezoneX";
y = "(SafezoneY + 0.436*SafezoneH) - SafezoneY";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\dir_co.paa";
colorText[] = {0.2941,0.2941,0.2941,1};
};
class ACE_javelin_FLTR_mode_off: ACE_javelin_Day_mode_off {
idc = 1002;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (1.023/4)*3*SafezoneH - SafezoneX";
y = "(SafezoneY + 0.669*SafezoneH) - SafezoneY";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\fltr_co.paa";
};
class ACE_javelin_FLTR_mode: ACE_javelin_FLTR_mode_off {
idc = 161;
colorText[] = {0.2941,0.8745,0.2157,1};
};
}; };
}; };
}; };

View File

@ -1,8 +1,5 @@
#include "script_component.hpp" #include "script_component.hpp"
PREP(translateToWeaponSpace);
PREP(translateToModelSpace);
PREP(lockKeyDown); PREP(lockKeyDown);
PREP(lockKeyUp); PREP(lockKeyUp);

View File

@ -12,4 +12,5 @@ class CfgPatches {
#include "CfgEventhandlers.hpp" #include "CfgEventhandlers.hpp"
#include "RscInGameUI.hpp" #include "RscInGameUI.hpp"
#include "CfgSounds.hpp" #include "CfgSounds.hpp"
#include "CfgWeapons.hpp"

View File

@ -0,0 +1,211 @@
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
//TRACE_1("enter", _this);
#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
#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
_args = uiNamespace getVariable[QGVAR(arguments), [] ];
if( (count _args) > 0) then {
_lastTick = _args select 0;
if(diag_tickTime - _lastTick > 1) then {
[] call FUNC(onOpticLoad);
};
};
// Pull the arguments
_currentTarget = _args select 1;
_runTime = _args select 2;
_lockTime = _args select 3;
_soundTime = _args select 4;
// Find a target within the optic range
_newTarget = objNull;
// Bail on fast movement
if ((velocity ACE_player) distance [0,0,0] > 0.5 && {cameraView == "GUNNER"} && {cameraOn == ACE_player}) exitWith { // keep it steady.
ACE_player switchCamera "INTERNAL";
};
// Refresh the firemode
[] call FUNC(showFireMode);
// Only start locking on holding tab
if(!GVAR(isLockKeyDown)) exitWith { false };
_range = parseNumber (ctrlText __JavelinIGUIRangefinder);
if (_range > 50 && {_range < 2500}) then {
_pos = positionCameraToWorld [0,0,_range];
_targetArray = _pos nearEntities ["AllVehicles", _range/25];
if (count (_targetArray) > 0) then {
_newTarget = _targetArray select 0;
};
};
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;
_lockTime = 0;
__JavelinIGUISeek ctrlSetTextColor __ColorGray;
__JavelinIGUINFOV ctrlSetTextColor __ColorGreen;
__JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false;
ACE_player setVariable ["ace_missileguidance_target",nil, false];
// Disallow fire
//if (ACE_player ammo "Javelin" > 0 || {ACE_player ammo "ACE_Javelin_Direct" > 0}) then {ACE_player setWeaponReloadingTime //[player, "Javelin", 0.2];};
} else {
if (_newTarget distance ACE_player < 2500
// && {(call CBA_fnc_getFoV) select 1 > 7}
// && { (currentVisionMode ACE_player == 2)}
) then {
// Lock on after 3 seconds
if(_currentTarget != _newTarget) then {
TRACE_1("New Target, reseting locking", _newTarget);
_lockTime = diag_tickTime;
_currentTarget = _newTarget;
playSound "ACE_Javelin_Locking";
} else {
if(diag_tickTime - _lockTime > __LOCKONTIME) then {
TRACE_2("LOCKED!", _currentTarget, _lockTime);
__JavelinIGUISeek ctrlSetTextColor __ColorGreen;
__JavelinIGUINFOV ctrlSetTextColor __ColorNull;
__JavelinIGUITargeting ctrlShow true;
__JavelinIGUITargetingConstrains ctrlShow true;
__JavelinIGUITargetingGate ctrlShow true;
__JavelinIGUITargetingLines ctrlShow true;
_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 (_currentTarget 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 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];
__JavelinIGUITargetingGateBR ctrlSetPosition [_maxX,_maxY];
{_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingGateTL,__JavelinIGUITargetingGateTR,__JavelinIGUITargetingGateBL,__JavelinIGUITargetingGateBR];
ACE_player setVariable["ace_missileguidance_target", _currentTarget, false];
if(diag_tickTime > _soundTime) then {
playSound "ACE_Javelin_Locked";
_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;
};
};
};
} else {
// Something is wrong with our seek
_currentTarget = objNull;
__JavelinIGUISeek ctrlSetTextColor __ColorGray;
__JavelinIGUINFOV ctrlSetTextColor __ColorGray;
__JavelinIGUITargetingConstrains ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false;
ACE_player setVariable ["ace_missileguidance_target",nil, false];
};
};
//TRACE_2("", _newTarget, _currentTarget);
// Save arguments for next run
_args set[0, diag_tickTime];
_args set[1, _currentTarget];
_args set[2, _runTime];
_args set[3, _lockTime];
_args set[4, _soundTime];
uiNamespace setVariable[QGVAR(arguments), _args ];

View File

@ -11,6 +11,11 @@ ACE_player setVariable ["ace_missileguidance_target",nil, false];
__JavelinIGUISeek ctrlSetTextColor __ColorGray; __JavelinIGUISeek ctrlSetTextColor __ColorGray;
__JavelinIGUINFOV ctrlSetTextColor __ColorGray; __JavelinIGUINFOV ctrlSetTextColor __ColorGray;
__JavelinIGUITargeting ctrlShow false;
__JavelinIGUITargetingConstrains ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false;
uiNameSpace setVariable [QGVAR(arguments), uiNameSpace setVariable [QGVAR(arguments),
[ [
0, // Last runtime 0, // Last runtime

View File

@ -0,0 +1 @@
#include "\z\ace\addons\javelin\script_component.hpp"

View File

@ -1,6 +1,6 @@
// by commy2 // 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}; if (GETGVAR(isLockKeyDown,false)) exitWith {false};
@ -21,7 +21,7 @@
}, },
[15, [false, false, false]], false] call cba_fnc_addKeybind; //Tab Key [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 }, { false },
{ {
[ACE_player] call FUNC(cycleFireMode); [ACE_player] call FUNC(cycleFireMode);

View File

@ -1,12 +1,12 @@
#define COMPONENT wep_javelin #define COMPONENT javelin
#include "\z\ace\Addons\main\script_mod.hpp" #include "\z\ace\Addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_WEP_JAVELIN #ifdef DEBUG_ENABLED_JAVELIN
#define DEBUG_MODE_FULL #define DEBUG_MODE_FULL
#endif #endif
#ifdef DEBUG_SETTINGS_WEP_JAVELIN #ifdef DEBUG_SETTINGS_JAVELIN
#define DEBUG_SETTINGS DEBUG_SETTINGS_WEP_JAVELIN #define DEBUG_SETTINGS DEBUG_SETTINGS_JAVELIN
#endif #endif
#include "\z\ace\Addons\main\script_macros.hpp" #include "\z\ace\Addons\main\script_macros.hpp"
@ -19,6 +19,8 @@
#define __JavelinIGUI (uinamespace getVariable "ACE_RscOptics_javelin") #define __JavelinIGUI (uinamespace getVariable "ACE_RscOptics_javelin")
// Custom controls // Custom controls
#define __JavelinIGUITargeting (__JavelinIGUI displayCtrl 6999)
#define __JavelinIGUISeek (__JavelinIGUI displayCtrl 699000) #define __JavelinIGUISeek (__JavelinIGUI displayCtrl 699000)
#define __JavelinIGUITop (__JavelinIGUI displayCtrl 699001) #define __JavelinIGUITop (__JavelinIGUI displayCtrl 699001)
#define __JavelinIGUIDir (__JavelinIGUI displayCtrl 699002) #define __JavelinIGUIDir (__JavelinIGUI displayCtrl 699002)
@ -51,10 +53,6 @@
#define __ConstraintLeft (((ctrlPosition __JavelinIGUITargetingConstrainLeft) select 0) + ((ctrlPosition (__JavelinIGUITargetingConstrainLeft)) select 2)) #define __ConstraintLeft (((ctrlPosition __JavelinIGUITargetingConstrainLeft) select 0) + ((ctrlPosition (__JavelinIGUITargetingConstrainLeft)) select 2))
#define __ConstraintRight ((ctrlPosition __JavelinIGUITargetingConstrainRight) select 0) #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 // Colors for controls
#define __ColorOrange [0.9255,0.5216,0.1216,1] #define __ColorOrange [0.9255,0.5216,0.1216,1]
#define __ColorGreen [0.2941,0.8745,0.2157,1] #define __ColorGreen [0.2941,0.8745,0.2157,1]

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2014-12-19 -->
<Project name="ACE">
<Package name="JAVELIN">
<Key ID="STR_ACE_JAVELIN_LockTarget">
<English>Lock Target (Javelin)</English>
<German></German>
<French></French>
<Polish></Polish>
<Czech></Czech>
<Spanish></Spanish>
<Russian></Russian>
</Key>
<Key ID="STR_ACE_JAVELIN_CycleFireMode">
<English>Cycle Attack Mode (Javelin)</English>
<German></German>
<French></French>
<Polish></Polish>
<Czech></Czech>
<Spanish></Spanish>
<Russian></Russian>
</Key>
</Package>
</Project>

View File

@ -1 +0,0 @@
z\ace\addons\wep_javelin

View File

@ -1,125 +0,0 @@
//#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 __LOCKONTIMERANDOM 0.3 // Deviation in lock on time
#define __SENSORSQUARE 1 // Locking on sensor square side in angles
private["_args", "_lastTick", "_runTime", "_soundTime", "_lockTime", "_newTarget", "_currentTarget", "_range", "_pos", "_targetArray"];
// Reset arguments if we havnt rendered in over a second
_args = uiNamespace getVariable[QGVAR(arguments), [] ];
if( (count _args) > 0) then {
_lastTick = _args select 0;
if(diag_tickTime - _lastTick > 1) then {
[] call FUNC(onOpticLoad);
};
};
// Pull the arguments
_currentTarget = _args select 1;
_runTime = _args select 2;
_lockTime = _args select 3;
_soundTime = _args select 4;
// Find a target within the optic range
_newTarget = objNull;
// Bail on fast movement
if ((velocity ACE_player) distance [0,0,0] > 0.5 && {cameraView == "GUNNER"} && {cameraOn == ACE_player}) exitWith { // keep it steady.
ACE_player switchCamera "INTERNAL";
};
// Refresh the firemode
[] call FUNC(showFireMode);
// Only start locking on holding tab
if(!GVAR(isLockKeyDown)) exitWith { false };
_range = parseNumber (ctrlText __JavelinIGUIRangefinder);
if (_range > 50 && {_range < 2500}) then {
_pos = positionCameraToWorld [0,0,_range];
_targetArray = _pos nearEntities ["AllVehicles", _range/25];
if (count (_targetArray) > 0) then {
_newTarget = _targetArray select 0;
};
};
if (isNull _newTarget) then {
_newTarget = cursorTarget;
};
if (isNull _newTarget) then {
// No targets found
_currentTarget = objNull;
_lockTime = 0;
__JavelinIGUISeek ctrlSetTextColor __ColorGray;
__JavelinIGUINFOV ctrlSetTextColor __ColorGreen;
__JavelinIGUITargetingConstrains ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false;
ACE_player setVariable ["ace_missileguidance_target",nil, false];
// Disallow fire
//if (ACE_player ammo "Javelin" > 0 || {ACE_player ammo "ACE_Javelin_Direct" > 0}) then {ACE_player setWeaponReloadingTime //[player, "Javelin", 0.2];};
} else {
if (_newTarget distance ACE_player < 2500
// && {(call CBA_fnc_getFoV) select 1 > 7}
// && { (currentVisionMode ACE_player == 2)}
) then {
// Lock on after 3 seconds
if(_currentTarget != _newTarget) then {
TRACE_1("New Target, reseting locking", _newTarget);
_lockTime = diag_tickTime;
_currentTarget = _newTarget;
playSound "ACE_Javelin_Locking";
} else {
if(diag_tickTime - _lockTime > 3) then {
TRACE_2("LOCKED!", _currentTarget, _lockTime);
__JavelinIGUISeek ctrlSetTextColor __ColorGreen;
__JavelinIGUINFOV ctrlSetTextColor __ColorNull;
__JavelinIGUITargetingConstrains ctrlShow true;
ACE_player setVariable["ace_missileguidance_target", _currentTarget, false];
if(diag_tickTime > _soundTime) then {
playSound "ACE_Javelin_Locked";
_soundTime = diag_tickTime + 0.25;
};
} else {
if(diag_tickTime > _soundTime) then {
playSound "ACE_Javelin_Locking";
_soundTime = diag_tickTime + 0.25;
};
};
};
} else {
// Something is wrong with our seek
_currentTarget = objNull;
__JavelinIGUISeek ctrlSetTextColor __ColorGray;
__JavelinIGUINFOV ctrlSetTextColor __ColorGray;
__JavelinIGUITargetingConstrains ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false;
ACE_player setVariable ["ace_missileguidance_target",nil, false];
};
};
//TRACE_2("", _newTarget, _currentTarget);
// Save arguments for next run
_args set[0, diag_tickTime];
_args set[1, _currentTarget];
_args set[2, _runTime];
_args set[3, _lockTime];
_args set[4, _soundTime];
uiNamespace setVariable[QGVAR(arguments), _args ];

View File

@ -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;

View File

@ -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;

View File

@ -1 +0,0 @@
#include "\z\ace\addons\wep_javelin\script_component.hpp"

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2014-12-19 -->
<Project name="ACE">
<Package name="WEP_JAVELIN">
<Key ID="STR_ACE_WEP_JAVELIN_LockTarget">
<English>Lock Target (Hold)</English>
<German>Lock Target (Hold)</German>
<French>Lock Target (Hold)</French>
<Polish>Lock Target (Hold)</Polish>
<Czech>Lock Target (Hold)</Czech>
<Spanish>Fijar objetivo (Mantener)</Spanish>
<Russian>Lock Target (Hold)</Russian>
</Key>
<Key ID="STR_ACE_WEP_JAVELIN_CycleFireMode">
<English>Cycle Fire Mode</English>
<German>Cycle Fire Mode</German>
<French>Cycle Fire Mode</French>
<Polish>Cycle Fire Mode</Polish>
<Czech>Cycle Fire Mode</Czech>
<Spanish>Cambiar modo de fuego</Spanish>
<Russian>Cycle Fire Mode</Russian>
</Key>
</Package>
</Project>