From eb6fdc2e34c15f31b0cbc213efa663f055373932 Mon Sep 17 00:00:00 2001 From: jaynus Date: Mon, 6 Apr 2015 19:03:11 -0700 Subject: [PATCH 01/76] cleaner LOAL DAGR --- .../functions/fnc_guidance_DAGR.sqf | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/addons/missileguidance/functions/fnc_guidance_DAGR.sqf b/addons/missileguidance/functions/fnc_guidance_DAGR.sqf index 9055b00a7f..020c676b57 100644 --- a/addons/missileguidance/functions/fnc_guidance_DAGR.sqf +++ b/addons/missileguidance/functions/fnc_guidance_DAGR.sqf @@ -44,29 +44,26 @@ FUNC(guidance_DIRECT_LOAL_PFH) = { _targetPos = _targetPos vectorAdd _addHeight; - _def = 0.0040; - if(_distanceToShooter > 100) then { - _def = 0.0025; - }; + _deflection = 0.015; _targetVectorSeeker = [_dagr, [_xVec, _yVec, _zVec], _targetPos] call FUNC(translateToWeaponSpace); // _targetVectorSeeker = _dagr worldToModel (ASLtoATL _targetPos); // _targetVectorSeeker = [0,0,0] vectorFromTo _targetVectorSeeker; _yaw = 0.0; if((_targetVectorSeeker select 0) < 0) then { - _yaw = -_def; + _yaw = -_deflection; } else { if((_targetVectorSeeker select 0) > 0) then { - _yaw = _def; + _yaw = _deflection; }; }; _pitch = 0.0; if((_targetVectorSeeker select 2) < 0) then { - _pitch = -_def; + _pitch = -_deflection; } else { if((_targetVectorSeeker select 2) > 0) then { - _pitch = _def; + _pitch = _deflection; }; }; #ifdef DEBUG_MODE_FULL @@ -104,7 +101,7 @@ FUNC(guidance_DAGR_DIRECT_LOAL) = { PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); GVAR(lastTime) = time; - [FUNC(guidance_DIRECT_LOAL_PFH), 0, _this] call cba_fnc_addPerFrameHandler; + [FUNC(guidance_DIRECT_LOAL_PFH), 0.1, _this] call cba_fnc_addPerFrameHandler; }; PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); From 2d019abede487a22f447e075a8984b71de8022e4 Mon Sep 17 00:00:00 2001 From: jaynus Date: Mon, 6 Apr 2015 22:38:34 -0700 Subject: [PATCH 02/76] WIP Guidance rewrites. --- addons/missileguidance/CfgAmmo.hpp | 1 + .../missileguidance/functions/fnc_fired.sqf | 4 +- .../functions/fnc_guidance_DAGR.sqf | 58 ++--- .../functions/fnc_guidance_HellfireII.sqf | 217 +----------------- 4 files changed, 29 insertions(+), 251 deletions(-) diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index df876ae2ae..87463b3f8f 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -6,5 +6,6 @@ class CfgAmmo { laserLock = 0; airLock = 0; manualControl = 0; + timeToLive = 120; }; }; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_fired.sqf b/addons/missileguidance/functions/fnc_fired.sqf index dbe6abfec7..cec6ec9ce9 100644 --- a/addons/missileguidance/functions/fnc_fired.sqf +++ b/addons/missileguidance/functions/fnc_fired.sqf @@ -6,13 +6,15 @@ PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); if(!local _shooter) exitWith { false }; + switch _weapon do { case "missiles_DAGR": { _this call FUNC(guidance_DAGR); + //_this call FUNC(guidance_HellfireII); }; case "GBU12BombLauncher": { _this call FUNC(guidance_LGB); }; }; -//_this call FUNC(guidance_HellfireII); + diff --git a/addons/missileguidance/functions/fnc_guidance_DAGR.sqf b/addons/missileguidance/functions/fnc_guidance_DAGR.sqf index 020c676b57..ff245972d4 100644 --- a/addons/missileguidance/functions/fnc_guidance_DAGR.sqf +++ b/addons/missileguidance/functions/fnc_guidance_DAGR.sqf @@ -1,4 +1,4 @@ -//#define DEBUG_MODE_FULL +#define DEBUG_MODE_FULL #include "script_component.hpp" FUNC(guidance_DIRECT_LOAL_PFH) = { @@ -15,21 +15,15 @@ FUNC(guidance_DIRECT_LOAL_PFH) = { }; _targets = [_dagr, ACE_DEFAULT_LASER_CODE, 70, _curVelocity] call ace_laser_fnc_findLaserDesignator; - TRACE_2("Targets", _target, _targets); - if((_targets select 0)) then { _target = _targets select 1; - - // player sideChat "FUCK!"; - // drop ["\a3\data_f\Cl_basic","","Billboard",1,20,(getPos _dagr),[0,0,0],1,1.275,1.0,0.0,[5],[[1,0,0,1]],[0],0.0,2.0,"","",""]; - - + TRACE_2("Targets", _target, _targets); + _yVec = vectorDir _dagr; _zVec = vectorUp _dagr; _xVec = vectorNormalized (_yVec vectorCrossProduct _zVec); _dagrPos = getPosASL _dagr; - // player sideChat "G!"; _targetPos = getPosASL _target; _shooterPos = getPosASL _shooter; @@ -44,49 +38,41 @@ FUNC(guidance_DIRECT_LOAL_PFH) = { _targetPos = _targetPos vectorAdd _addHeight; - _deflection = 0.015; + _minDeflection = 0.005; + _maxDeflection = 0.15; _targetVectorSeeker = [_dagr, [_xVec, _yVec, _zVec], _targetPos] call FUNC(translateToWeaponSpace); - // _targetVectorSeeker = _dagr worldToModel (ASLtoATL _targetPos); - // _targetVectorSeeker = [0,0,0] vectorFromTo _targetVectorSeeker; - _yaw = 0.0; + _targetVector = [0,0,0] vectorFromTo _targetVectorSeeker; + TRACE_1("", _targetVectorSeeker, _targetVector); + + _yaw = 0; + _pitch = 0; + if((_targetVectorSeeker select 0) < 0) then { - _yaw = -_deflection; + _yaw = - ( (_minDeflection max ((_targetVector select 0) min _maxDeflection) ) ); } else { if((_targetVectorSeeker select 0) > 0) then { - _yaw = _deflection; + _yaw = ( (_minDeflection max ((_targetVector select 0) min _maxDeflection) ) ); + }; + }; + if((_targetVectorSeeker select 2) < 0) then { + _pitch = - ( (_minDeflection max ((_targetVector select 2) min _maxDeflection) ) ); + } else { + if((_targetVectorSeeker select 2) > 0) then { + _pitch = ( (_minDeflection max ((_targetVector select 2) min _maxDeflection) ) ); }; }; - _pitch = 0.0; - if((_targetVectorSeeker select 2) < 0) then { - _pitch = -_deflection; - } else { - if((_targetVectorSeeker select 2) > 0) then { - _pitch = _deflection; - }; - }; + #ifdef DEBUG_MODE_FULL drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,1,1,1], ASLtoATL _dagrPos, 0.75, 0.75, 0, str _vectorTo, 1, 0.025, "TahomaB"]; drawLine3D [ASLtoATL _dagrPos, ASLtoATL _targetPos, [1,0,0,1]]; - - _distance = ([getPos startPos, _dagrPos] call BIS_fnc_distance2D); - _marker = createMarkerLocal [format["m%1", MARKERCOUNT], [_distance, _dagrPos select 2]]; - _marker setMarkerTypeLocal "mil_dot"; - _marker setMarkerColorLocal "ColorRed"; - - MARKERCOUNT = MARKERCOUNT + 1; #endif - + if(accTime > 0) then { _outVector = [_dagr, [_xVec, _yVec, _zVec], [_yaw, 1/accTime, _pitch]] call FUNC(translateToModelSpace); - // _outVector = _dagr modelToWorldVisual [_yaw, 1, _pitch]; - // _outVector = ATLtoASL _outVector; _vectorTo = _dagrPos vectorFromTo _outVector; - // hintSilent format["v: %1", _vectorTo]; - - // _dagr setVectorDir _vectorTo; _dagr setVectorDirAndUp [_vectorTo, vectorUp _dagr]; }; diff --git a/addons/missileguidance/functions/fnc_guidance_HellfireII.sqf b/addons/missileguidance/functions/fnc_guidance_HellfireII.sqf index 72b8da8c67..a89a8d66d7 100644 --- a/addons/missileguidance/functions/fnc_guidance_HellfireII.sqf +++ b/addons/missileguidance/functions/fnc_guidance_HellfireII.sqf @@ -1,223 +1,12 @@ -//#define DEBUG_MODE_FULL +#define DEBUG_MODE_FULL #include "script_component.hpp" FUNC(guidance_Hellfire_LOAL_HI_PFH) = { - //TRACE_1("enter", _this); - _args = _this select 0; - //PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); - _shooter = _args select 0; - _missile = _args select 6; - _curVelocity = velocity _missile; - - if(!alive _missile || isNull _missile || isNull _shooter) exitWith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; - }; - - _launchPos = _shooter getVariable [QGVAR(launchPos), nil]; - if(isNil "_launchPos") then { - TRACE_1("Setting launch parameters", ""); - _launchPos = getPosASL _shooter; - _shooter setVariable [QGVAR(launchPos), _launchPos, false]; - _shooter setVariable [QGVAR(launchTime), diag_tickTime, false]; - }; - - _targets = [_missile, ACE_DEFAULT_LASER_CODE, 70, _curVelocity] call ace_laser_fnc_findLaserDesignator; - _addHeight = [0,0,0]; - if((_targets select 0)) then { - _target = _targets select 1; - TRACE_2("Targets", _target, _targets); - - _yVec = vectorDir _missile; - _zVec = vectorUp _missile; - _xVec = vectorNormalized (_yVec vectorCrossProduct _zVec); - - _missilePos = getPosASL _missile; - // player sideChat "G!"; - _targetPos = getPosASL _target; - TRACE_4("Phase Check", _launchPos, _missilePos, _targetPos, (_missilePos distance _targetPos)); - if((count _targetPos) > 0) then { - _distanceToTarget = _missilePos vectorDistance _targetPos; - - _defPitch = 0.05; - - if((_launchPos distance _missilePos) < 400 && (_targetPos distance _missilePos) > 400) then { - _addHeight = [0,0,(_targetPos select 2) + ((_launchPos distance _targetPos)*2)]; - TRACE_1("Climb phase", _addHeight); - //_defPitch = 0.1; - } else { - // Covered half the distance, go terminal - if((_missilePos distance _targetPos) < (_launchPos distance _targetPos) / 2) then { - TRACE_1("TERMINAL", ""); - } else { - if((_missilePos select 2) > (_targetPos select 2)) then { - _heightDiff = (_missilePos select 2) - (_targetPos select 2); - TRACE_1("Coasting", _heightDiff); - _addHeight = [0,0, _heightDiff]; - }; - }; - }; - _targetPos = _targetPos vectorAdd _addHeight; - - _defYaw = 0.0035; - - - _targetVectorSeeker = [_missile, [_xVec, _yVec, _zVec], _targetPos] call FUNC(translateToWeaponSpace); - _yaw = 0.0; - if((_targetVectorSeeker select 0) < 0) then { - _yaw = -_defYaw; - } else { - if((_targetVectorSeeker select 0) > 0) then { - _yaw = _defYaw; - }; - }; - - _pitch = 0.0; - if((_targetVectorSeeker select 2) < 0) then { - _pitch = -_defPitch; - } else { - if((_targetVectorSeeker select 2) > 0) then { - _pitch = _defPitch; - }; - }; - #ifdef DEBUG_MODE_FULL - drawLine3D [(ASLtoATL _targetPos) vectorAdd _addHeight, ASLtoATL _targetPos, [0,1,0,1]]; - - _light = "#lightpoint" createVehicleLocal (getPos _missile); - _light setLightBrightness 1.0; - _light setLightAmbient [1.0, 0.0, 0.0]; - _light setLightColor [1.0, 0.0, 0.0]; - - drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,1,1,1], ASLtoATL _missilePos, 0.75, 0.75, 0, str _vectorTo, 1, 0.025, "TahomaB"]; - drawLine3D [ASLtoATL _missilePos, ASLtoATL _targetPos, [1,0,0,1]]; - - _distance = ([getPos startPos, _missilePos] call BIS_fnc_distance2D); - _marker = createMarkerLocal [format["m%1", MARKERCOUNT], [_distance, _missilePos select 2]]; - _marker setMarkerTypeLocal "mil_dot"; - _marker setMarkerColorLocal "ColorRed"; - - MARKERCOUNT = MARKERCOUNT + 1; - #endif - - if(accTime > 0) then { - _outVector = [_missile, [_xVec, _yVec, _zVec], [_yaw, 1/accTime, _pitch]] call FUNC(translateToModelSpace); - - _vectorTo = _missilePos vectorFromTo _outVector; - _missile setVectorDirAndUp [_vectorTo, vectorUp _missile]; - }; - - #ifdef DEBUG_MODE_FULL - hintSilent format["d: %1", _distanceToTarget]; - #endif - }; - }; + }; FUNC(guidance_Hellfire_LOAL_DIR_PFH) = { - //TRACE_1("enter", _this); - _args = _this select 0; - //PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); - _shooter = _args select 0; - _missile = _args select 6; - _curVelocity = velocity _missile; - - if(!alive _missile || isNull _missile || isNull _shooter) exitWith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; - }; - - _launchPos = _shooter getVariable [QGVAR(launchPos), nil]; - if(isNil "_launchPos") then { - TRACE_1("Setting launch parameters", ""); - _launchPos = getPosASL _shooter; - _shooter setVariable [QGVAR(launchPos), _launchPos, false]; - _shooter setVariable [QGVAR(launchTime), diag_tickTime, false]; - }; - - _targets = [_missile, ACE_DEFAULT_LASER_CODE, 70, _curVelocity] call ace__laser_fnc_findLaserDesignator; - _addHeight = [0,0,0]; - if((_targets select 0)) then { - _target = _targets select 1; - TRACE_2("Targets", _target, _targets); - - _yVec = vectorDir _missile; - _zVec = vectorUp _missile; - _xVec = vectorNormalized (_yVec vectorCrossProduct _zVec); - - _missilePos = getPosASL _missile; - // player sideChat "G!"; - _targetPos = getPosASL _target; - TRACE_4("Phase Check", _launchPos, _missilePos, _targetPos, (_missilePos distance _targetPos)); - if((count _targetPos) > 0) then { - _distanceToTarget = _missilePos vectorDistance _targetPos; - - if((_launchPos distance _missilePos) < 400 && (_targetPos distance _missilePos) > 400) then { - _addHeight = [0,0,(_targetPos select 2) + (_missilePos distance _targetPos)*0.5]; - TRACE_1("Climb phase", _addHeight); - } else { - // Covered half the distance, go terminal - if((_missilePos distance _targetPos) < (_launchPos distance _targetPos) / 2) then { - TRACE_1("TERMINAL", ""); - } else { - if((_missilePos select 2) > (_targetPos select 2)) then { - _heightDiff = (_missilePos select 2) - (_targetPos select 2); - TRACE_1("Coasting", _heightDiff); - _addHeight = [0,0, _heightDiff]; - }; - }; - }; - _targetPos = _targetPos vectorAdd _addHeight; - - _defYaw = 0.0035; - _defPitch = 0.0075; - - _targetVectorSeeker = [_missile, [_xVec, _yVec, _zVec], _targetPos] call FUNC(translateToWeaponSpace); - _yaw = 0.0; - if((_targetVectorSeeker select 0) < 0) then { - _yaw = -_defYaw; - } else { - if((_targetVectorSeeker select 0) > 0) then { - _yaw = _defYaw; - }; - }; - - _pitch = 0.0; - if((_targetVectorSeeker select 2) < 0) then { - _pitch = -_defPitch; - } else { - if((_targetVectorSeeker select 2) > 0) then { - _pitch = _defPitch; - }; - }; - #ifdef DEBUG_MODE_FULL - drawLine3D [(ASLtoATL _targetPos) vectorAdd _addHeight, ASLtoATL _targetPos, [0,1,0,1]]; - - _light = "#lightpoint" createVehicleLocal (getPos _missile); - _light setLightBrightness 1.0; - _light setLightAmbient [1.0, 0.0, 0.0]; - _light setLightColor [1.0, 0.0, 0.0]; - - drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,1,1,1], ASLtoATL _missilePos, 0.75, 0.75, 0, str _vectorTo, 1, 0.025, "TahomaB"]; - drawLine3D [ASLtoATL _missilePos, ASLtoATL _targetPos, [1,0,0,1]]; - - _distance = ([getPos startPos, _missilePos] call BIS_fnc_distance2D); - _marker = createMarkerLocal [format["m%1", MARKERCOUNT], [_distance, _missilePos select 2]]; - _marker setMarkerTypeLocal "mil_dot"; - _marker setMarkerColorLocal "ColorRed"; - MARKERCOUNT = MARKERCOUNT + 1; - #endif - - if(accTime > 0) then { - _outVector = [_missile, [_xVec, _yVec, _zVec], [_yaw, 1/accTime, _pitch]] call FUNC(translateToModelSpace); - - _vectorTo = _missilePos vectorFromTo _outVector; - _missile setVectorDirAndUp [_vectorTo, vectorUp _missile]; - }; - - #ifdef DEBUG_MODE_FULL - hintSilent format["d: %1", _distanceToTarget]; - #endif - }; - }; }; @@ -244,6 +33,6 @@ switch (_fireMode select 0) do { // FIREMODE_DIRECT_LOAL default { LOG("Initiating Hellfire II FIREMODE_LOAL_DIR"); - _this call FUNC(guidance_Hellfire_LOAL_HI); + _this call FUNC(guidance_Hellfire_LOAL_DIR); }; }; \ No newline at end of file From 9aa84322c7a307707b02b43fa354a0de7352eba1 Mon Sep 17 00:00:00 2001 From: jaynus Date: Mon, 6 Apr 2015 23:15:26 -0700 Subject: [PATCH 03/76] Magazine, Ammo and Missile breakout. --- addons/aircraft/config.cpp | 2 +- addons/missileguidance/CfgAmmo.hpp | 14 ++++- addons/missileguidance/CfgMagazines.hpp | 53 +++++++++++++++++++ addons/missileguidance/CfgVehicles.hpp | 23 ++++++++ addons/missileguidance/CfgWeapons.hpp | 25 +-------- addons/missileguidance/config.cpp | 4 +- .../missileguidance/functions/fnc_fired.sqf | 11 ++-- 7 files changed, 103 insertions(+), 29 deletions(-) create mode 100644 addons/missileguidance/CfgMagazines.hpp create mode 100644 addons/missileguidance/CfgVehicles.hpp diff --git a/addons/aircraft/config.cpp b/addons/aircraft/config.cpp index 2ce2d0dc10..2dc390f915 100644 --- a/addons/aircraft/config.cpp +++ b/addons/aircraft/config.cpp @@ -2,7 +2,7 @@ class CfgPatches { class ADDON { - units[] = {}; + units[] = {"ACE_Comanche_Test"}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index 87463b3f8f..49ed1a0b37 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -1,6 +1,6 @@ class CfgAmmo { class MissileBase; - + class M_PG_AT : MissileBase { irLock = 0; laserLock = 0; @@ -8,4 +8,16 @@ class CfgAmmo { manualControl = 0; timeToLive = 120; }; + + class ACE_Hydra70_DAGR : M_PG_AT { + displayName = "ACE Hydra-70 DAGR Missile"; + displayNameShort = "$STR_A3_CfgMagazines_24Rnd_PG_missiles_dns"; + descriptionShort = "$STR_A3_CfgMagazines_24Rnd_PG_missiles1"; + }; + + class ACE_Hellfire_AGM114K : ACE_Hydra70_DAGR { + displayName = "$STR_A3_CfgMagazines_24Rnd_PG_missiles0"; + displayNameShort = "$STR_A3_CfgMagazines_24Rnd_PG_missiles_dns"; + descriptionShort = "$STR_A3_CfgMagazines_24Rnd_PG_missiles1"; + }; }; \ No newline at end of file diff --git a/addons/missileguidance/CfgMagazines.hpp b/addons/missileguidance/CfgMagazines.hpp new file mode 100644 index 0000000000..31f4739417 --- /dev/null +++ b/addons/missileguidance/CfgMagazines.hpp @@ -0,0 +1,53 @@ +class CfgMagazines { + class 12Rnd_PG_missiles; + + class 6Rnd_ACE_Hydra70_DAGR : 12Rnd_PG_missiles { + ammo = "ACE_Hydra70_DAGR"; + count = 12; + displayName = "6 Round DAGR"; + displayNameShort = "6 Round DAGR"; + descriptionShort = "6 Round DAGR"; + weight = 36; + + }; + class 12Rnd_ACE_Hydra70_DAGR : 6Rnd_ACE_Hydra70_DAGR { + count = 12; + displayName = "16 Round DAGR"; + displayNameShort = "16 Round DAGR"; + descriptionShort = "16 Round DAGR"; + weight = 72; + }; + class 24Rnd_ACE_Hydra70_DAGR : 6Rnd_ACE_Hydra70_DAGR { + count = 24; + displayName = "24 Round DAGR"; + displayNameShort = "24 Round DAGR"; + descriptionShort = "24 Round DAGR"; + weight = 72; + }; + + // Hellfires + class 6Rnd_ACE_Hellfire_AGM114K : 12Rnd_PG_missiles { + count = 12; + ammo = "ACE_Hellfire_AGM114K"; + displayName = "6Rnd_ACE_Hellfire_AGM114K"; + displayNameShort = "6Rnd_ACE_Hellfire_AGM114K"; + descriptionShort = "6Rnd_ACE_Hellfire_AGM114K"; + weight = 36; + + }; + class 12Rnd_ACE_Hellfire_AGM114K : 6Rnd_ACE_Hydra70_DAGR { + count = 12; + displayName = "12Rnd_ACE_Hellfire_AGM114K"; + displayNameShort = "12Rnd_ACE_Hellfire_AGM114K"; + descriptionShort = "12Rnd_ACE_Hellfire_AGM114K"; + weight = 72; + }; + class 24Rnd_ACE_Hellfire_AGM114K : 6Rnd_ACE_Hydra70_DAGR { + count = 24; + displayName = "24Rnd_ACE_Hellfire_AGM114K"; + displayNameShort = "24Rnd_ACE_Hellfire_AGM114K"; + descriptionShort = "24Rnd_ACE_Hellfire_AGM114K"; + weight = 72; + }; + +}; \ No newline at end of file diff --git a/addons/missileguidance/CfgVehicles.hpp b/addons/missileguidance/CfgVehicles.hpp new file mode 100644 index 0000000000..f166a5bc4a --- /dev/null +++ b/addons/missileguidance/CfgVehicles.hpp @@ -0,0 +1,23 @@ +class CfgVehicles { + class Heli_Attack_01_base_F; + + class B_Heli_Attack_01_F : Heli_Attack_01_base_F { + class Turrets { + class MainTurret; + }; + } + + class ACE_Comanche_Test : B_Heli_Attack_01_F { + displayName = "ACE_Comanche_Test"; + author = "ACE Team"; + class Library + { + libTextDesc = "ACE_Comanche_Test"; + }; + class Turrets: Turrets { + class MainTurret: MainTurret { + magazines[] = {"ACE_500Rnd_20mm_shells_Comanche", "24Rnd_ACE_Hellfire_AGM114K"}; + }; + }; + }; +}; \ No newline at end of file diff --git a/addons/missileguidance/CfgWeapons.hpp b/addons/missileguidance/CfgWeapons.hpp index 739ef3c5e0..353fa1fc7a 100644 --- a/addons/missileguidance/CfgWeapons.hpp +++ b/addons/missileguidance/CfgWeapons.hpp @@ -6,29 +6,8 @@ class CfgWeapons { class RocketPods: LauncherCore { canLock = 1; }; - class missiles_DAGR: RocketPods { + class missiles_DAGR : RocketPods { canLock = 1; + magazines[] = {"24Rnd_ACE_Hydra70_DAGR", "12Rnd_ACE_Hydra70_DAGR", "6Rnd_ACE_Hydra70_DAGR", "24Rnd_ACE_Hellfire_AGM114K", "12Rnd_ACE_Hellfire_AGM114K", "6Rnd_ACE_Hellfire_AGM114K" }; }; - /* - class autocannon_Base_F: CannonCore { - canLock = 1; - }; - class cannon_120mm: CannonCore { - canLock = 1; - - class player : Mode_SemiAuto { - canLock = 1; - }; - }; - class gatling_25mm: CannonCore { - canLock = 1; - }; - class autocannon_35mm: CannonCore { - canLock = 1; - }; - - class launch_NLAW_F: Launcher_Base_F - { - canLock = 1; - };*/ }; \ No newline at end of file diff --git a/addons/missileguidance/config.cpp b/addons/missileguidance/config.cpp index 9c5842a065..d8cbba7db3 100644 --- a/addons/missileguidance/config.cpp +++ b/addons/missileguidance/config.cpp @@ -12,4 +12,6 @@ class CfgPatches { #include "CfgEventhandlers.hpp" #include "CfgAmmo.hpp" -#include "CfgWeapons.hpp" \ No newline at end of file +#include "CfgMagazines.hpp" +#include "CfgWeapons.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/missileguidance/functions/fnc_fired.sqf b/addons/missileguidance/functions/fnc_fired.sqf index cec6ec9ce9..0baec8e0eb 100644 --- a/addons/missileguidance/functions/fnc_fired.sqf +++ b/addons/missileguidance/functions/fnc_fired.sqf @@ -7,10 +7,15 @@ PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); if(!local _shooter) exitWith { false }; -switch _weapon do { - case "missiles_DAGR": { +switch _ammo do { + case "M_PG_AT": { // Vanilla DAGR missile _this call FUNC(guidance_DAGR); - //_this call FUNC(guidance_HellfireII); + }; + case "ACE_Hydra70_DAGR": { // ACE DAGR + _this call FUNC(guidance_DAGR); + }; + case "ACE_Hellfire_AGM114K": { // ACE Hellfire AGM-114K + _this call FUNC(guidance_HellfireII); }; case "GBU12BombLauncher": { _this call FUNC(guidance_LGB); From f9735057461c78b5a99cd43b3d93a6aeb9e0761f Mon Sep 17 00:00:00 2001 From: jaynus Date: Tue, 7 Apr 2015 08:53:47 -0700 Subject: [PATCH 04/76] DAGR and Hellfire modified config values. --- addons/missileguidance/CfgAmmo.hpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index 49ed1a0b37..ff8da2b55e 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -7,17 +7,33 @@ class CfgAmmo { airLock = 0; manualControl = 0; timeToLive = 120; + + hit = 150; + indirectHit = 40; + indirectHitRange = 2.5; + explosive = 0.1; // KE penetrators + inittime = 0.05; + thrust = 1900; + thrusttime = 1; + maxspeed = 1030; + maneuvrability = 8; + sideairfriction = 0.065; }; class ACE_Hydra70_DAGR : M_PG_AT { - displayName = "ACE Hydra-70 DAGR Missile"; - displayNameShort = "$STR_A3_CfgMagazines_24Rnd_PG_missiles_dns"; - descriptionShort = "$STR_A3_CfgMagazines_24Rnd_PG_missiles1"; + displayName = "ACE_Hydra70_DAGR"; + displayNameShort = "ACE_Hydra70_DAGR"; + descriptionShort = "ACE_Hydra70_DAGR"; }; class ACE_Hellfire_AGM114K : ACE_Hydra70_DAGR { - displayName = "$STR_A3_CfgMagazines_24Rnd_PG_missiles0"; - displayNameShort = "$STR_A3_CfgMagazines_24Rnd_PG_missiles_dns"; - descriptionShort = "$STR_A3_CfgMagazines_24Rnd_PG_missiles1"; + displayName = "ACE_Hellfire_AGM114K"; + displayNameShort = "ACE_Hellfire_AGM114K"; + descriptionShort = "ACE_Hellfire_AGM114K"; + + hit = 1400; + indirectHit = 71; + indirectHitRange = 4.5; + effectsMissile = "missile2"; }; }; \ No newline at end of file From 6deff125ce807a8f4255cd795654e7b00f65c582 Mon Sep 17 00:00:00 2001 From: jaynus Date: Tue, 7 Apr 2015 09:05:19 -0700 Subject: [PATCH 05/76] Self designation lockdown and cleanup --- .../functions/fnc_laserHudDesignateOff.sqf | 7 +++++++ .../functions/fnc_laserHudDesignateOn.sqf | 19 +++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf index 2f4c437d28..af13f96431 100644 --- a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf +++ b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf @@ -1,5 +1,10 @@ #include "script_component.hpp" +if( (count _this) > 2) then { + EXPLODE_3_PVT((_this select 0),_vehicle,_shooter,_laserTarget); + _vehicle setVariable[QGVAR(currentTarget), [], true]; +}; + if(isNil QGVAR(laser)) exitWith { false }; @@ -17,4 +22,6 @@ deleteVehicle GVAR(laser); GVAR(laser) = nil; GVAR(laserActive) = false; + + true \ No newline at end of file diff --git a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf index f0fdc8458f..14eb9e077e 100644 --- a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf +++ b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf @@ -35,10 +35,10 @@ FUNC(laserHudDesignatePFH) = { TRACE_1("", _args); if(!alive _shooter || isNull _vehicle || isNull _laserTarget || !GVAR(laserActive) ) exitWith { - [] call FUNC(laserHudDesignateOff); + [_vehicle, _shooter, _laserTarget] call FUNC(laserHudDesignateOff); }; if(!([ACE_player] call FUNC(unitTurretHasDesignator)) ) exitWith { - [] call FUNC(laserHudDesignateOff); + [_vehicle, _shooter, _laserTarget] call FUNC(laserHudDesignateOff); }; // Retrieve the gunner and turret memory point information @@ -47,6 +47,17 @@ FUNC(laserHudDesignatePFH) = { _povPos = _turretInfo select 0; _povDir = _turretInfo select 1; + _targetInfo = _vehicle getVariable[QGVAR(currentTarget), [] ]; + if( (count _targetInfo) > 0) then { + if(_laserTarget != (_targetInfo select 0) ) then { + _targetInfo = [] + }; + }; + if( (count _targetInfo) < 1) then { + _targetInfo = [_laserTarget, 1001]; // TODO: set laser code + _vehicle setVariable[QGVAR(currentTarget), _targetInfo, true]; + _laserTarget setVariable[QGVAR(owner), _vehicle, true]; + }; _result = [_povPos, _povDir] call EFUNC(laser,shootCone); @@ -96,11 +107,11 @@ private "_handle"; if(isNil QGVAR(laser)) then { - _laserTarget = "LaserTargetW" createVehicle (getpos player); + _laserTarget = "LaserTargetW" createVehicle (getpos ACE_player); GVAR(laserActive) = true; - _handle = [FUNC(laserHudDesignatePFH), 0.1, [_laserTarget, player]] call cba_fnc_addPerFrameHandler; + _handle = [FUNC(laserHudDesignatePFH), 0.1, [_laserTarget, ACE_player]] call cba_fnc_addPerFrameHandler; _laserTarget setVariable ["ACE_PFH_HANDLE", _handle, false]; GVAR(laser) = _laserTarget; From 2ea7ecdbf7da01abd2dc8d62e105fc3b7b57cc89 Mon Sep 17 00:00:00 2001 From: jaynus Date: Tue, 7 Apr 2015 12:11:28 -0700 Subject: [PATCH 06/76] Working save. --- addons/laser/CfgEventhandlers.hpp | 8 +++++++ addons/laser/XEH_pre_init.sqf | 4 +--- addons/laser/functions/fnc_laser_init.sqf | 4 ++-- addons/laser_selfdesignate/XEH_pre_init.sqf | 2 +- .../functions/fnc_initDesignatorActions.sqf | 6 ++--- .../functions/fnc_laserHudDesignateOff.sqf | 12 ++++++---- .../functions/fnc_laserHudDesignateOn.sqf | 24 ++++++++++--------- addons/missileguidance/CfgAmmo.hpp | 11 +++++++++ 8 files changed, 46 insertions(+), 25 deletions(-) diff --git a/addons/laser/CfgEventhandlers.hpp b/addons/laser/CfgEventhandlers.hpp index bad89fd048..d925d0a12e 100644 --- a/addons/laser/CfgEventhandlers.hpp +++ b/addons/laser/CfgEventhandlers.hpp @@ -9,3 +9,11 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_post_init)); }; }; + +class Extended_Init_EventHandlers { + class LaserTargetBase { + class ADDON { + init = QUOTE(_this call DFUNC(laser_init)); + }; + }; +}; \ No newline at end of file diff --git a/addons/laser/XEH_pre_init.sqf b/addons/laser/XEH_pre_init.sqf index 8b39c429b6..0afa44c395 100644 --- a/addons/laser/XEH_pre_init.sqf +++ b/addons/laser/XEH_pre_init.sqf @@ -14,13 +14,11 @@ PREP(translateToWeaponSpace); PREP(laser_init); -GVAR(laser) = nil; // a single hud draws 1 laser at a time - PREP(laserTargetPFH); ACE_LASERS = []; -ACE_DEFAULT_LASER_CODE = 1000; +ACE_DEFAULT_LASER_CODE = 1001; ACE_DEFAULT_FIRE_SELECTION = [FIREMODE_DIRECT_LOAL, ACE_DEFAULT_LASER_CODE]; FUNC(getPosASL) = {visiblePositionASL (_this select 0)}; \ No newline at end of file diff --git a/addons/laser/functions/fnc_laser_init.sqf b/addons/laser/functions/fnc_laser_init.sqf index 9fcb439032..d8572e6018 100644 --- a/addons/laser/functions/fnc_laser_init.sqf +++ b/addons/laser/functions/fnc_laser_init.sqf @@ -16,9 +16,9 @@ REM(ACE_LASERS, objNull); if(!(local _laserTarget)) exitWith { }; // The target is local, so its on this client if(!isDedicated) then { - _laserTarget setVariable ["ACE_LASERTARGET_SHOOTER", player, true]; + _laserTarget setVariable ["ACE_LASERTARGET_SHOOTER", ACE_player, true]; - [FUNC(laserTargetPFH), 0, [_laserTarget, player]] call cba_fnc_addPerFrameHandler; + //[FUNC(laserTargetPFH), 0, [_laserTarget, ACE_player]] call cba_fnc_addPerFrameHandler; } else { // server side ownership of laser //_laserTarget setVariable ["ACE_LASERTARGET_SHOOTER", nil, false]; diff --git a/addons/laser_selfdesignate/XEH_pre_init.sqf b/addons/laser_selfdesignate/XEH_pre_init.sqf index a8d4b1779d..dd971b9539 100644 --- a/addons/laser_selfdesignate/XEH_pre_init.sqf +++ b/addons/laser_selfdesignate/XEH_pre_init.sqf @@ -6,6 +6,6 @@ PREP(laserHudDesignateOff); PREP(unitTurretHasDesignator); GVAR(laser) = nil; -GVAR(laserActive) = false; +GVAR(active) = false; FUNC(getPosASL) = {visiblePositionASL (_this select 0)}; diff --git a/addons/laser_selfdesignate/functions/fnc_initDesignatorActions.sqf b/addons/laser_selfdesignate/functions/fnc_initDesignatorActions.sqf index af361425aa..6514c889a1 100644 --- a/addons/laser_selfdesignate/functions/fnc_initDesignatorActions.sqf +++ b/addons/laser_selfdesignate/functions/fnc_initDesignatorActions.sqf @@ -28,7 +28,7 @@ GVAR(initializedClasses) = _initializedClasses; if (getNumber (_turretConfig >> QGVAR(Enabled)) == 1) exitWith { // @todo: Add the state variables to the vehicle, instead of to the client - // e.g.: _vehicle setVariable [format ["%1_%2", QGVAR(laserActive), _x], false]; + // e.g.: _vehicle setVariable [format ["%1_%2", QGVAR(active), _x], false]; // Add actions _onAction = [QGVAR(LaserOn), localize "STR_ACE_Laser_SelfDesignate_DesignatorOn", "", @@ -38,7 +38,7 @@ GVAR(initializedClasses) = _initializedClasses; }, { // Condition - !GVAR(laserActive) && {[ACE_player] call FUNC(unitTurretHasDesignator)} + !GVAR(active) && {[ACE_player] call FUNC(unitTurretHasDesignator)} }] call EFUNC(interact_menu,createAction); _offAction = [QGVAR(LaserOff), localize "STR_ACE_Laser_SelfDesignate_DesignatorOff", "", @@ -48,7 +48,7 @@ GVAR(initializedClasses) = _initializedClasses; }, { // Condition - GVAR(laserActive) && {[ACE_player] call FUNC(unitTurretHasDesignator)} + GVAR(active) && {[ACE_player] call FUNC(unitTurretHasDesignator)} }] call EFUNC(interact_menu,createAction); [_type, 1, ["ACE_SelfActions"], _onAction] call EFUNC(interact_menu,addActionToClass); diff --git a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf index af13f96431..66b94aa93a 100644 --- a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf +++ b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf @@ -1,8 +1,11 @@ #include "script_component.hpp" -if( (count _this) > 2) then { - EXPLODE_3_PVT((_this select 0),_vehicle,_shooter,_laserTarget); - _vehicle setVariable[QGVAR(currentTarget), [], true]; +if(!isNil "_this") then { + if( (count _this) > 2) then { + EXPLODE_3_PVT((_this select 0),_vehicle,_shooter,_laserTarget); + // We got the optional vehicle list, clear the parameters + _vehicle setVariable[QGVAR(currentTarget), [], true]; + }; }; if(isNil QGVAR(laser)) exitWith { @@ -17,10 +20,9 @@ if(!isNil "_handle") then { [_handle] call cba_fnc_removePerFrameHandler; }; -REM(ACE_LASERS, GVAR(laser)); deleteVehicle GVAR(laser); GVAR(laser) = nil; -GVAR(laserActive) = false; +GVAR(active) = false; diff --git a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf index 14eb9e077e..78d90d4712 100644 --- a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf +++ b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf @@ -23,7 +23,16 @@ FUNC(laserHudDesignatePFH) = { _args = _this select 0; _laserTarget = _args select 0; _shooter = _args select 1; + + TRACE_1("", _args); + if(!alive _shooter || isNull _vehicle || isNull _laserTarget || !GVAR(active) ) exitWith { + [_vehicle, _shooter, _laserTarget] call FUNC(laserHudDesignateOff); + }; + if(!([ACE_player] call FUNC(unitTurretHasDesignator)) ) exitWith { + [_vehicle, _shooter, _laserTarget] call FUNC(laserHudDesignateOff); + }; + if( (count _args) < 3) then { _args set[2, diag_tickTime + FCS_UPDATE_DELAY]; }; @@ -32,15 +41,6 @@ FUNC(laserHudDesignatePFH) = { _vehicle = vehicle _shooter; _weapon = currentWeapon _vehicle; - TRACE_1("", _args); - - if(!alive _shooter || isNull _vehicle || isNull _laserTarget || !GVAR(laserActive) ) exitWith { - [_vehicle, _shooter, _laserTarget] call FUNC(laserHudDesignateOff); - }; - if(!([ACE_player] call FUNC(unitTurretHasDesignator)) ) exitWith { - [_vehicle, _shooter, _laserTarget] call FUNC(laserHudDesignateOff); - }; - // Retrieve the gunner and turret memory point information _gunnerInfo = [_vehicle, _weapon] call CBA_fnc_getFirer; _turretInfo = [_vehicle, _gunnerInfo select 1] call EFUNC(common,getTurretDirection); @@ -106,14 +106,16 @@ private "_laserTarget"; private "_handle"; if(isNil QGVAR(laser)) then { - _laserTarget = "LaserTargetW" createVehicle (getpos ACE_player); - GVAR(laserActive) = true; + GVAR(active) = true; _handle = [FUNC(laserHudDesignatePFH), 0.1, [_laserTarget, ACE_player]] call cba_fnc_addPerFrameHandler; _laserTarget setVariable ["ACE_PFH_HANDLE", _handle, false]; + // Clear the vehicle parameters + _vehicle setVariable[QGVAR(currentTarget), [], true]; + GVAR(laser) = _laserTarget; } else { [] call FUNC(laserHudDesignateOff); diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index ff8da2b55e..766b713e1a 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -18,6 +18,17 @@ class CfgAmmo { maxspeed = 1030; maneuvrability = 8; sideairfriction = 0.065; + + ACE_maxDeflection = 0.15; // Maximum flap deflection for guidance + ACE_minDeflection = 0.005; // Minium flap deflection for guidance + ACE_incDeflection = 0.005; // The incrmeent in which deflection adjusts. + + ACE_seekerTypes = [ "SALH" ]; // {"SALH", "LIDAR", "BeamRide", "SARH", "Optic", "Thermal"}; + ACE_seekerAngle = 90; // Angle in front of the missile which can be searched + ACE_seekerAccuracy = 1; // seeker accuracy multiplier + ACE_seekerMaxRange = 2500; // Range from the missile which the seeker can visually search + + ACE_attackProfiles = [ "LOAL-LIN", "LOAL-DIR", "LOAL-MID", "LOAL-HI"]; }; class ACE_Hydra70_DAGR : M_PG_AT { From d3d5554c4929aada3e575b6459a2b4b45e46766c Mon Sep 17 00:00:00 2001 From: jaynus Date: Tue, 7 Apr 2015 12:35:34 -0700 Subject: [PATCH 07/76] Laser designation information localized to vehicle. --- addons/laser/functions/fnc_laser_init.sqf | 2 +- .../functions/fnc_laserHudDesignateOff.sqf | 11 +++-- .../functions/fnc_laserHudDesignateOn.sqf | 24 +++------- addons/missileguidance/CfgAmmo.hpp | 45 ++++++++++++------- addons/missileguidance/CfgVehicles.hpp | 3 +- addons/missileguidance/CfgWeapons.hpp | 2 +- 6 files changed, 44 insertions(+), 43 deletions(-) diff --git a/addons/laser/functions/fnc_laser_init.sqf b/addons/laser/functions/fnc_laser_init.sqf index d8572e6018..e0ff8ee7ce 100644 --- a/addons/laser/functions/fnc_laser_init.sqf +++ b/addons/laser/functions/fnc_laser_init.sqf @@ -18,7 +18,7 @@ if(!(local _laserTarget)) exitWith { }; if(!isDedicated) then { _laserTarget setVariable ["ACE_LASERTARGET_SHOOTER", ACE_player, true]; - //[FUNC(laserTargetPFH), 0, [_laserTarget, ACE_player]] call cba_fnc_addPerFrameHandler; + [FUNC(laserTargetPFH), 0, [_laserTarget, ACE_player]] call cba_fnc_addPerFrameHandler; } else { // server side ownership of laser //_laserTarget setVariable ["ACE_LASERTARGET_SHOOTER", nil, false]; diff --git a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf index 66b94aa93a..02ea7e6e70 100644 --- a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf +++ b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf @@ -1,11 +1,9 @@ #include "script_component.hpp" -if(!isNil "_this") then { - if( (count _this) > 2) then { - EXPLODE_3_PVT((_this select 0),_vehicle,_shooter,_laserTarget); - // We got the optional vehicle list, clear the parameters - _vehicle setVariable[QGVAR(currentTarget), [], true]; - }; +if( (count _this) > 2) then { + EXPLODE_3_PVT(_this,_vehicle,_shooter,_laserTarget); + // We got the optional vehicle list, clear the parameters + _vehicle setVariable[QGVAR(currentTarget), [], true]; }; if(isNil QGVAR(laser)) exitWith { @@ -20,6 +18,7 @@ if(!isNil "_handle") then { [_handle] call cba_fnc_removePerFrameHandler; }; +REM(ACE_LASERS, GVAR(laser)); deleteVehicle GVAR(laser); GVAR(laser) = nil; GVAR(active) = false; diff --git a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf index 78d90d4712..c85c7d3c43 100644 --- a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf +++ b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf @@ -5,19 +5,6 @@ TRACE_1("enter", _this); #define FCS_UPDATE_DELAY 1 -FUNC(magnitude) = { - _this distance [0, 0, 0] -}; - -FUNC(mat_normalize3d) = { - private ["_mag"]; - PARAMS_3(_vx,_vy,_vz); - - _mag = _this call FUNC(magnitude); - if (_mag == 0) then {_mag = 1}; - [(_vx/_mag), (_vy/_mag), (_vz/_mag)] -}; - FUNC(laserHudDesignatePFH) = { private["_args", "_laserTarget", "_shooter", "_vehicle", "_weapon", "_gunnerInfo", "_turret", "_pov", "_gunBeg", "_gunEnd", "_povPos", "_povDir", "_result", "_resultPositions", "_firstResult", "_forceUpdateTime"]; _args = _this select 0; @@ -26,10 +13,10 @@ FUNC(laserHudDesignatePFH) = { TRACE_1("", _args); - if(!alive _shooter || isNull _vehicle || isNull _laserTarget || !GVAR(active) ) exitWith { + if(vehicle ACE_player) != _shooter || !alive _shooter || isNull _vehicle || isNull _laserTarget || !GVAR(active) ) exitWith { [_vehicle, _shooter, _laserTarget] call FUNC(laserHudDesignateOff); }; - if(!([ACE_player] call FUNC(unitTurretHasDesignator)) ) exitWith { + if(!([_shooter] call FUNC(unitTurretHasDesignator)) ) exitWith { [_vehicle, _shooter, _laserTarget] call FUNC(laserHudDesignateOff); }; @@ -79,10 +66,10 @@ FUNC(laserHudDesignatePFH) = { ["ace_fcs_forceUpdate", []] call ace_common_fnc_localEvent; }; - if( (_laserTarget distance _pos) > 0.1) then { + //if( (_laserTarget distance _pos) > 0.1) then { TRACE_1("LaserPos Update", ""); _laserTarget setPosATL (ASLToATL _pos); - }; + //}; if(diag_tickTime > _forceUpdateTime) then { _args set[2, diag_tickTime + FCS_UPDATE_DELAY]; @@ -102,8 +89,7 @@ FUNC(laserHudDesignatePFH) = { _this set[0, _args]; }; -private "_laserTarget"; -private "_handle"; +private ["_laserTarget", "_handle", "_vehicle"]; if(isNil QGVAR(laser)) then { _laserTarget = "LaserTargetW" createVehicle (getpos ACE_player); diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index 766b713e1a..c94ee5900b 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -2,33 +2,48 @@ class CfgAmmo { class MissileBase; class M_PG_AT : MissileBase { + model = "\A3\Weapons_F\Ammo\Rocket_01_fly_F"; + proxyShape = "\A3\Weapons_F\Ammo\Rocket_01_F"; + irLock = 0; - laserLock = 0; - airLock = 0; - manualControl = 0; - timeToLive = 120; + laserLock = 0; + airLock = 0; + manualControl = 1; + weaponLockSystem = "2 + 16"; - hit = 150; - indirectHit = 40; - indirectHitRange = 2.5; - explosive = 0.1; // KE penetrators - inittime = 0.05; - thrust = 1900; - thrusttime = 1; - maxspeed = 1030; + hit = 600; + indirectHit = 50; + indirectHitRange = 4; + + maxSpeed = 720; + maxControlRange = 5000; + trackOversteer = 1; + trackLead = 1; maneuvrability = 8; - sideairfriction = 0.065; + timeToLive = 60; + simulationStep = 0.01; + airFriction = 0.1; + sideAirFriction = 0.16; + initTime = 0.002; + thrustTime = 1.07; + thrust = 530; + fuseDistance = 5; + effectsMissileInit = "MissileDAR1"; + effectsMissile = "missile2"; + whistleDist = 4; + muzzleEffect = ""; + ACE_maxDeflection = 0.15; // Maximum flap deflection for guidance ACE_minDeflection = 0.005; // Minium flap deflection for guidance ACE_incDeflection = 0.005; // The incrmeent in which deflection adjusts. - ACE_seekerTypes = [ "SALH" ]; // {"SALH", "LIDAR", "BeamRide", "SARH", "Optic", "Thermal"}; + ACE_seekerTypes[] = { "SALH" }; // {"SALH", "LIDAR", "BeamRide", "SARH", "Optic", "Thermal"}; ACE_seekerAngle = 90; // Angle in front of the missile which can be searched ACE_seekerAccuracy = 1; // seeker accuracy multiplier ACE_seekerMaxRange = 2500; // Range from the missile which the seeker can visually search - ACE_attackProfiles = [ "LOAL-LIN", "LOAL-DIR", "LOAL-MID", "LOAL-HI"]; + ACE_attackProfiles[] = { "LOAL-LIN", "LOAL-DIR", "LOAL-MID", "LOAL-HI" }; }; class ACE_Hydra70_DAGR : M_PG_AT { diff --git a/addons/missileguidance/CfgVehicles.hpp b/addons/missileguidance/CfgVehicles.hpp index f166a5bc4a..46d22e19e9 100644 --- a/addons/missileguidance/CfgVehicles.hpp +++ b/addons/missileguidance/CfgVehicles.hpp @@ -20,4 +20,5 @@ class CfgVehicles { }; }; }; -}; \ No newline at end of file +}; + diff --git a/addons/missileguidance/CfgWeapons.hpp b/addons/missileguidance/CfgWeapons.hpp index 353fa1fc7a..ab36d4dd52 100644 --- a/addons/missileguidance/CfgWeapons.hpp +++ b/addons/missileguidance/CfgWeapons.hpp @@ -8,6 +8,6 @@ class CfgWeapons { }; class missiles_DAGR : RocketPods { canLock = 1; - magazines[] = {"24Rnd_ACE_Hydra70_DAGR", "12Rnd_ACE_Hydra70_DAGR", "6Rnd_ACE_Hydra70_DAGR", "24Rnd_ACE_Hellfire_AGM114K", "12Rnd_ACE_Hellfire_AGM114K", "6Rnd_ACE_Hellfire_AGM114K" }; + magazines[] += {"24Rnd_ACE_Hydra70_DAGR", "12Rnd_ACE_Hydra70_DAGR", "6Rnd_ACE_Hydra70_DAGR", "24Rnd_ACE_Hellfire_AGM114K", "12Rnd_ACE_Hellfire_AGM114K", "6Rnd_ACE_Hellfire_AGM114K" }; }; }; \ No newline at end of file From fa9cf0280c0d580c93cf9b90d84f32ee29d6d242 Mon Sep 17 00:00:00 2001 From: jaynus Date: Tue, 7 Apr 2015 12:44:15 -0700 Subject: [PATCH 08/76] script error --- .../laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf index c85c7d3c43..b4535357ab 100644 --- a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf +++ b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf @@ -13,7 +13,7 @@ FUNC(laserHudDesignatePFH) = { TRACE_1("", _args); - if(vehicle ACE_player) != _shooter || !alive _shooter || isNull _vehicle || isNull _laserTarget || !GVAR(active) ) exitWith { + if((vehicle ACE_player) != _shooter || !alive _shooter || isNull _vehicle || isNull _laserTarget || !GVAR(active) ) exitWith { [_vehicle, _shooter, _laserTarget] call FUNC(laserHudDesignateOff); }; if(!([_shooter] call FUNC(unitTurretHasDesignator)) ) exitWith { From bf70a9ba77c94615257eb41d69dac01a60e0438c Mon Sep 17 00:00:00 2001 From: jaynus Date: Tue, 7 Apr 2015 12:59:35 -0700 Subject: [PATCH 09/76] Tracers and colors --- addons/aircraft/CfgAmmo.hpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/addons/aircraft/CfgAmmo.hpp b/addons/aircraft/CfgAmmo.hpp index 393b9666e6..f29c1d56d6 100644 --- a/addons/aircraft/CfgAmmo.hpp +++ b/addons/aircraft/CfgAmmo.hpp @@ -1,9 +1,7 @@ class CfgAmmo { class BulletBase; - class B_20mm; - - class ACE_20mm_HEDP : B_20mm { + class B_20mm : BulletBase { hit = 80; indirectHit = 12; indirectHitRange = 2; //2; @@ -11,8 +9,22 @@ class CfgAmmo { tracerStartTime = 0.02; timeToLive = 40; explosive = 1.8; + tracersEvery = 3; + tracerEndTime = 3.5; + + CraterEffects = "ExploAmmoCrater"; + explosionEffects = "ExploAmmoExplosion"; + model = "\A3\Weapons_f\Data\bullettracer\tracer_red"; + }; + class ACE_20mm_HEDP : B_20mm {}; + class ACE_20mm_AP : B_20mm { + hit = 50; + indirectHit = 12; + indirectHitRange = 0.3; //2; + explosive = 0; + CraterEffects = ""; + explosionEffects = ""; }; - // adjust minigun caliber and deflection to other ammo class SubmunitionBullet; From 104dd2258ec68eb33ee48ca1d2212dc642e26054 Mon Sep 17 00:00:00 2001 From: jaynus Date: Wed, 8 Apr 2015 08:01:39 -0700 Subject: [PATCH 10/76] Guidance framework working. --- addons/missileguidance/CfgAmmo.hpp | 37 +++++-- addons/missileguidance/XEH_pre_init.sqf | 11 +- .../functions/fnc_attackProfile_linear.sqf | 0 .../functions/fnc_doAttackProfile.sqf | 28 +++++ .../functions/fnc_doSeekerSearch.sqf | 11 ++ .../missileguidance/functions/fnc_fired.sqf | 57 +++++++--- .../functions/fnc_guidancePFH.sqf | 70 ++++++++++++ .../functions/fnc_guidance_DAGR.sqf | 103 ------------------ .../functions/fnc_guidance_HellfireII.sqf | 38 ------- .../functions/fnc_guidance_LGB.sqf | 2 +- .../functions/fnc_cycleFireMode.sqf | 4 +- addons/wep_javelin/functions/fnc_fired.sqf | 2 +- 12 files changed, 184 insertions(+), 179 deletions(-) create mode 100644 addons/missileguidance/functions/fnc_attackProfile_linear.sqf create mode 100644 addons/missileguidance/functions/fnc_doAttackProfile.sqf create mode 100644 addons/missileguidance/functions/fnc_doSeekerSearch.sqf create mode 100644 addons/missileguidance/functions/fnc_guidancePFH.sqf delete mode 100644 addons/missileguidance/functions/fnc_guidance_DAGR.sqf delete mode 100644 addons/missileguidance/functions/fnc_guidance_HellfireII.sqf diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index c94ee5900b..785a16a6e5 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -8,7 +8,6 @@ class CfgAmmo { irLock = 0; laserLock = 0; airLock = 0; - manualControl = 1; weaponLockSystem = "2 + 16"; hit = 600; @@ -17,8 +16,6 @@ class CfgAmmo { maxSpeed = 720; maxControlRange = 5000; - trackOversteer = 1; - trackLead = 1; maneuvrability = 8; timeToLive = 60; simulationStep = 0.01; @@ -34,16 +31,32 @@ class CfgAmmo { whistleDist = 4; muzzleEffect = ""; - ACE_maxDeflection = 0.15; // Maximum flap deflection for guidance - ACE_minDeflection = 0.005; // Minium flap deflection for guidance - ACE_incDeflection = 0.005; // The incrmeent in which deflection adjusts. + // Turn off arma crosshair-guidance + manualControl = 0; - ACE_seekerTypes[] = { "SALH" }; // {"SALH", "LIDAR", "BeamRide", "SARH", "Optic", "Thermal"}; - ACE_seekerAngle = 90; // Angle in front of the missile which can be searched - ACE_seekerAccuracy = 1; // seeker accuracy multiplier - ACE_seekerMaxRange = 2500; // Range from the missile which the seeker can visually search - - ACE_attackProfiles[] = { "LOAL-LIN", "LOAL-DIR", "LOAL-MID", "LOAL-HI" }; + // ACE uses these values + trackOversteer = 1; + trackLead = 0; + + // Begin ACE guidance Configs + class ACE_MissileGuidance { + enabled = 1; + + minDeflection = 0.005; // Minium flap deflection for guidance + maxDeflection = 0.15; // Maximum flap deflection for guidance + incDeflection = 0.005; // The incrmeent in which deflection adjusts. + + // Guidance type for munitions + defaultSeekerType = "SALH"; + seekerTypes[] = { "SALH", "LIDAR", "SARH", "Optic", "Thermal", "GPS", "SACLOS", "MCLOS", }; + seekerAngle = 90; // Angle in front of the missile which can be searched + seekerAccuracy = 1; // seeker accuracy multiplier + seekerMaxRange = 2500; // Range from the missile which the seeker can visually search + + // Attack profile type selection + defaultAttackProfile = "LOAL-LIN"; + attackProfiles[] = { "LOBL-LIN", "LOBL-DIR", "LOBL-MID", "LOBL-HI", "LOBL-TOP-DOWN", "LOAL-LIN", "LOAL-DIR", "LOAL-MID", "LOAL-HI", "LOAL-TOP-DOWN" }; + }; }; class ACE_Hydra70_DAGR : M_PG_AT { diff --git a/addons/missileguidance/XEH_pre_init.sqf b/addons/missileguidance/XEH_pre_init.sqf index 8aa557f838..ca7dc99e1e 100644 --- a/addons/missileguidance/XEH_pre_init.sqf +++ b/addons/missileguidance/XEH_pre_init.sqf @@ -8,7 +8,10 @@ PREP(translateToWeaponSpace); PREP(fired); -PREP(guidance_DAGR); -PREP(guidance_LGB); -PREP(guidance_HellfireII); -FUNC(getPosASL) = {visiblePositionASL (_this select 0)}; \ No newline at end of file +PREP(guidancePFH); +PREP(doAttackProfile); +PREP(doSeekerSearch); + +// Probably to be renamed +PREP(attackProfile_linear); +PREP(guidance_LGB); \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_linear.sqf b/addons/missileguidance/functions/fnc_attackProfile_linear.sqf new file mode 100644 index 0000000000..e69de29bb2 diff --git a/addons/missileguidance/functions/fnc_doAttackProfile.sqf b/addons/missileguidance/functions/fnc_doAttackProfile.sqf new file mode 100644 index 0000000000..bd308e5e88 --- /dev/null +++ b/addons/missileguidance/functions/fnc_doAttackProfile.sqf @@ -0,0 +1,28 @@ +#define DEBUG_MODE_FULL +#include "script_component.hpp" + +EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +private["_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams", "_targetPos", "_projectilePos"]; + +_launchParams = _this select 1; +_seekerTargetPos = _this select 0; + +_target = _launchParams select 0; +_targetLaunchParams = _launchParams select 1; + +_shooterPos = getPosASL _shooter; +_projectilePos = getPosASL _projectile; + +_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; +_distanceToShooter = _projectilePos vectorDistance _shooterPos; + +_addHeight = [0,0,(_projectilePos distance _seekerTargetPos)*0.02]; + +_seekerTargetPos = _seekerTargetPos vectorAdd _addHeight; + +#ifdef DEBUG_MODE_FULL +drawLine3D [(ASLtoATL _seekerTargetPos) vectorAdd _addHeight, ASLtoATL _seekerTargetPos, [0,1,0,1]]; +#endif + +TRACE_1("Adjusted target position", _seekerTargetPos); +_seekerTargetPos; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_doSeekerSearch.sqf b/addons/missileguidance/functions/fnc_doSeekerSearch.sqf new file mode 100644 index 0000000000..1780d5a45d --- /dev/null +++ b/addons/missileguidance/functions/fnc_doSeekerSearch.sqf @@ -0,0 +1,11 @@ +#define DEBUG_MODE_FULL +#include "script_component.hpp" + +EXPLODE_7_PVT((_this select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +private["_targets", "_foundTargetPos"]; + +_targets = [_projectile, ACE_DEFAULT_LASER_CODE, 70, (velocity _projectile)] call ace_laser_fnc_findLaserDesignator; +_foundTargetPos = getPosASL (_targets select 1); + +TRACE_1("Seeker return target pos", _foundTargetPos); +_foundTargetPos; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_fired.sqf b/addons/missileguidance/functions/fnc_fired.sqf index 0baec8e0eb..14b2c3ed76 100644 --- a/addons/missileguidance/functions/fnc_fired.sqf +++ b/addons/missileguidance/functions/fnc_fired.sqf @@ -1,25 +1,46 @@ -//#define DEBUG_MODE_FULL +#define DEBUG_MODE_FULL #include "script_component.hpp" -//_this=[TEST_AI_HELICOPTER,"missiles_DAGR","missiles_DAGR","Far_AI","M_PG_AT","24Rnd_PG_missiles",163988: rocket_01_fly_f.p3d] -TRACE_1("enter", _this); PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -if(!local _shooter) exitWith { false }; +// Bail on locality of the projectile, it should be local to us +if(!local _projectile) exitWith { false }; + +private["_config", "_enabled", "_target", "_seekerType", "_attackProfile"]; + +_config = configFile >> "CfgAmmo" >> _ammo >> "ACE_MissileGuidance"; +_enabled = getNumber ( _config >> "enabled"); + +// Bail if guidance is not enabled +if(isNil "_enabled" || {_enabled != 1}) exitWith { false }; -switch _ammo do { - case "M_PG_AT": { // Vanilla DAGR missile - _this call FUNC(guidance_DAGR); - }; - case "ACE_Hydra70_DAGR": { // ACE DAGR - _this call FUNC(guidance_DAGR); - }; - case "ACE_Hellfire_AGM114K": { // ACE Hellfire AGM-114K - _this call FUNC(guidance_HellfireII); - }; - case "GBU12BombLauncher": { - _this call FUNC(guidance_LGB); - }; -}; +_target = _shooter getVariable[QGVAR(target), nil]; +_seekerType = _shooter getVariable [QGVAR(seekerType), nil]; +_attackProfile = _shooter getVariable [QGVAR(attackProfile), nil]; +if ( isNil "_seekerType" || { ! ( _seekerType in (getArray (_config >> "seekerTypes" ) ) ) } ) then { + _seekerType = getText (_config >> "defaultSeekerType"); +}; +if ( isNil "_attackProfile" || { ! ( _attackProfile in (getArray (_config >> "attackProfiles" ) ) ) } ) then { + _attackProfile = getText (_config >> "defaultAttackProfile"); +}; +TRACE_4("Beginning ACE guidance system",_target,_ammo,_seekerType,_attackProfile); +[FUNC(guidancePFH), 0.1, [_this, + [ACE_player, + [_target, _targetPos, _launchPos], + _seekerType, + _attackProfile + ], + [ + getNumber ( _config >> "minDeflection" ), + getNumber ( _config >> "maxDeflection" ), + getNumber ( _config >> "incDeflection" ) + ], + [ + getNumber ( _config >> "seekerAngle" ), + getNumber ( _config >> "seekerAccuracy" ), + getNumber ( _config >> "seekerMaxRange" ) + ] + ] +] call cba_fnc_addPerFrameHandler; diff --git a/addons/missileguidance/functions/fnc_guidancePFH.sqf b/addons/missileguidance/functions/fnc_guidancePFH.sqf new file mode 100644 index 0000000000..305d93bf58 --- /dev/null +++ b/addons/missileguidance/functions/fnc_guidancePFH.sqf @@ -0,0 +1,70 @@ +#define DEBUG_MODE_FULL +#include "script_component.hpp" + +private["_args", "_launchParams", "_targetLaunchParams", "_config", "_flightParams", "_seekerParams"]; +_args = _this select 0; +EXPLODE_7_PVT((_args select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); + +_launchParams = _args select 1; +_targetLaunchParams = _launchParams select 1; +_flightParams = _args select 2; +_seekerParams = _args select 3; + +_config = configFile >> "CfgAmmo" >> _ammo >> "ACE_MissileGuidance"; + +if(!alive _projectile || isNull _projectile || isNull _shooter) exitWith { + [(_this select 1)] call cba_fnc_removePerFrameHandler; +}; + +_seekerTargetPos = _args call FUNC(doSeekerSearch); +if(!isNil "_seekerTargetPos") then { + + _profileAdjustedTargetPos = [_seekerTargetPos,_args] call FUNC(doAttackProfile); + + _minDeflection = _flightParams select 0; + _maxDeflection = _flightParams select 1; + + _yVec = vectorDir _projectile; + _zVec = vectorUp _projectile; + _xVec = vectorNormalized (_yVec vectorCrossProduct _zVec); + + _projectilePos = getPosASL _projectile; + + _targetVectorSeeker = [_projectile, [_xVec, _yVec, _zVec], _profileAdjustedTargetPos] call FUNC(translateToWeaponSpace); + _targetVector = [0,0,0] vectorFromTo _targetVectorSeeker; + TRACE_1("", _targetVectorSeeker, _targetVector); + + _yaw = 0; + _pitch = 0; + + if((_targetVectorSeeker select 0) < 0) then { + _yaw = - ( (_minDeflection max ((_targetVector select 0) min _maxDeflection) ) ); + } else { + if((_targetVectorSeeker select 0) > 0) then { + _yaw = ( (_minDeflection max ((_targetVector select 0) min _maxDeflection) ) ); + }; + }; + if((_targetVectorSeeker select 2) < 0) then { + _pitch = - ( (_minDeflection max ((_targetVector select 2) min _maxDeflection) ) ); + } else { + if((_targetVectorSeeker select 2) > 0) then { + _pitch = ( (_minDeflection max ((_targetVector select 2) min _maxDeflection) ) ); + }; + }; + +#ifdef DEBUG_MODE_FULL + drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,1,1,1], ASLtoATL _projectilePos, 0.75, 0.75, 0, str _vectorTo, 1, 0.025, "TahomaB"]; + drawLine3D [ASLtoATL _projectilePos, ASLtoATL _profileAdjustedTargetPos, [1,0,0,1]]; +#endif + + if(accTime > 0) then { + _outVector = [_projectile, [_xVec, _yVec, _zVec], [_yaw, 1/accTime, _pitch]] call FUNC(translateToModelSpace); + _vectorTo = _projectilePos vectorFromTo _outVector; + + _projectile setVectorDirAndUp [_vectorTo, vectorUp _projectile]; + }; + +#ifdef DEBUG_MODE_FULL + hintSilent format["d: %1", _distanceToTarget]; +#endif +}; diff --git a/addons/missileguidance/functions/fnc_guidance_DAGR.sqf b/addons/missileguidance/functions/fnc_guidance_DAGR.sqf deleted file mode 100644 index ff245972d4..0000000000 --- a/addons/missileguidance/functions/fnc_guidance_DAGR.sqf +++ /dev/null @@ -1,103 +0,0 @@ -#define DEBUG_MODE_FULL -#include "script_component.hpp" - -FUNC(guidance_DIRECT_LOAL_PFH) = { - //TRACE_1("enter", _this); - private["_args", "_shooter", "_dagr", "_curVelocity", "_targets", "_target", "_yVec", "_xVec", "_zVec", "_dagrPos", "_shooterPos", "_distanceToTarget", "_distanceToShooter", "_def"]; - _args = _this select 0; - //PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); - _shooter = _args select 0; - _dagr = _args select 6; - _curVelocity = velocity _dagr; - - if(!alive _dagr || isNull _dagr || isNull _shooter) exitWith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; - }; - - _targets = [_dagr, ACE_DEFAULT_LASER_CODE, 70, _curVelocity] call ace_laser_fnc_findLaserDesignator; - if((_targets select 0)) then { - _target = _targets select 1; - TRACE_2("Targets", _target, _targets); - - _yVec = vectorDir _dagr; - _zVec = vectorUp _dagr; - _xVec = vectorNormalized (_yVec vectorCrossProduct _zVec); - - _dagrPos = getPosASL _dagr; - _targetPos = getPosASL _target; - _shooterPos = getPosASL _shooter; - - if((count _targetPos) > 0) then { - _distanceToTarget = _dagrPos vectorDistance _targetPos; - _distanceToShooter = _dagrPos vectorDistance _shooterPos; - - _addHeight = [0,0,(_dagrPos distance _targetPos)*0.02]; - #ifdef DEBUG_MODE_FULL - drawLine3D [(ASLtoATL _targetPos) vectorAdd _addHeight, ASLtoATL _targetPos, [0,1,0,1]]; - #endif - - _targetPos = _targetPos vectorAdd _addHeight; - - _minDeflection = 0.005; - _maxDeflection = 0.15; - - _targetVectorSeeker = [_dagr, [_xVec, _yVec, _zVec], _targetPos] call FUNC(translateToWeaponSpace); - _targetVector = [0,0,0] vectorFromTo _targetVectorSeeker; - TRACE_1("", _targetVectorSeeker, _targetVector); - - _yaw = 0; - _pitch = 0; - - if((_targetVectorSeeker select 0) < 0) then { - _yaw = - ( (_minDeflection max ((_targetVector select 0) min _maxDeflection) ) ); - } else { - if((_targetVectorSeeker select 0) > 0) then { - _yaw = ( (_minDeflection max ((_targetVector select 0) min _maxDeflection) ) ); - }; - }; - if((_targetVectorSeeker select 2) < 0) then { - _pitch = - ( (_minDeflection max ((_targetVector select 2) min _maxDeflection) ) ); - } else { - if((_targetVectorSeeker select 2) > 0) then { - _pitch = ( (_minDeflection max ((_targetVector select 2) min _maxDeflection) ) ); - }; - }; - - - #ifdef DEBUG_MODE_FULL - drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,1,1,1], ASLtoATL _dagrPos, 0.75, 0.75, 0, str _vectorTo, 1, 0.025, "TahomaB"]; - drawLine3D [ASLtoATL _dagrPos, ASLtoATL _targetPos, [1,0,0,1]]; - #endif - - if(accTime > 0) then { - _outVector = [_dagr, [_xVec, _yVec, _zVec], [_yaw, 1/accTime, _pitch]] call FUNC(translateToModelSpace); - _vectorTo = _dagrPos vectorFromTo _outVector; - - _dagr setVectorDirAndUp [_vectorTo, vectorUp _dagr]; - }; - - #ifdef DEBUG_MODE_FULL - hintSilent format["d: %1", _distanceToTarget]; - #endif - }; - }; -}; - -FUNC(guidance_DAGR_DIRECT_LOAL) = { - PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); - - GVAR(lastTime) = time; - [FUNC(guidance_DIRECT_LOAL_PFH), 0.1, _this] call cba_fnc_addPerFrameHandler; -}; - -PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -_fireMode = _shooter getVariable ["ACE_FIRE_SELECTION", ACE_DEFAULT_FIRE_SELECTION]; - -switch (_fireMode select 0) do { - // Default to FIREMODE_DIRECT_LOAL - // FIREMODE_DIRECT_LOAL - default { - LOG("Initiating DAGR FIREMODE_DIRECT_LOAL"); - _this call FUNC(guidance_DAGR_DIRECT_LOAL); - }; -}; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_guidance_HellfireII.sqf b/addons/missileguidance/functions/fnc_guidance_HellfireII.sqf deleted file mode 100644 index a89a8d66d7..0000000000 --- a/addons/missileguidance/functions/fnc_guidance_HellfireII.sqf +++ /dev/null @@ -1,38 +0,0 @@ -#define DEBUG_MODE_FULL -#include "script_component.hpp" - -FUNC(guidance_Hellfire_LOAL_HI_PFH) = { - -}; - -FUNC(guidance_Hellfire_LOAL_DIR_PFH) = { - -}; - - -FUNC(guidance_Hellfire_LOAL_HI) = { - PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); - - GVAR(lastTime) = time; - [FUNC(guidance_Hellfire_LOAL_HI_PFH), 0, _this] call cba_fnc_addPerFrameHandler; -}; - - -FUNC(guidance_Hellfire_LOAL_DIR) = { - PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); - - GVAR(lastTime) = time; - [FUNC(guidance_Hellfire_LOAL_DIR_PFH), 0, _this] call cba_fnc_addPerFrameHandler; -}; - -PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -_fireMode = _shooter getVariable ["ACE_FIRE_SELECTION", ACE_DEFAULT_FIRE_SELECTION]; - -switch (_fireMode select 0) do { - // Default to FIREMODE_DIRECT_LOAL - // FIREMODE_DIRECT_LOAL - default { - LOG("Initiating Hellfire II FIREMODE_LOAL_DIR"); - _this call FUNC(guidance_Hellfire_LOAL_DIR); - }; -}; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_guidance_LGB.sqf b/addons/missileguidance/functions/fnc_guidance_LGB.sqf index 47efa46768..920bc2c247 100644 --- a/addons/missileguidance/functions/fnc_guidance_LGB.sqf +++ b/addons/missileguidance/functions/fnc_guidance_LGB.sqf @@ -97,7 +97,7 @@ FUNC(guidance_LGB_LOAL) = { }; PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -_fireMode = _shooter getVariable ["ACE_FIRE_SELECTION", ACE_DEFAULT_FIRE_SELECTION]; +_fireMode = _shooter getVariable [QGVAR(attackProfile), ACE_DEFAULT_FIRE_SELECTION]; switch (_fireMode select 0) do { // Default to FIREMODE_DIRECT_LOAL diff --git a/addons/wep_javelin/functions/fnc_cycleFireMode.sqf b/addons/wep_javelin/functions/fnc_cycleFireMode.sqf index 7902c6d265..a095ab0cb4 100644 --- a/addons/wep_javelin/functions/fnc_cycleFireMode.sqf +++ b/addons/wep_javelin/functions/fnc_cycleFireMode.sqf @@ -4,7 +4,7 @@ TRACE_1("enter", _this); private["_player", "_currentFireMode"]; -_currentFireMode = ACE_player getVariable["ACE_FIRE_SELECTION", ACE_JAV_FIREMODE_TOP]; +_currentFireMode = ACE_player getVariable["ace_missileguidance_attackProfile", ACE_JAV_FIREMODE_TOP]; if(_currentFireMode == ACE_JAV_FIREMODE_DIR) then { _currentFireMode = ACE_JAV_FIREMODE_TOP; @@ -16,4 +16,4 @@ if(_currentFireMode == ACE_JAV_FIREMODE_DIR) then { __JavelinIGUITop ctrlSetTextColor __ColorGray; __JavelinIGUIDir ctrlSetTextColor __ColorGreen; }; -ACE_player setVariable["ACE_FIRE_SELECTION", _currentFireMode, false]; +ACE_player setVariable["ace_missileguidance_attackProfile", _currentFireMode, false]; diff --git a/addons/wep_javelin/functions/fnc_fired.sqf b/addons/wep_javelin/functions/fnc_fired.sqf index 139f8f4b7e..fc5d56f432 100644 --- a/addons/wep_javelin/functions/fnc_fired.sqf +++ b/addons/wep_javelin/functions/fnc_fired.sqf @@ -268,7 +268,7 @@ FUNC(guidance_Javelin_LOBL_DIR) = { if(!local _shooter) exitWith { false }; if(_ammo == "M_Titan_AT") then { - _fireMode = _shooter getVariable ["ACE_FIRE_SELECTION", ACE_JAV_FIREMODE_TOP]; + _fireMode = _shooter getVariable ["ace_missileguidance_attackProfile", ACE_JAV_FIREMODE_TOP]; switch (_fireMode) do { // Default to FIREMODE_DIRECT_LOAL From 61f5324d29cc796456bf41a2391259e074a8cfb7 Mon Sep 17 00:00:00 2001 From: jaynus Date: Wed, 8 Apr 2015 08:19:19 -0700 Subject: [PATCH 11/76] ACE_Settings entry for guidance. --- addons/missileguidance/ACE_Settings.hpp | 9 ++++++ addons/missileguidance/config.cpp | 2 +- .../missileguidance/functions/fnc_fired.sqf | 5 +++- addons/missileguidance/stringtable.xml | 30 +++++++++++++++++++ 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 addons/missileguidance/ACE_Settings.hpp create mode 100644 addons/missileguidance/stringtable.xml diff --git a/addons/missileguidance/ACE_Settings.hpp b/addons/missileguidance/ACE_Settings.hpp new file mode 100644 index 0000000000..5991be0d78 --- /dev/null +++ b/addons/missileguidance/ACE_Settings.hpp @@ -0,0 +1,9 @@ +class ACE_Settings { + class GVAR(enabled) { + value = 1; + typeName = "BOOL"; + isClientSetable = 1; + displayName = "$STR_ACE_MissileGuidance"; + description = "$STR_ACE_MissileGuidance_Desc"; + }; +}; diff --git a/addons/missileguidance/config.cpp b/addons/missileguidance/config.cpp index d8cbba7db3..6b67e668ac 100644 --- a/addons/missileguidance/config.cpp +++ b/addons/missileguidance/config.cpp @@ -9,7 +9,7 @@ class CfgPatches { VERSION_CONFIG; }; }; - +#include "ACE_Settings.hpp" #include "CfgEventhandlers.hpp" #include "CfgAmmo.hpp" #include "CfgMagazines.hpp" diff --git a/addons/missileguidance/functions/fnc_fired.sqf b/addons/missileguidance/functions/fnc_fired.sqf index 14b2c3ed76..a8f552c48f 100644 --- a/addons/missileguidance/functions/fnc_fired.sqf +++ b/addons/missileguidance/functions/fnc_fired.sqf @@ -1,11 +1,14 @@ #define DEBUG_MODE_FULL #include "script_component.hpp" -PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); + +// Bail if guidance is disabled +if(!GVAR(enabled)) exitWith { false }; // Bail on locality of the projectile, it should be local to us if(!local _projectile) exitWith { false }; private["_config", "_enabled", "_target", "_seekerType", "_attackProfile"]; +PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); _config = configFile >> "CfgAmmo" >> _ammo >> "ACE_MissileGuidance"; _enabled = getNumber ( _config >> "enabled"); diff --git a/addons/missileguidance/stringtable.xml b/addons/missileguidance/stringtable.xml new file mode 100644 index 0000000000..b8076bddbf --- /dev/null +++ b/addons/missileguidance/stringtable.xml @@ -0,0 +1,30 @@ + + + + + + Advanced Missile Guidance + Avanzada Misiles Orientación + Avancée Missile orientation + Asystent Missile + Erweiterte Missile Guidance + Advanced Missile Guidance + Avanzato Missile Guidance + Avançado Missile Guidance + Részletes rakéta irányító + Расширенный ракетой + + + Enables advanced guidance mechanics and selection for different missiles and fire modes. + + + + + + + + + + + + \ No newline at end of file From 64724737cd9db994bcc061972e0d80270e8cc001 Mon Sep 17 00:00:00 2001 From: jaynus Date: Wed, 8 Apr 2015 08:35:24 -0700 Subject: [PATCH 12/76] Code passing cleanup. --- addons/laser/XEH_pre_init.sqf | 6 +---- .../functions/fnc_findLaserDesignator.sqf | 22 +++++++++++-------- addons/laser/functions/fnc_laser_init.sqf | 2 +- .../functions/fnc_laserHudDesignateOn.sqf | 2 +- .../functions/fnc_doSeekerSearch.sqf | 9 ++++++-- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/addons/laser/XEH_pre_init.sqf b/addons/laser/XEH_pre_init.sqf index 0afa44c395..4e4a39e8bf 100644 --- a/addons/laser/XEH_pre_init.sqf +++ b/addons/laser/XEH_pre_init.sqf @@ -17,8 +17,4 @@ PREP(laser_init); PREP(laserTargetPFH); ACE_LASERS = []; - -ACE_DEFAULT_LASER_CODE = 1001; -ACE_DEFAULT_FIRE_SELECTION = [FIREMODE_DIRECT_LOAL, ACE_DEFAULT_LASER_CODE]; - -FUNC(getPosASL) = {visiblePositionASL (_this select 0)}; \ No newline at end of file +ACE_DEFAULT_LASER_CODE = 1001; \ No newline at end of file diff --git a/addons/laser/functions/fnc_findLaserDesignator.sqf b/addons/laser/functions/fnc_findLaserDesignator.sqf index d10e221501..ecb80fa3e7 100644 --- a/addons/laser/functions/fnc_findLaserDesignator.sqf +++ b/addons/laser/functions/fnc_findLaserDesignator.sqf @@ -1,17 +1,21 @@ +#define DEBUG_MODE_FULL #include "script_component.hpp" -private ["_missile", "_headingPitch", "_found", "_vectorTo", "_polarTo", "_dir", "_vertOk", "_horzOk", "_fov", +private ["_seeker", "_headingPitch", "_found", "_vectorTo", "_polarTo", "_dir", "_vertOk", "_horzOk", "_fov", "_closestDistance", "_pos1", "_pos2", "_disCheck", "_currentTarget", "_potentialTargets", "_offset", "_vector"]; -_missile = _this select 0; + +_seeker = _this select 0; _laserCode = _this select 1; _fov = if (count _this > 2) then {_this select 2} else {75}; -_vector = if (count _this > 3) then {_this select 3} else {vectorDir _missile}; +_vector = if (count _this > 3) then {_this select 3} else {vectorDir _seeker}; _offset = if (count _this > 4) then {_this select 4} else {[0,0,0]}; _headingPitch = _vector call CBA_fnc_vect2polar; _currentTarget = nil; _found = false; +_getPosASL = {visiblePositionASL (_this select 0)}; + LOG("Searching lasers"); if(!(isNil "ACE_LASERS")) then { _potentialTargets = []; @@ -19,8 +23,8 @@ if(!(isNil "ACE_LASERS")) then { { if(!(isNull _x)) then { - _sensorPos = ATLtoASL(_missile modelToWorldVisual _offset); - _vectorTo = [_sensorPos, ([_x] call FUNC(getPosASL))] call BIS_fnc_vectorFromXToY; + _sensorPos = ATLtoASL(_seeker modelToWorldVisual _offset); + _vectorTo = [_sensorPos, ([_x] call _getPosASL)] call BIS_fnc_vectorFromXToY; _polarTo = _vectorTo call CBA_fnc_vect2polar; _dir = _polarTo select 1; _dir = _dir - (_headingPitch select 1); @@ -42,7 +46,7 @@ if(!(isNil "ACE_LASERS")) then { if(_vertOk && {_horzOk}) then { // Does the laser currently have our current code, if we have one? - _targetCode = _x getVariable ["ACE_LASERTARGET_CODE", ACE_DEFAULT_LASER_CODE]; + _targetCode = _x getVariable ["ACE_LASER_CODE", ACE_DEFAULT_LASER_CODE]; TRACE_1("Target in sight, checking code", _targetCode, _laserCode); if(_targetCode == _laserCode) then { _potentialTargets set[(count _potentialTargets), _x]; @@ -56,11 +60,11 @@ if(!(isNil "ACE_LASERS")) then { _closestDistance = 100000; { - _pos1 = (getPosASL _missile); - _pos2 = ([_x] call FUNC(getPosASL)); + _pos1 = (getPosASL _seeker); + _pos2 = ([_x] call _getPosASL); _disCheck = _pos1 distance _pos2; // shouldn't this bail out when a valid target is found instead of iterating over all potential targets ? - if(_disCheck < _closestDistance && {[_pos1, _pos2, _x, _missile] call FUNC(checkLos)}) then { + if(_disCheck < _closestDistance && {[_pos1, _pos2, _x, _seeker] call FUNC(checkLos)}) then { _found = true; _currentTarget = _x; _closestDistance = _disCheck; diff --git a/addons/laser/functions/fnc_laser_init.sqf b/addons/laser/functions/fnc_laser_init.sqf index e0ff8ee7ce..2790459724 100644 --- a/addons/laser/functions/fnc_laser_init.sqf +++ b/addons/laser/functions/fnc_laser_init.sqf @@ -9,7 +9,7 @@ TRACE_1("enter", _this); // Add the laser localized to the laser array, and give it the default localized code PUSH(ACE_LASERS, _laserTarget); // Check the vehicle, otherwise use the default -_laserTarget setVariable ["ACE_LASERTARGET_CODE", ACE_DEFAULT_LASER_CODE, false]; +_laserTarget setVariable ["ACE_LASER_CODE", ACE_DEFAULT_LASER_CODE, false]; // Clean the lasers of any null objects while we are here REM(ACE_LASERS, objNull); diff --git a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf index b4535357ab..99e350bbf1 100644 --- a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf +++ b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf @@ -11,7 +11,7 @@ FUNC(laserHudDesignatePFH) = { _laserTarget = _args select 0; _shooter = _args select 1; - TRACE_1("", _args); + TRACE_1("", _args, (_laserTarget getVariable["ACE_LASER_CODE"])); if((vehicle ACE_player) != _shooter || !alive _shooter || isNull _vehicle || isNull _laserTarget || !GVAR(active) ) exitWith { [_vehicle, _shooter, _laserTarget] call FUNC(laserHudDesignateOff); diff --git a/addons/missileguidance/functions/fnc_doSeekerSearch.sqf b/addons/missileguidance/functions/fnc_doSeekerSearch.sqf index 1780d5a45d..9d733d39ab 100644 --- a/addons/missileguidance/functions/fnc_doSeekerSearch.sqf +++ b/addons/missileguidance/functions/fnc_doSeekerSearch.sqf @@ -2,9 +2,14 @@ #include "script_component.hpp" EXPLODE_7_PVT((_this select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -private["_targets", "_foundTargetPos"]; +private["_targets", "_foundTargetPos", "_launchParams", "_seekerParams", "_targetLaunchParams"]; -_targets = [_projectile, ACE_DEFAULT_LASER_CODE, 70, (velocity _projectile)] call ace_laser_fnc_findLaserDesignator; +_launchParams = _this select 1; +_targetLaunchParams = _launchParams select 1; + +_seekerParams = _this select 3; + +_targets = [_projectile, ACE_DEFAULT_LASER_CODE, (_seekerParams select 0)] call ace_laser_fnc_findLaserDesignator; _foundTargetPos = getPosASL (_targets select 1); TRACE_1("Seeker return target pos", _foundTargetPos); From 177be598d7120268d4daecf596c13257691a963c Mon Sep 17 00:00:00 2001 From: jaynus Date: Wed, 8 Apr 2015 08:48:08 -0700 Subject: [PATCH 13/76] Fixes: Laser designator now uses strongest ray result. --- addons/laser/functions/fnc_findLaserDesignator.sqf | 2 +- .../functions/fnc_laserHudDesignateOn.sqf | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/addons/laser/functions/fnc_findLaserDesignator.sqf b/addons/laser/functions/fnc_findLaserDesignator.sqf index ecb80fa3e7..902775ebd5 100644 --- a/addons/laser/functions/fnc_findLaserDesignator.sqf +++ b/addons/laser/functions/fnc_findLaserDesignator.sqf @@ -1,4 +1,4 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" private ["_seeker", "_headingPitch", "_found", "_vectorTo", "_polarTo", "_dir", "_vertOk", "_horzOk", "_fov", diff --git a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf index 99e350bbf1..a6c8fc2295 100644 --- a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf +++ b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf @@ -6,7 +6,7 @@ TRACE_1("enter", _this); #define FCS_UPDATE_DELAY 1 FUNC(laserHudDesignatePFH) = { - private["_args", "_laserTarget", "_shooter", "_vehicle", "_weapon", "_gunnerInfo", "_turret", "_pov", "_gunBeg", "_gunEnd", "_povPos", "_povDir", "_result", "_resultPositions", "_firstResult", "_forceUpdateTime"]; + private["_strongestResultPos", "_args", "_laserTarget", "_shooter", "_vehicle", "_weapon", "_gunnerInfo", "_turret", "_pov", "_gunBeg", "_gunEnd", "_povPos", "_povDir", "_result", "_resultPositions", "_firstResult", "_forceUpdateTime"]; _args = _this select 0; _laserTarget = _args select 0; _shooter = _args select 1; @@ -52,23 +52,22 @@ FUNC(laserHudDesignatePFH) = { _resultPositions = _result select 2; if((count _resultPositions) > 0) then { - _firstResult = _resultPositions select 0; - _pos = _firstResult select 0; + _strongestResultPos = [_resultPositions, _povPos] call EFUNC(laser,findStrongestRay); // If the laser has moved less than a half meter, then dont move it. // Just regular use of lasers will commonly make them move this much, // but not across multiple close frames. // This loses accuracy a little, but saves position updates per frame. - TRACE_5("", diag_tickTime, _forceUpdateTime, getPosASL _laserTarget, _pos, ((getPosASL _laserTarget) distance _pos)); + TRACE_5("", diag_tickTime, _forceUpdateTime, getPosASL _laserTarget, _strongestResultPos, ((getPosASL _laserTarget) distance _pos)); if(diag_tickTime > _forceUpdateTime) then { TRACE_1("FCS Update", ""); ["ace_fcs_forceUpdate", []] call ace_common_fnc_localEvent; }; - //if( (_laserTarget distance _pos) > 0.1) then { + //if( (_laserTarget distance _strongestResultPos) > 0.1) then { TRACE_1("LaserPos Update", ""); - _laserTarget setPosATL (ASLToATL _pos); + _laserTarget setPosATL (ASLToATL _strongestResultPos); //}; if(diag_tickTime > _forceUpdateTime) then { From bc7943d729bee6e6dd366cd4c08d22ff30f4f9eb Mon Sep 17 00:00:00 2001 From: jaynus Date: Wed, 8 Apr 2015 09:18:11 -0700 Subject: [PATCH 14/76] added todo --- addons/missileguidance/functions/fnc_doSeekerSearch.sqf | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/missileguidance/functions/fnc_doSeekerSearch.sqf b/addons/missileguidance/functions/fnc_doSeekerSearch.sqf index 9d733d39ab..5ab668bea8 100644 --- a/addons/missileguidance/functions/fnc_doSeekerSearch.sqf +++ b/addons/missileguidance/functions/fnc_doSeekerSearch.sqf @@ -9,6 +9,7 @@ _targetLaunchParams = _launchParams select 1; _seekerParams = _this select 3; +// TODO: this needs to be shootCone/findStrongestRay after testing _targets = [_projectile, ACE_DEFAULT_LASER_CODE, (_seekerParams select 0)] call ace_laser_fnc_findLaserDesignator; _foundTargetPos = getPosASL (_targets select 1); From 3946ee32d2e8dfbd75b780c5d562e94a33ca3989 Mon Sep 17 00:00:00 2001 From: jaynus Date: Wed, 8 Apr 2015 11:27:30 -0700 Subject: [PATCH 15/76] Fixes left/right issue. --- addons/missileguidance/functions/fnc_guidancePFH.sqf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/missileguidance/functions/fnc_guidancePFH.sqf b/addons/missileguidance/functions/fnc_guidancePFH.sqf index 305d93bf58..396b3bec6b 100644 --- a/addons/missileguidance/functions/fnc_guidancePFH.sqf +++ b/addons/missileguidance/functions/fnc_guidancePFH.sqf @@ -23,6 +23,7 @@ if(!isNil "_seekerTargetPos") then { _minDeflection = _flightParams select 0; _maxDeflection = _flightParams select 1; + _incDeflection = _flightParams select 2; _yVec = vectorDir _projectile; _zVec = vectorUp _projectile; @@ -38,14 +39,14 @@ if(!isNil "_seekerTargetPos") then { _pitch = 0; if((_targetVectorSeeker select 0) < 0) then { - _yaw = - ( (_minDeflection max ((_targetVector select 0) min _maxDeflection) ) ); + _yaw = - ( (_minDeflection max (abs(_targetVector select 0) min _maxDeflection) ) ); } else { if((_targetVectorSeeker select 0) > 0) then { _yaw = ( (_minDeflection max ((_targetVector select 0) min _maxDeflection) ) ); }; }; if((_targetVectorSeeker select 2) < 0) then { - _pitch = - ( (_minDeflection max ((_targetVector select 2) min _maxDeflection) ) ); + _pitch = - ( (_minDeflection max (abs(_targetVector select 2) min _maxDeflection) ) ); } else { if((_targetVectorSeeker select 2) > 0) then { _pitch = ( (_minDeflection max ((_targetVector select 2) min _maxDeflection) ) ); From 6f9203262aadc72f5792ef63bf4ac278b7741f78 Mon Sep 17 00:00:00 2001 From: jaynus Date: Wed, 8 Apr 2015 12:32:33 -0700 Subject: [PATCH 16/76] tweak default deflection values for testing --- addons/missileguidance/CfgAmmo.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index 785a16a6e5..c65b7d8614 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -43,7 +43,7 @@ class CfgAmmo { enabled = 1; minDeflection = 0.005; // Minium flap deflection for guidance - maxDeflection = 0.15; // Maximum flap deflection for guidance + maxDeflection = 0.025; // Maximum flap deflection for guidance incDeflection = 0.005; // The incrmeent in which deflection adjusts. // Guidance type for munitions From cf876116a9d8e11088c57cb72ef764fd8ff30928 Mon Sep 17 00:00:00 2001 From: jaynus Date: Wed, 8 Apr 2015 13:45:43 -0700 Subject: [PATCH 17/76] Working configuration based guidance framework. --- addons/missileguidance/ACE_GuidanceConfig.hpp | 19 +++ addons/missileguidance/ACE_Settings.hpp | 2 +- addons/missileguidance/CfgAmmo.hpp | 6 +- addons/missileguidance/XEH_pre_init.sqf | 13 ++- addons/missileguidance/config.cpp | 3 + .../functions/fnc_attackProfile_LIN.sqf | 28 +++++ .../functions/fnc_attackProfile_linear.sqf | 0 .../functions/fnc_doAttackProfile.sqf | 39 ++++--- .../functions/fnc_doSeekerSearch.sqf | 34 ++++-- .../functions/fnc_guidancePFH.sqf | 3 +- .../functions/fnc_guidance_LGB.sqf | 109 ------------------ .../functions/fnc_seekerType_SALH.sqf | 17 +++ 12 files changed, 128 insertions(+), 145 deletions(-) create mode 100644 addons/missileguidance/ACE_GuidanceConfig.hpp create mode 100644 addons/missileguidance/functions/fnc_attackProfile_LIN.sqf delete mode 100644 addons/missileguidance/functions/fnc_attackProfile_linear.sqf delete mode 100644 addons/missileguidance/functions/fnc_guidance_LGB.sqf create mode 100644 addons/missileguidance/functions/fnc_seekerType_SALH.sqf diff --git a/addons/missileguidance/ACE_GuidanceConfig.hpp b/addons/missileguidance/ACE_GuidanceConfig.hpp new file mode 100644 index 0000000000..9326cc2787 --- /dev/null +++ b/addons/missileguidance/ACE_GuidanceConfig.hpp @@ -0,0 +1,19 @@ +class GVAR(AttackProfiles) { + class LIN { + name = ""; + visualName = ""; + description = ""; + + functionName = QFUNC(attackProfile_LIN); + }; +}; + +class GVAR(SeekerTypes) { + class SALH { + name = ""; + visualName = ""; + description = ""; + + functionName = QFUNC(seekerType_SALH); + }; +}; diff --git a/addons/missileguidance/ACE_Settings.hpp b/addons/missileguidance/ACE_Settings.hpp index 5991be0d78..060bde199b 100644 --- a/addons/missileguidance/ACE_Settings.hpp +++ b/addons/missileguidance/ACE_Settings.hpp @@ -6,4 +6,4 @@ class ACE_Settings { displayName = "$STR_ACE_MissileGuidance"; description = "$STR_ACE_MissileGuidance_Desc"; }; -}; +}; \ No newline at end of file diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index c65b7d8614..e149a35b2f 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -48,14 +48,14 @@ class CfgAmmo { // Guidance type for munitions defaultSeekerType = "SALH"; - seekerTypes[] = { "SALH", "LIDAR", "SARH", "Optic", "Thermal", "GPS", "SACLOS", "MCLOS", }; + seekerTypes[] = { "SALH", "LIDAR", "SARH", "Optic", "Thermal", "GPS", "SACLOS", "MCLOS" }; seekerAngle = 90; // Angle in front of the missile which can be searched seekerAccuracy = 1; // seeker accuracy multiplier seekerMaxRange = 2500; // Range from the missile which the seeker can visually search // Attack profile type selection - defaultAttackProfile = "LOAL-LIN"; - attackProfiles[] = { "LOBL-LIN", "LOBL-DIR", "LOBL-MID", "LOBL-HI", "LOBL-TOP-DOWN", "LOAL-LIN", "LOAL-DIR", "LOAL-MID", "LOAL-HI", "LOAL-TOP-DOWN" }; + defaultAttackProfile = "LIN"; + attackProfiles[] = { "LIN", "DIR", "MID", "HI", "TOP" }; }; }; diff --git a/addons/missileguidance/XEH_pre_init.sqf b/addons/missileguidance/XEH_pre_init.sqf index ca7dc99e1e..2716eb7355 100644 --- a/addons/missileguidance/XEH_pre_init.sqf +++ b/addons/missileguidance/XEH_pre_init.sqf @@ -12,6 +12,13 @@ PREP(guidancePFH); PREP(doAttackProfile); PREP(doSeekerSearch); -// Probably to be renamed -PREP(attackProfile_linear); -PREP(guidance_LGB); \ No newline at end of file +// Attack Profiles +PREP(attackProfile_LIN); +//PREP(attackProfile_HI); +//PREP(attackProfile_DIR); +//PREP(attackProfile_MID); +//PREP(attackProfile_TOP); + + +// Seeker search functions +PREP(seekerType_SALH); \ No newline at end of file diff --git a/addons/missileguidance/config.cpp b/addons/missileguidance/config.cpp index 6b67e668ac..2fa44b4247 100644 --- a/addons/missileguidance/config.cpp +++ b/addons/missileguidance/config.cpp @@ -9,7 +9,10 @@ class CfgPatches { VERSION_CONFIG; }; }; + +#include "ACE_GuidanceConfig.hpp" #include "ACE_Settings.hpp" + #include "CfgEventhandlers.hpp" #include "CfgAmmo.hpp" #include "CfgMagazines.hpp" diff --git a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf new file mode 100644 index 0000000000..588cfa5d63 --- /dev/null +++ b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf @@ -0,0 +1,28 @@ +#define DEBUG_MODE_FULL +#include "script_component.hpp" + +EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +private["_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams", "_targetPos", "_projectilePos"]; + +_seekerTargetPos = _this select 0; +_launchParams = _this select 1; + +_target = _launchParams select 0; +_targetLaunchParams = _launchParams select 1; + +_shooterPos = getPosASL _shooter; +_projectilePos = getPosASL _projectile; + +_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; +_distanceToShooter = _projectilePos vectorDistance _shooterPos; + +_addHeight = [0,0,(_projectilePos distance _seekerTargetPos)*0.02]; + +_seekerTargetPos = _seekerTargetPos vectorAdd _addHeight; + +#ifdef DEBUG_MODE_FULL +drawLine3D [(ASLtoATL _seekerTargetPos) vectorAdd _addHeight, ASLtoATL _seekerTargetPos, [0,1,0,1]]; +#endif + +TRACE_1("Adjusted target position", _seekerTargetPos); +_seekerTargetPos; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_linear.sqf b/addons/missileguidance/functions/fnc_attackProfile_linear.sqf deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/addons/missileguidance/functions/fnc_doAttackProfile.sqf b/addons/missileguidance/functions/fnc_doAttackProfile.sqf index bd308e5e88..ed9dd2cb20 100644 --- a/addons/missileguidance/functions/fnc_doAttackProfile.sqf +++ b/addons/missileguidance/functions/fnc_doAttackProfile.sqf @@ -2,27 +2,30 @@ #include "script_component.hpp" EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -private["_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams", "_targetPos", "_projectilePos"]; +private["_attackProfilePos"]; -_launchParams = _this select 1; -_seekerTargetPos = _this select 0; +_launchParams = ((_this select 1) select 1); +_attackProfileName = _launchParams select 3; -_target = _launchParams select 0; -_targetLaunchParams = _launchParams select 1; +TRACE_1("Attacking profile", _attackProfileName); -_shooterPos = getPosASL _shooter; -_projectilePos = getPosASL _projectile; +_attackProfilesCfg = ( configFile >> QGVAR(AttackProfiles) ); -_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; -_distanceToShooter = _projectilePos vectorDistance _shooterPos; +_attackProfile = nil; +for [{_i=0}, {_i< (count _attackProfilesCfg) }, {_i=_i+1}] do { + _testProfile = _attackProfilesCfg select _i; + _testName = configName _testProfile; + TRACE_3("", _testName, _testProfile, _attackProfilesCfg); + + if( _testName == _attackProfileName) exitWith { + _attackProfile = _attackProfilesCfg select _i; + }; +}; -_addHeight = [0,0,(_projectilePos distance _seekerTargetPos)*0.02]; +_attackProfilePos = [0,0,0]; +if(!isNil "_attackProfile") then { + _attackProfileExecCode = "_this call " + getText (_attackProfile >> "functionName"); + _attackProfilePos = call compile _attackProfileExecCode; +}; -_seekerTargetPos = _seekerTargetPos vectorAdd _addHeight; - -#ifdef DEBUG_MODE_FULL -drawLine3D [(ASLtoATL _seekerTargetPos) vectorAdd _addHeight, ASLtoATL _seekerTargetPos, [0,1,0,1]]; -#endif - -TRACE_1("Adjusted target position", _seekerTargetPos); -_seekerTargetPos; \ No newline at end of file +_attackProfilePos; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_doSeekerSearch.sqf b/addons/missileguidance/functions/fnc_doSeekerSearch.sqf index 5ab668bea8..fcba51d986 100644 --- a/addons/missileguidance/functions/fnc_doSeekerSearch.sqf +++ b/addons/missileguidance/functions/fnc_doSeekerSearch.sqf @@ -1,17 +1,31 @@ #define DEBUG_MODE_FULL #include "script_component.hpp" -EXPLODE_7_PVT((_this select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -private["_targets", "_foundTargetPos", "_launchParams", "_seekerParams", "_targetLaunchParams"]; +EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +private["_seekerProfilePos"]; -_launchParams = _this select 1; -_targetLaunchParams = _launchParams select 1; +_launchParams = ((_this select 1) select 1); +_seekerTypeName = _launchParams select 2; -_seekerParams = _this select 3; +TRACE_1("Seeker type", _seekerTypeName); -// TODO: this needs to be shootCone/findStrongestRay after testing -_targets = [_projectile, ACE_DEFAULT_LASER_CODE, (_seekerParams select 0)] call ace_laser_fnc_findLaserDesignator; -_foundTargetPos = getPosASL (_targets select 1); +_seekerTypesCfg = ( configFile >> QGVAR(SeekerTypes) ); -TRACE_1("Seeker return target pos", _foundTargetPos); -_foundTargetPos; \ No newline at end of file +_seekerType = nil; +for [{_i=0}, {_i< (count _seekerTypesCfg) }, {_i=_i+1}] do { + _testProfile = _seekerTypesCfg select _i; + _testName = configName _testProfile; + TRACE_3("", _testName, _testProfile, _seekerTypesCfg); + + if( _testName == _seekerTypeName) exitWith { + _seekerType = _seekerTypesCfg select _i; + }; +}; + +_seekerProfilePos = [0,0,0]; +if(!isNil "_seekerType") then { + _seekerProfileExecCode = "_this call " + getText (_seekerType >> "functionName"); + _seekerProfilePos = call compile _seekerProfileExecCode; +}; + +_seekerProfilePos; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_guidancePFH.sqf b/addons/missileguidance/functions/fnc_guidancePFH.sqf index 396b3bec6b..8494fab49d 100644 --- a/addons/missileguidance/functions/fnc_guidancePFH.sqf +++ b/addons/missileguidance/functions/fnc_guidancePFH.sqf @@ -16,7 +16,8 @@ if(!alive _projectile || isNull _projectile || isNull _shooter) exitWith { [(_this select 1)] call cba_fnc_removePerFrameHandler; }; -_seekerTargetPos = _args call FUNC(doSeekerSearch); +// TODO: placeholder for "last seek target position" +_seekerTargetPos = [ [0,0,0], _args] call FUNC(doSeekerSearch); if(!isNil "_seekerTargetPos") then { _profileAdjustedTargetPos = [_seekerTargetPos,_args] call FUNC(doAttackProfile); diff --git a/addons/missileguidance/functions/fnc_guidance_LGB.sqf b/addons/missileguidance/functions/fnc_guidance_LGB.sqf deleted file mode 100644 index 920bc2c247..0000000000 --- a/addons/missileguidance/functions/fnc_guidance_LGB.sqf +++ /dev/null @@ -1,109 +0,0 @@ -#define DEBUG_MODE_FULL -#include "script_component.hpp" - -FUNC(guidance_LGB_LOAL_PFH) = { - //TRACE_1("enter", _this); - _args = _this select 0; - //PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); - _lgb = _args select 6; - _curVelocity = velocity _lgb; - - if(!alive _lgb) exitWith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; - }; - - _targets = [_lgb, ACE_DEFAULT_LASER_CODE, 70, _curVelocity] call uo_laser_fnc_findLaserDesignator; - //TRACE_2("Targets", _target, _targets); - - if((_targets select 0)) then { - _target = _targets select 1; - - // player sideChat "FUCK!"; - // drop ["\a3\data_f\Cl_basic","","Billboard",1,20,(getPos _lgb),[0,0,0],1,1.275,1.0,0.0,[5],[[1,0,0,1]],[0],0.0,2.0,"","",""]; - - - _yVec = vectorDir _lgb; - _zVec = vectorUp _lgb; - _xVec = vectorNormalized (_yVec vectorCrossProduct _zVec); - - _lgbPos = getPosASL _lgb; - // player sideChat "G!"; - _targetPos = getPosASL _target; - if((count _targetPos) > 0) then { - // player sideChat format["f: %1", _targetPos]; - _addHeight = [0,0,(_lgbPos distance _targetPos)*0.06]; - // drawLine3D [(ASLtoATL _targetPos) vectorAdd _addHeight, ASLtoATL _targetPos, [0,1,0,1]]; - _targetPos = _targetPos vectorAdd _addHeight; - - - - _def = 0.0025; - - _targetVectorSeeker = [_lgb, [_xVec, _yVec, _zVec], _targetPos] call FUNC(translateToWeaponSpace); - // _targetVectorSeeker = _lgb worldToModel (ASLtoATL _targetPos); - // _targetVectorSeeker = [0,0,0] vectorFromTo _targetVectorSeeker; - _yaw = 0.0; - if((_targetVectorSeeker select 0) < 0) then { - _yaw = -_def; - } else { - if((_targetVectorSeeker select 0) > 0) then { - _yaw = _def; - }; - }; - - _pitch = 0.0; - if((_targetVectorSeeker select 2) < 0) then { - _pitch = -_def; - } else { - if((_targetVectorSeeker select 2) > 0) then { - _pitch = _def; - }; - }; - #ifdef DEBUG_MODE_FULL - drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,1,1,1], ASLtoATL _lgbPos, 0.75, 0.75, 0, str _vectorTo, 1, 0.025, "TahomaB"]; - drawLine3D [ASLtoATL _lgbPos, ASLtoATL _targetPos, [1,0,0,1]]; - - _distance = ([getPos startPos, _lgbPos] call BIS_fnc_distance2D); - _marker = createMarkerLocal [format["m%1", MARKERCOUNT], [_distance, _lgbPos select 2]]; - _marker setMarkerTypeLocal "mil_dot"; - _marker setMarkerColorLocal "ColorRed"; - - MARKERCOUNT = MARKERCOUNT + 1; - #endif - - if(accTime > 0) then { - _outVector = [_lgb, [_xVec, _yVec, _zVec], [_yaw, 1/accTime, _pitch]] call FUNC(translateToModelSpace); - // _outVector = _lgb modelToWorldVisual [_yaw, 1, _pitch]; - // _outVector = ATLtoASL _outVector; - _vectorTo = _lgbPos vectorFromTo _outVector; - - // hintSilent format["v: %1", _vectorTo]; - - // _lgb setVectorDir _vectorTo; - _lgb setVectorDirAndUp [_vectorTo, vectorUp _lgb]; - }; - - #ifdef DEBUG_MODE_FULL - hintSilent format["d: %1", _lgbPos vectorDistance _targetPos]; - #endif - }; - }; -}; - -FUNC(guidance_LGB_LOAL) = { - PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); - - [FUNC(guidance_LGB_LOAL_PFH), 0, _this] call cba_fnc_addPerFrameHandler; -}; - -PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -_fireMode = _shooter getVariable [QGVAR(attackProfile), ACE_DEFAULT_FIRE_SELECTION]; - -switch (_fireMode select 0) do { - // Default to FIREMODE_DIRECT_LOAL - // FIREMODE_DIRECT_LOAL - default { - LOG("Initiating FIREMODE_DIRECT_LOAL"); - _this call FUNC(guidance_LGB_LOAL); - }; -}; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_seekerType_SALH.sqf b/addons/missileguidance/functions/fnc_seekerType_SALH.sqf new file mode 100644 index 0000000000..7fa23d028e --- /dev/null +++ b/addons/missileguidance/functions/fnc_seekerType_SALH.sqf @@ -0,0 +1,17 @@ +#define DEBUG_MODE_FULL +#include "script_component.hpp" + +EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +private["_targets", "_foundTargetPos", "_launchParams", "_seekerParams", "_targetLaunchParams"]; + +_seekerTargetPos = _this select 0; + +_launchParams = _this select 1; +_seekerParams = _launchParams select 3; + +// TODO: this needs to be shootCone/findStrongestRay after testing +_targets = [_projectile, ACE_DEFAULT_LASER_CODE, (_seekerParams select 0)] call ace_laser_fnc_findLaserDesignator; +_foundTargetPos = getPosASL (_targets select 1); + +TRACE_1("Seeker return target pos", _foundTargetPos); +_foundTargetPos; \ No newline at end of file From 04b0efb22bb1da12936961e45407402672dffb0c Mon Sep 17 00:00:00 2001 From: jaynus Date: Wed, 8 Apr 2015 13:57:08 -0700 Subject: [PATCH 18/76] Safer calling, build out attack profiles. --- addons/missileguidance/ACE_GuidanceConfig.hpp | 35 +++++++++++++++++++ addons/missileguidance/XEH_pre_init.sqf | 8 ++--- .../functions/fnc_attackProfile_DIR.sqf | 4 +++ .../functions/fnc_attackProfile_HI.sqf | 4 +++ .../functions/fnc_attackProfile_LIN.sqf | 2 +- .../functions/fnc_attackProfile_MID.sqf | 4 +++ .../functions/fnc_attackProfile_PYM.sqf | 28 +++++++++++++++ .../functions/fnc_attackProfile_TOP.sqf | 4 +++ .../functions/fnc_doAttackProfile.sqf | 3 +- .../functions/fnc_doSeekerSearch.sqf | 3 +- .../functions/fnc_seekerType_SALH.sqf | 2 +- 11 files changed, 87 insertions(+), 10 deletions(-) create mode 100644 addons/missileguidance/functions/fnc_attackProfile_DIR.sqf create mode 100644 addons/missileguidance/functions/fnc_attackProfile_HI.sqf create mode 100644 addons/missileguidance/functions/fnc_attackProfile_MID.sqf create mode 100644 addons/missileguidance/functions/fnc_attackProfile_PYM.sqf create mode 100644 addons/missileguidance/functions/fnc_attackProfile_TOP.sqf diff --git a/addons/missileguidance/ACE_GuidanceConfig.hpp b/addons/missileguidance/ACE_GuidanceConfig.hpp index 9326cc2787..2f68140219 100644 --- a/addons/missileguidance/ACE_GuidanceConfig.hpp +++ b/addons/missileguidance/ACE_GuidanceConfig.hpp @@ -6,6 +6,41 @@ class GVAR(AttackProfiles) { functionName = QFUNC(attackProfile_LIN); }; + class DIR { + name = ""; + visualName = ""; + description = ""; + + functionName = QFUNC(attackProfile_DIR); + }; + class MID { + name = ""; + visualName = ""; + description = ""; + + functionName = QFUNC(attackProfile_MID); + }; + class HI { + name = ""; + visualName = ""; + description = ""; + + functionName = QFUNC(attackProfile_HI); + }; + class TOP { + name = ""; + visualName = ""; + description = ""; + + functionName = QFUNC(attackProfile_TOP); + }; + class PYM { + name = ""; + visualName = ""; + description = ""; + + functionName = QFUNC(attackProfile_PYM); + }; }; class GVAR(SeekerTypes) { diff --git a/addons/missileguidance/XEH_pre_init.sqf b/addons/missileguidance/XEH_pre_init.sqf index 2716eb7355..34dd2eb9c9 100644 --- a/addons/missileguidance/XEH_pre_init.sqf +++ b/addons/missileguidance/XEH_pre_init.sqf @@ -14,10 +14,10 @@ PREP(doSeekerSearch); // Attack Profiles PREP(attackProfile_LIN); -//PREP(attackProfile_HI); -//PREP(attackProfile_DIR); -//PREP(attackProfile_MID); -//PREP(attackProfile_TOP); +PREP(attackProfile_DIR); +PREP(attackProfile_MID); +PREP(attackProfile_HI); +PREP(attackProfile_TOP); // Seeker search functions diff --git a/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf b/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf new file mode 100644 index 0000000000..e4776adcdf --- /dev/null +++ b/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf @@ -0,0 +1,4 @@ +#define DEBUG_MODE_FULL +#include "script_component.hpp" + +_this call FUNC(attackProfile_LIN); \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_HI.sqf b/addons/missileguidance/functions/fnc_attackProfile_HI.sqf new file mode 100644 index 0000000000..e4776adcdf --- /dev/null +++ b/addons/missileguidance/functions/fnc_attackProfile_HI.sqf @@ -0,0 +1,4 @@ +#define DEBUG_MODE_FULL +#include "script_component.hpp" + +_this call FUNC(attackProfile_LIN); \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf index 588cfa5d63..375f65810c 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf @@ -1,4 +1,4 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); diff --git a/addons/missileguidance/functions/fnc_attackProfile_MID.sqf b/addons/missileguidance/functions/fnc_attackProfile_MID.sqf new file mode 100644 index 0000000000..e4776adcdf --- /dev/null +++ b/addons/missileguidance/functions/fnc_attackProfile_MID.sqf @@ -0,0 +1,4 @@ +#define DEBUG_MODE_FULL +#include "script_component.hpp" + +_this call FUNC(attackProfile_LIN); \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_PYM.sqf b/addons/missileguidance/functions/fnc_attackProfile_PYM.sqf new file mode 100644 index 0000000000..db8c552f25 --- /dev/null +++ b/addons/missileguidance/functions/fnc_attackProfile_PYM.sqf @@ -0,0 +1,28 @@ +#define DEBUG_MODE_FULL +#include "script_component.hpp" + +EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +private["_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams", "_targetPos", "_projectilePos"]; + +_seekerTargetPos = _this select 0; +_launchParams = _this select 1; + +_target = _launchParams select 0; +_targetLaunchParams = _launchParams select 1; + +_shooterPos = getPosASL _shooter; +_projectilePos = getPosASL _projectile; + +_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; +_distanceToShooter = _projectilePos vectorDistance _shooterPos; + +_addHeight = [0,0,_distanceToTarget]; + +_seekerTargetPos = _seekerTargetPos vectorAdd _addHeight; + +#ifdef DEBUG_MODE_FULL +drawLine3D [(ASLtoATL _seekerTargetPos) vectorAdd _addHeight, ASLtoATL _seekerTargetPos, [0,1,0,1]]; +#endif + +TRACE_1("Adjusted target position", _seekerTargetPos); +_seekerTargetPos; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_TOP.sqf b/addons/missileguidance/functions/fnc_attackProfile_TOP.sqf new file mode 100644 index 0000000000..e4776adcdf --- /dev/null +++ b/addons/missileguidance/functions/fnc_attackProfile_TOP.sqf @@ -0,0 +1,4 @@ +#define DEBUG_MODE_FULL +#include "script_component.hpp" + +_this call FUNC(attackProfile_LIN); \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_doAttackProfile.sqf b/addons/missileguidance/functions/fnc_doAttackProfile.sqf index ed9dd2cb20..1ed14fa21f 100644 --- a/addons/missileguidance/functions/fnc_doAttackProfile.sqf +++ b/addons/missileguidance/functions/fnc_doAttackProfile.sqf @@ -24,8 +24,7 @@ for [{_i=0}, {_i< (count _attackProfilesCfg) }, {_i=_i+1}] do { _attackProfilePos = [0,0,0]; if(!isNil "_attackProfile") then { - _attackProfileExecCode = "_this call " + getText (_attackProfile >> "functionName"); - _attackProfilePos = call compile _attackProfileExecCode; + _attackProfilePos = _this call (missionNamespace getVariable (getText (_attackProfile >> "functionName"))); }; _attackProfilePos; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_doSeekerSearch.sqf b/addons/missileguidance/functions/fnc_doSeekerSearch.sqf index fcba51d986..6502dd724b 100644 --- a/addons/missileguidance/functions/fnc_doSeekerSearch.sqf +++ b/addons/missileguidance/functions/fnc_doSeekerSearch.sqf @@ -24,8 +24,7 @@ for [{_i=0}, {_i< (count _seekerTypesCfg) }, {_i=_i+1}] do { _seekerProfilePos = [0,0,0]; if(!isNil "_seekerType") then { - _seekerProfileExecCode = "_this call " + getText (_seekerType >> "functionName"); - _seekerProfilePos = call compile _seekerProfileExecCode; + _seekerProfilePos = _this call (missionNamespace getVariable (getText (_seekerType >> "functionName"))); }; _seekerProfilePos; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_seekerType_SALH.sqf b/addons/missileguidance/functions/fnc_seekerType_SALH.sqf index 7fa23d028e..f4d36285d8 100644 --- a/addons/missileguidance/functions/fnc_seekerType_SALH.sqf +++ b/addons/missileguidance/functions/fnc_seekerType_SALH.sqf @@ -1,4 +1,4 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); From 97febd620767c7d2afc7e5227aa13931e53ccd6b Mon Sep 17 00:00:00 2001 From: jaynus Date: Wed, 8 Apr 2015 14:31:44 -0700 Subject: [PATCH 19/76] Disable debug, wtf math --- addons/missileguidance/CfgAmmo.hpp | 4 ++-- addons/missileguidance/XEH_pre_init.sqf | 2 +- .../functions/fnc_attackProfile_LIN.sqf | 4 ++-- .../functions/fnc_attackProfile_PYM.sqf | 10 +++++++--- .../missileguidance/functions/fnc_doAttackProfile.sqf | 2 +- .../missileguidance/functions/fnc_doSeekerSearch.sqf | 2 +- addons/missileguidance/functions/fnc_fired.sqf | 1 + addons/missileguidance/functions/fnc_guidancePFH.sqf | 2 +- 8 files changed, 16 insertions(+), 11 deletions(-) diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index e149a35b2f..91dbeb9e6d 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -54,8 +54,8 @@ class CfgAmmo { seekerMaxRange = 2500; // Range from the missile which the seeker can visually search // Attack profile type selection - defaultAttackProfile = "LIN"; - attackProfiles[] = { "LIN", "DIR", "MID", "HI", "TOP" }; + defaultAttackProfile = "PYM"; + attackProfiles[] = { "LIN", "DIR", "MID", "HI", "TOP", "PYM" }; }; }; diff --git a/addons/missileguidance/XEH_pre_init.sqf b/addons/missileguidance/XEH_pre_init.sqf index 34dd2eb9c9..a62776bfc2 100644 --- a/addons/missileguidance/XEH_pre_init.sqf +++ b/addons/missileguidance/XEH_pre_init.sqf @@ -18,7 +18,7 @@ PREP(attackProfile_DIR); PREP(attackProfile_MID); PREP(attackProfile_HI); PREP(attackProfile_TOP); - +PREP(attackprofile_PYM); // Seeker search functions PREP(seekerType_SALH); \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf index 375f65810c..6a05b8644b 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf @@ -13,8 +13,8 @@ _targetLaunchParams = _launchParams select 1; _shooterPos = getPosASL _shooter; _projectilePos = getPosASL _projectile; -_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; -_distanceToShooter = _projectilePos vectorDistance _shooterPos; +_distanceToTarget = _projectilePos distance _seekerTargetPos; +_distanceToShooter = _projectilePos distance _shooterPos; _addHeight = [0,0,(_projectilePos distance _seekerTargetPos)*0.02]; diff --git a/addons/missileguidance/functions/fnc_attackProfile_PYM.sqf b/addons/missileguidance/functions/fnc_attackProfile_PYM.sqf index db8c552f25..6241e93a04 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_PYM.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_PYM.sqf @@ -13,10 +13,14 @@ _targetLaunchParams = _launchParams select 1; _shooterPos = getPosASL _shooter; _projectilePos = getPosASL _projectile; -_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; -_distanceToShooter = _projectilePos vectorDistance _shooterPos; +_distanceToTarget = _projectilePos distance _seekerTargetPos; +_distanceToShooter = _projectilePos distance _shooterPos; -_addHeight = [0,0,_distanceToTarget]; +TRACE_2("", _distanceToTarget, _distanceToShooter); + +_addHeight = [0,0,(_projectilePos distance _seekerTargetPos)*0.02]; + +TRACE_1("", _addHeight); _seekerTargetPos = _seekerTargetPos vectorAdd _addHeight; diff --git a/addons/missileguidance/functions/fnc_doAttackProfile.sqf b/addons/missileguidance/functions/fnc_doAttackProfile.sqf index 1ed14fa21f..fa7c6f4f8b 100644 --- a/addons/missileguidance/functions/fnc_doAttackProfile.sqf +++ b/addons/missileguidance/functions/fnc_doAttackProfile.sqf @@ -1,4 +1,4 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); diff --git a/addons/missileguidance/functions/fnc_doSeekerSearch.sqf b/addons/missileguidance/functions/fnc_doSeekerSearch.sqf index 6502dd724b..1e43d83218 100644 --- a/addons/missileguidance/functions/fnc_doSeekerSearch.sqf +++ b/addons/missileguidance/functions/fnc_doSeekerSearch.sqf @@ -1,4 +1,4 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); diff --git a/addons/missileguidance/functions/fnc_fired.sqf b/addons/missileguidance/functions/fnc_fired.sqf index a8f552c48f..f8729418c4 100644 --- a/addons/missileguidance/functions/fnc_fired.sqf +++ b/addons/missileguidance/functions/fnc_fired.sqf @@ -20,6 +20,7 @@ if(isNil "_enabled" || {_enabled != 1}) exitWith { false }; _target = _shooter getVariable[QGVAR(target), nil]; _seekerType = _shooter getVariable [QGVAR(seekerType), nil]; _attackProfile = _shooter getVariable [QGVAR(attackProfile), nil]; +TRACE_3("Begin guidance", _target, _seekerType, _attackProfile); if ( isNil "_seekerType" || { ! ( _seekerType in (getArray (_config >> "seekerTypes" ) ) ) } ) then { _seekerType = getText (_config >> "defaultSeekerType"); diff --git a/addons/missileguidance/functions/fnc_guidancePFH.sqf b/addons/missileguidance/functions/fnc_guidancePFH.sqf index 8494fab49d..7f260631b8 100644 --- a/addons/missileguidance/functions/fnc_guidancePFH.sqf +++ b/addons/missileguidance/functions/fnc_guidancePFH.sqf @@ -1,4 +1,4 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" private["_args", "_launchParams", "_targetLaunchParams", "_config", "_flightParams", "_seekerParams"]; From c89df1b04f4743c0448aed2c49b680251bcb7a54 Mon Sep 17 00:00:00 2001 From: jaynus Date: Wed, 8 Apr 2015 14:51:19 -0700 Subject: [PATCH 20/76] Dir arc created. --- .../functions/fnc_attackProfile_DIR.sqf | 35 ++++++++++++++++++- .../functions/fnc_attackProfile_LIN.sqf | 23 +++++++----- .../functions/fnc_attackProfile_PYM.sqf | 25 +++++++------ .../missileguidance/functions/fnc_fired.sqf | 2 +- 4 files changed, 64 insertions(+), 21 deletions(-) diff --git a/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf b/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf index e4776adcdf..259289b44d 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf @@ -1,4 +1,37 @@ #define DEBUG_MODE_FULL #include "script_component.hpp" -_this call FUNC(attackProfile_LIN); \ No newline at end of file +EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"]; +private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos"]; +_seekerTargetPos = _this select 0; +_launchParams = _this select 1; + +_target = _launchParams select 0; +_targetLaunchParams = _launchParams select 1; + +_shooterPos = getPosASL _shooter; +_projectilePos = getPosASL _projectile; + +_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; +_distanceToShooter = _projectilePos vectorDistance _shooterPos; + +TRACE_2("", _distanceToTarget, _distanceToShooter); + +_addHeight = [0,0,0]; +if(_distanceToShooter < 100) then { + _addHeight = [0,0,_distanceToTarget]; +} else { + _addHeight = [0,0, _distanceToTarget*0.02]; +}; + +TRACE_3("", _distanceToTarget,_distanceToShooter,_addHeight); + +_returnTargetPos = _seekerTargetPos vectorAdd _addHeight; + +#ifdef DEBUG_MODE_FULL +drawLine3D [(ASLtoATL _returnTargetPos) vectorAdd _addHeight, ASLtoATL _returnTargetPos, [0,1,0,1]]; +#endif + +TRACE_1("Adjusted target position", _returnTargetPos); +_returnTargetPos; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf index 6a05b8644b..2b968cf87c 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf @@ -2,8 +2,8 @@ #include "script_component.hpp" EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -private["_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams", "_targetPos", "_projectilePos"]; - +private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"]; +private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos"]; _seekerTargetPos = _this select 0; _launchParams = _this select 1; @@ -13,16 +13,21 @@ _targetLaunchParams = _launchParams select 1; _shooterPos = getPosASL _shooter; _projectilePos = getPosASL _projectile; -_distanceToTarget = _projectilePos distance _seekerTargetPos; -_distanceToShooter = _projectilePos distance _shooterPos; +_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; +_distanceToShooter = _projectilePos vectorDistance _shooterPos; -_addHeight = [0,0,(_projectilePos distance _seekerTargetPos)*0.02]; +TRACE_2("", _distanceToTarget, _distanceToShooter); -_seekerTargetPos = _seekerTargetPos vectorAdd _addHeight; +//_addHeight = [0,0,0]; +_addHeight = [0,0, _distanceToTarget*0.02]; + +TRACE_3("", _distanceToTarget, _distanceToShooter, _addHeight); + +_returnTargetPos = _seekerTargetPos vectorAdd _addHeight; #ifdef DEBUG_MODE_FULL -drawLine3D [(ASLtoATL _seekerTargetPos) vectorAdd _addHeight, ASLtoATL _seekerTargetPos, [0,1,0,1]]; +drawLine3D [(ASLtoATL _returnTargetPos) vectorAdd _addHeight, ASLtoATL _returnTargetPos, [0,1,0,1]]; #endif -TRACE_1("Adjusted target position", _seekerTargetPos); -_seekerTargetPos; \ No newline at end of file +TRACE_1("Adjusted target position", _returnTargetPos); +_returnTargetPos; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_PYM.sqf b/addons/missileguidance/functions/fnc_attackProfile_PYM.sqf index 6241e93a04..259289b44d 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_PYM.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_PYM.sqf @@ -2,8 +2,8 @@ #include "script_component.hpp" EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -private["_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams", "_targetPos", "_projectilePos"]; - +private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"]; +private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos"]; _seekerTargetPos = _this select 0; _launchParams = _this select 1; @@ -13,20 +13,25 @@ _targetLaunchParams = _launchParams select 1; _shooterPos = getPosASL _shooter; _projectilePos = getPosASL _projectile; -_distanceToTarget = _projectilePos distance _seekerTargetPos; -_distanceToShooter = _projectilePos distance _shooterPos; +_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; +_distanceToShooter = _projectilePos vectorDistance _shooterPos; TRACE_2("", _distanceToTarget, _distanceToShooter); -_addHeight = [0,0,(_projectilePos distance _seekerTargetPos)*0.02]; +_addHeight = [0,0,0]; +if(_distanceToShooter < 100) then { + _addHeight = [0,0,_distanceToTarget]; +} else { + _addHeight = [0,0, _distanceToTarget*0.02]; +}; -TRACE_1("", _addHeight); +TRACE_3("", _distanceToTarget,_distanceToShooter,_addHeight); -_seekerTargetPos = _seekerTargetPos vectorAdd _addHeight; +_returnTargetPos = _seekerTargetPos vectorAdd _addHeight; #ifdef DEBUG_MODE_FULL -drawLine3D [(ASLtoATL _seekerTargetPos) vectorAdd _addHeight, ASLtoATL _seekerTargetPos, [0,1,0,1]]; +drawLine3D [(ASLtoATL _returnTargetPos) vectorAdd _addHeight, ASLtoATL _returnTargetPos, [0,1,0,1]]; #endif -TRACE_1("Adjusted target position", _seekerTargetPos); -_seekerTargetPos; \ No newline at end of file +TRACE_1("Adjusted target position", _returnTargetPos); +_returnTargetPos; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_fired.sqf b/addons/missileguidance/functions/fnc_fired.sqf index f8729418c4..e7c2289e34 100644 --- a/addons/missileguidance/functions/fnc_fired.sqf +++ b/addons/missileguidance/functions/fnc_fired.sqf @@ -30,7 +30,7 @@ if ( isNil "_attackProfile" || { ! ( _attackProfile in (getArray (_config >> "at }; TRACE_4("Beginning ACE guidance system",_target,_ammo,_seekerType,_attackProfile); -[FUNC(guidancePFH), 0.1, [_this, +[FUNC(guidancePFH), 0, [_this, [ACE_player, [_target, _targetPos, _launchPos], _seekerType, From 97230c22529f51a0e837f55ed2892508be48c71f Mon Sep 17 00:00:00 2001 From: jaynus Date: Wed, 8 Apr 2015 15:34:59 -0700 Subject: [PATCH 21/76] compensate for FPS lag. --- addons/missileguidance/functions/fnc_fired.sqf | 3 ++- .../missileguidance/functions/fnc_guidancePFH.sqf | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/addons/missileguidance/functions/fnc_fired.sqf b/addons/missileguidance/functions/fnc_fired.sqf index e7c2289e34..a7660c6a6f 100644 --- a/addons/missileguidance/functions/fnc_fired.sqf +++ b/addons/missileguidance/functions/fnc_fired.sqf @@ -45,6 +45,7 @@ TRACE_4("Beginning ACE guidance system",_target,_ammo,_seekerType,_attackProfile getNumber ( _config >> "seekerAngle" ), getNumber ( _config >> "seekerAccuracy" ), getNumber ( _config >> "seekerMaxRange" ) - ] + ], + [ diag_tickTime ] ] ] call cba_fnc_addPerFrameHandler; diff --git a/addons/missileguidance/functions/fnc_guidancePFH.sqf b/addons/missileguidance/functions/fnc_guidancePFH.sqf index 7f260631b8..7baeb9414b 100644 --- a/addons/missileguidance/functions/fnc_guidancePFH.sqf +++ b/addons/missileguidance/functions/fnc_guidancePFH.sqf @@ -10,6 +10,11 @@ _targetLaunchParams = _launchParams select 1; _flightParams = _args select 2; _seekerParams = _args select 3; +_stateParams = _args select 4; + +_lastRunTime = _stateParams select 0; +_runtimeDelta = diag_tickTime - _lastRunTime; + _config = configFile >> "CfgAmmo" >> _ammo >> "ACE_MissileGuidance"; if(!alive _projectile || isNull _projectile || isNull _shooter) exitWith { @@ -60,7 +65,10 @@ if(!isNil "_seekerTargetPos") then { #endif if(accTime > 0) then { - _outVector = [_projectile, [_xVec, _yVec, _zVec], [_yaw, 1/accTime, _pitch]] call FUNC(translateToModelSpace); + _adjustTime = 1/accTime; + _adjustTime = _adjustTime * (.01/_runtimeDelta); + + _outVector = [_projectile, [_xVec, _yVec, _zVec], [_yaw, _adjustTime, _pitch]] call FUNC(translateToModelSpace); _vectorTo = _projectilePos vectorFromTo _outVector; _projectile setVectorDirAndUp [_vectorTo, vectorUp _projectile]; @@ -70,3 +78,8 @@ if(!isNil "_seekerTargetPos") then { hintSilent format["d: %1", _distanceToTarget]; #endif }; + +_stateParams set[0, [diag_tickTime]]; + +_args set[4, _stateParams]; +_this set[0, _args]; \ No newline at end of file From 0a1aae855347a1895523ab8dfd04c2a9b94e36a2 Mon Sep 17 00:00:00 2001 From: jaynus Date: Wed, 8 Apr 2015 15:41:26 -0700 Subject: [PATCH 22/76] Work save, timing correction. --- addons/missileguidance/CfgAmmo.hpp | 9 ++++++--- addons/missileguidance/functions/fnc_fired.sqf | 2 +- addons/missileguidance/functions/fnc_guidancePFH.sqf | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index 91dbeb9e6d..00b6cd20cf 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -42,9 +42,12 @@ class CfgAmmo { class ACE_MissileGuidance { enabled = 1; - minDeflection = 0.005; // Minium flap deflection for guidance - maxDeflection = 0.025; // Maximum flap deflection for guidance - incDeflection = 0.005; // The incrmeent in which deflection adjusts. + //minDeflection = 0.005; // Minium flap deflection for guidance + //maxDeflection = 0.025; // Maximum flap deflection for guidance + //incDeflection = 0.005; // The incrmeent in which deflection adjusts. + minDeflection = 0.005; + maxDeflection = 0.5; + incDeflection = 0.005; // Guidance type for munitions defaultSeekerType = "SALH"; diff --git a/addons/missileguidance/functions/fnc_fired.sqf b/addons/missileguidance/functions/fnc_fired.sqf index a7660c6a6f..a79007ccc9 100644 --- a/addons/missileguidance/functions/fnc_fired.sqf +++ b/addons/missileguidance/functions/fnc_fired.sqf @@ -30,7 +30,7 @@ if ( isNil "_attackProfile" || { ! ( _attackProfile in (getArray (_config >> "at }; TRACE_4("Beginning ACE guidance system",_target,_ammo,_seekerType,_attackProfile); -[FUNC(guidancePFH), 0, [_this, +[FUNC(guidancePFH), 0.1, [_this, [ACE_player, [_target, _targetPos, _launchPos], _seekerType, diff --git a/addons/missileguidance/functions/fnc_guidancePFH.sqf b/addons/missileguidance/functions/fnc_guidancePFH.sqf index 7baeb9414b..bc4b1000f1 100644 --- a/addons/missileguidance/functions/fnc_guidancePFH.sqf +++ b/addons/missileguidance/functions/fnc_guidancePFH.sqf @@ -66,7 +66,7 @@ if(!isNil "_seekerTargetPos") then { if(accTime > 0) then { _adjustTime = 1/accTime; - _adjustTime = _adjustTime * (.01/_runtimeDelta); + _adjustTime = _adjustTime * (_runtimeDelta / 0.1); _outVector = [_projectile, [_xVec, _yVec, _zVec], [_yaw, _adjustTime, _pitch]] call FUNC(translateToModelSpace); _vectorTo = _projectilePos vectorFromTo _outVector; @@ -79,7 +79,7 @@ if(!isNil "_seekerTargetPos") then { #endif }; -_stateParams set[0, [diag_tickTime]]; +_stateParams set[0, diag_tickTime]; _args set[4, _stateParams]; _this set[0, _args]; \ No newline at end of file From 5a9a8d239cb966ccf695bdecd8b745600e7e7577 Mon Sep 17 00:00:00 2001 From: jaynus Date: Wed, 8 Apr 2015 15:52:58 -0700 Subject: [PATCH 23/76] Remove test parameters, timing correct. Attack profile selection working. --- addons/missileguidance/CfgAmmo.hpp | 12 ++++++------ addons/missileguidance/functions/fnc_fired.sqf | 7 +++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index 00b6cd20cf..2c642e430a 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -42,12 +42,12 @@ class CfgAmmo { class ACE_MissileGuidance { enabled = 1; - //minDeflection = 0.005; // Minium flap deflection for guidance - //maxDeflection = 0.025; // Maximum flap deflection for guidance - //incDeflection = 0.005; // The incrmeent in which deflection adjusts. - minDeflection = 0.005; - maxDeflection = 0.5; - incDeflection = 0.005; + minDeflection = 0.005; // Minium flap deflection for guidance + maxDeflection = 0.025; // Maximum flap deflection for guidance + incDeflection = 0.005; // The incrmeent in which deflection adjusts. + //minDeflection = 0.005; + //maxDeflection = 0.5; + //incDeflection = 0.005; // Guidance type for munitions defaultSeekerType = "SALH"; diff --git a/addons/missileguidance/functions/fnc_fired.sqf b/addons/missileguidance/functions/fnc_fired.sqf index a79007ccc9..ce511f671e 100644 --- a/addons/missileguidance/functions/fnc_fired.sqf +++ b/addons/missileguidance/functions/fnc_fired.sqf @@ -16,10 +16,9 @@ _enabled = getNumber ( _config >> "enabled"); // Bail if guidance is not enabled if(isNil "_enabled" || {_enabled != 1}) exitWith { false }; - -_target = _shooter getVariable[QGVAR(target), nil]; -_seekerType = _shooter getVariable [QGVAR(seekerType), nil]; -_attackProfile = _shooter getVariable [QGVAR(attackProfile), nil]; +_target = (vehicle _shooter) getVariable [QGVAR(target), nil]; +_seekerType = (vehicle _shooter) getVariable [QGVAR(seekerType), nil]; +_attackProfile = (vehicle _shooter) getVariable [QGVAR(attackProfile), nil]; TRACE_3("Begin guidance", _target, _seekerType, _attackProfile); if ( isNil "_seekerType" || { ! ( _seekerType in (getArray (_config >> "seekerTypes" ) ) ) } ) then { From bbfd28586b0caa0ac0f232562c66a5ca0d88c219 Mon Sep 17 00:00:00 2001 From: jaynus Date: Wed, 8 Apr 2015 19:51:21 -0700 Subject: [PATCH 24/76] Apply ace_missileguidance to Titan. (Direct only) This is testing the extensible framework for mod makers. --- addons/missileguidance/ACE_GuidanceConfig.hpp | 7 + addons/missileguidance/CfgAmmo.hpp | 52 +++- addons/missileguidance/CfgEventhandlers.hpp | 4 +- addons/missileguidance/XEH_post_init.sqf | 1 - addons/missileguidance/XEH_pre_init.sqf | 3 +- .../functions/fnc_attackProfile_LIN.sqf | 2 +- .../missileguidance/functions/fnc_fired.sqf | 14 +- .../functions/fnc_seekerType_Optic.sqf | 24 ++ addons/wep_javelin/CfgEventhandlers.hpp | 6 - addons/wep_javelin/XEH_pre_init.sqf | 2 - addons/wep_javelin/config.cpp | 2 +- .../functions/fnc_cycleFireMode.sqf | 8 +- addons/wep_javelin/functions/fnc_fired.sqf | 285 ------------------ .../wep_javelin/functions/fnc_onOpticDraw.sqf | 7 +- 14 files changed, 107 insertions(+), 310 deletions(-) create mode 100644 addons/missileguidance/functions/fnc_seekerType_Optic.sqf delete mode 100644 addons/wep_javelin/functions/fnc_fired.sqf diff --git a/addons/missileguidance/ACE_GuidanceConfig.hpp b/addons/missileguidance/ACE_GuidanceConfig.hpp index 2f68140219..4c0122c8e4 100644 --- a/addons/missileguidance/ACE_GuidanceConfig.hpp +++ b/addons/missileguidance/ACE_GuidanceConfig.hpp @@ -51,4 +51,11 @@ class GVAR(SeekerTypes) { functionName = QFUNC(seekerType_SALH); }; + class Optic { + name = ""; + visualName = ""; + description = ""; + + functionName = QFUNC(seekerType_Optic); + }; }; diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index 2c642e430a..686d940e69 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -1,3 +1,8 @@ +enum { + ACE_LOBL = 1, + ACE_LOAL = 2 +}; + class CfgAmmo { class MissileBase; @@ -51,7 +56,11 @@ class CfgAmmo { // Guidance type for munitions defaultSeekerType = "SALH"; - seekerTypes[] = { "SALH", "LIDAR", "SARH", "Optic", "Thermal", "GPS", "SACLOS", "MCLOS" }; + seekerTypes[] = { "SALH", "LIDAR", "SARH", "Optic", "Thermal", "GPS", "SACLOS", "MCLOS" }; + + defaultSeekerLockMode = "LOAL"; + seekerLockModes[] = { "LOAL", "LOBL" }; + seekerAngle = 90; // Angle in front of the missile which can be searched seekerAccuracy = 1; // seeker accuracy multiplier seekerMaxRange = 2500; // Range from the missile which the seeker can visually search @@ -78,4 +87,45 @@ class CfgAmmo { indirectHitRange = 4.5; effectsMissile = "missile2"; }; + + // Titan + class M_Titan_AT : MissileBase { + irLock = 0; + laserLock = 0; + airLock = 0; + + // Turn off arma crosshair-guidance + manualControl = 0; + + // ACE uses these values + trackOversteer = 1; + trackLead = 0; + + // Begin ACE guidance Configs + class ACE_MissileGuidance { + enabled = 1; + + minDeflection = 0.005; // Minium flap deflection for guidance + maxDeflection = 0.25; // Maximum flap deflection for guidance + incDeflection = 0.005; // The incrmeent in which deflection adjusts. + //minDeflection = 0.005; + //maxDeflection = 0.5; + //incDeflection = 0.005; + + // Guidance type for munitions + defaultSeekerType = "Optic"; + seekerTypes[] = { "Optic" }; + + defaultSeekerLockMode = "LOBL"; + seekerLockModes[] = { "LOBL" }; + + seekerAngle = 90; // Angle in front of the missile which can be searched + seekerAccuracy = 1; // seeker accuracy multiplier + seekerMaxRange = 2500; // Range from the missile which the seeker can visually search + + // Attack profile type selection + defaultAttackProfile = "TOP"; + attackProfiles[] = { "TOP" }; + }; + }; }; \ No newline at end of file diff --git a/addons/missileguidance/CfgEventhandlers.hpp b/addons/missileguidance/CfgEventhandlers.hpp index 2775490d11..49f067ff46 100644 --- a/addons/missileguidance/CfgEventhandlers.hpp +++ b/addons/missileguidance/CfgEventhandlers.hpp @@ -5,13 +5,13 @@ class Extended_PreInit_EventHandlers { }; class Extended_PostInit_EventHandlers { - class ADDON { + class ADDON { init = QUOTE(call COMPILE_FILE(XEH_post_init)); }; }; class Extended_FiredBIS_EventHandlers { - class AllVehicles { + class All { ADDON = QUOTE(_this call FUNC(fired)); }; }; \ No newline at end of file diff --git a/addons/missileguidance/XEH_post_init.sqf b/addons/missileguidance/XEH_post_init.sqf index 6904ee6c47..dc30361926 100644 --- a/addons/missileguidance/XEH_post_init.sqf +++ b/addons/missileguidance/XEH_post_init.sqf @@ -1,3 +1,2 @@ #include "script_component.hpp" -NO_DEDICATED; diff --git a/addons/missileguidance/XEH_pre_init.sqf b/addons/missileguidance/XEH_pre_init.sqf index a62776bfc2..c58e1679a4 100644 --- a/addons/missileguidance/XEH_pre_init.sqf +++ b/addons/missileguidance/XEH_pre_init.sqf @@ -21,4 +21,5 @@ PREP(attackProfile_TOP); PREP(attackprofile_PYM); // Seeker search functions -PREP(seekerType_SALH); \ No newline at end of file +PREP(seekerType_SALH); +PREP(seekerType_Optic); \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf index 2b968cf87c..8b47847347 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf @@ -1,4 +1,4 @@ -//#define DEBUG_MODE_FULL +#define DEBUG_MODE_FULL #include "script_component.hpp" EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); diff --git a/addons/missileguidance/functions/fnc_fired.sqf b/addons/missileguidance/functions/fnc_fired.sqf index ce511f671e..9c0e3e63a2 100644 --- a/addons/missileguidance/functions/fnc_fired.sqf +++ b/addons/missileguidance/functions/fnc_fired.sqf @@ -10,6 +10,9 @@ if(!local _projectile) exitWith { false }; private["_config", "_enabled", "_target", "_seekerType", "_attackProfile"]; PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +// Bail on not missile +if(! (_ammo isKindOf "MissileBase") ) exitWith { false }; + _config = configFile >> "CfgAmmo" >> _ammo >> "ACE_MissileGuidance"; _enabled = getNumber ( _config >> "enabled"); @@ -19,6 +22,8 @@ if(isNil "_enabled" || {_enabled != 1}) exitWith { false }; _target = (vehicle _shooter) getVariable [QGVAR(target), nil]; _seekerType = (vehicle _shooter) getVariable [QGVAR(seekerType), nil]; _attackProfile = (vehicle _shooter) getVariable [QGVAR(attackProfile), nil]; +_lockMode = (vehicle _shooter) getVariable [QGVAR(lockMode), nil]; + TRACE_3("Begin guidance", _target, _seekerType, _attackProfile); if ( isNil "_seekerType" || { ! ( _seekerType in (getArray (_config >> "seekerTypes" ) ) ) } ) then { @@ -26,14 +31,19 @@ if ( isNil "_seekerType" || { ! ( _seekerType in (getArray (_config >> "seekerTy }; if ( isNil "_attackProfile" || { ! ( _attackProfile in (getArray (_config >> "attackProfiles" ) ) ) } ) then { _attackProfile = getText (_config >> "defaultAttackProfile"); -}; +}; +if ( isNil "_lockMode" || { ! ( _lockMode in (getArray (_config >> "seekerLockModes" ) ) ) } ) then { + _lockMode = getText (_config >> "defaultSeekerLockMode"); +}; + TRACE_4("Beginning ACE guidance system",_target,_ammo,_seekerType,_attackProfile); [FUNC(guidancePFH), 0.1, [_this, [ACE_player, [_target, _targetPos, _launchPos], _seekerType, - _attackProfile + _attackProfile, + _lockMode ], [ getNumber ( _config >> "minDeflection" ), diff --git a/addons/missileguidance/functions/fnc_seekerType_Optic.sqf b/addons/missileguidance/functions/fnc_seekerType_Optic.sqf new file mode 100644 index 0000000000..05b922ceba --- /dev/null +++ b/addons/missileguidance/functions/fnc_seekerType_Optic.sqf @@ -0,0 +1,24 @@ +#define DEBUG_MODE_FULL +#include "script_component.hpp" + +EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +private["_targets", "_foundTargetPos", "_launchParams", "_seekerParams", "_targetLaunchParams"]; + +_seekerTargetPos = _this select 0; + +_launchParams = _this select 1; +_target = (((_launchParams select 1) select 1) select 0); +_seekerParams = _launchParams select 3; + +TRACE_1("", _this); +TRACE_1("", _launchParams); + +// TODO:: Make sure the missile maintains LOS +_foundTargetPos = [0,0,0]; +if(!isNil "_target") then { + _foundTargetPos = getPosASL (_target); +}; + +TRACE_2("", _target, _foundTargetPos); + +_foundTargetPos; \ No newline at end of file diff --git a/addons/wep_javelin/CfgEventhandlers.hpp b/addons/wep_javelin/CfgEventhandlers.hpp index a61ea9c746..2c44a05e3a 100644 --- a/addons/wep_javelin/CfgEventhandlers.hpp +++ b/addons/wep_javelin/CfgEventhandlers.hpp @@ -9,10 +9,4 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_post_init)); clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit)); }; -}; - -class Extended_FiredBIS_EventHandlers { - class CAManBase { - ADDON = QUOTE(_this call FUNC(fired)); - }; }; \ No newline at end of file diff --git a/addons/wep_javelin/XEH_pre_init.sqf b/addons/wep_javelin/XEH_pre_init.sqf index 1b6682f0fc..a860302d94 100644 --- a/addons/wep_javelin/XEH_pre_init.sqf +++ b/addons/wep_javelin/XEH_pre_init.sqf @@ -1,7 +1,5 @@ #include "script_component.hpp" -PREP(fired); - PREP(translateToWeaponSpace); PREP(translateToModelSpace); diff --git a/addons/wep_javelin/config.cpp b/addons/wep_javelin/config.cpp index 3cc607f0bd..0a38583ed9 100644 --- a/addons/wep_javelin/config.cpp +++ b/addons/wep_javelin/config.cpp @@ -5,7 +5,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = { "ace_main", "ace_common", "ace_laser" }; + requiredAddons[] = { "ace_main", "ace_common", "ace_missileguidance" }; VERSION_CONFIG; }; }; diff --git a/addons/wep_javelin/functions/fnc_cycleFireMode.sqf b/addons/wep_javelin/functions/fnc_cycleFireMode.sqf index a095ab0cb4..e3a1090987 100644 --- a/addons/wep_javelin/functions/fnc_cycleFireMode.sqf +++ b/addons/wep_javelin/functions/fnc_cycleFireMode.sqf @@ -4,14 +4,14 @@ TRACE_1("enter", _this); private["_player", "_currentFireMode"]; -_currentFireMode = ACE_player getVariable["ace_missileguidance_attackProfile", ACE_JAV_FIREMODE_TOP]; -if(_currentFireMode == ACE_JAV_FIREMODE_DIR) then { - _currentFireMode = ACE_JAV_FIREMODE_TOP; +_currentFireMode = ACE_player getVariable["ace_missileguidance_attackProfile", "TOP"]; +if(_currentFireMode == "DIR") then { + _currentFireMode = "TOP"; __JavelinIGUITop ctrlSetTextColor __ColorGreen; __JavelinIGUIDir ctrlSetTextColor __ColorGray; } else { - _currentFireMode = ACE_JAV_FIREMODE_DIR; + _currentFireMode = "DIR"; __JavelinIGUITop ctrlSetTextColor __ColorGray; __JavelinIGUIDir ctrlSetTextColor __ColorGreen; diff --git a/addons/wep_javelin/functions/fnc_fired.sqf b/addons/wep_javelin/functions/fnc_fired.sqf deleted file mode 100644 index fc5d56f432..0000000000 --- a/addons/wep_javelin/functions/fnc_fired.sqf +++ /dev/null @@ -1,285 +0,0 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" -//_this=[TEST_AI_HELICOPTER,"missiles_DAGR","missiles_DAGR","Far_AI","M_PG_AT","24Rnd_PG_missiles",163988: rocket_01_fly_f.p3d] -TRACE_1("Launch", _this); -PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); - -FUNC(guidance_Javelin_LOBL_DIR_PFH) = { - TRACE_1("enter", _this); - private["_pitch", "_yaw", "_wentTerminal", "_target", "_targetPos", "_curVelocity", "_missile", - "_launchPos", "_targetStartPos", "_defPitch", "_defYaw"]; - _args = _this select 0; - //PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); - _shooter = _args select 0; - _missile = _args select 6; - - if((count _args) > 7) then { - _saveArgs = _args select 7; - _target = _saveArgs select 0; - _targetStartPos = _saveArgs select 1; - _launchPos = _saveArgs select 2; - _wentTerminal = _saveArgs select 3; - } else { - _wentTerminal = false; - _launchPos = getPosASL _shooter; - _target = ACE_player getVariable[QGVAR(currentTarget), objNull]; - _targetStartPos = ACE_player getVariable[QGVAR(currentTargetPos), [0,0,0]]; - }; - - if(!alive _missile || isNull _missile || isNull _target) exitWith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; - }; - - _targetPos = getPosASL _target; - _curVelocity = velocity _missile; - - TRACE_4("", _target, _targetPos, _launchPos, _targetStartPos); - - _addHeight = [0,0,0]; - if(!isNil "_target") then { - - _yVec = vectorDir _missile; - _zVec = vectorUp _missile; - _xVec = vectorNormalized (_yVec vectorCrossProduct _zVec); - - _missilePos = getPosASL _missile; - // player sideChat "G!"; - - TRACE_4("Phase Check", _launchPos, _missilePos, _targetPos, (_missilePos distance _targetPos)); - if((count _targetPos) > 0) then { - _distanceToTarget = [(_missilePos select 0), (_missilePos select 1), (_targetPos select 2)] vectorDistance _targetPos; - - if( (_missilePos select 2) < (_targetPos select 2) + 60 && !_wentTerminal) then { - _addHeight = [0,0,(_targetPos select 2) + 120]; - - _defPitch = 0.15; - _defYaw = 0.035; - - TRACE_1("Climb phase", _addHeight); - } else { - _wentTerminal = true; - _this set[2, _wentTerminal]; - - _defPitch = 0.15; - _defYaw = 0.035; - - TRACE_1("TERMINAL", ""); - }; - _targetPos = _targetPos vectorAdd _addHeight; - - _targetVectorSeeker = [_missile, [_xVec, _yVec, _zVec], _targetPos] call FUNC(translateToWeaponSpace); - TRACE_5("", _missile, _xVec, _yVec, _zVec, _targetPos); - - _yaw = 0.0; - _pitch = 0.0; - - if((_targetVectorSeeker select 0) < 0) then { - _yaw = -_defYaw; - } else { - if((_targetVectorSeeker select 0) > 0) then { - _yaw = _defYaw; - }; - }; - - if((_targetVectorSeeker select 2) < 0) then { - _pitch = -_defPitch; - } else { - if((_targetVectorSeeker select 2) > 0) then { - _pitch = _defPitch; - }; - }; - - TRACE_3("", _targetVectorSeeker, _pitch, _yaw); - - #ifdef DEBUG_MODE_FULL - drawLine3D [(ASLtoATL _targetPos) vectorAdd _addHeight, ASLtoATL _targetPos, [0,1,0,1]]; - - _light = "#lightpoint" createVehicleLocal (getPos _missile); - _light setLightBrightness 1.0; - _light setLightAmbient [1.0, 0.0, 0.0]; - _light setLightColor [1.0, 0.0, 0.0]; - - drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,1,1,1], ASLtoATL _missilePos, 0.75, 0.75, 0, str _vectorTo, 1, 0.025, "TahomaB"]; - drawLine3D [ASLtoATL _missilePos, ASLtoATL _targetPos, [1,0,0,1]]; - - MARKERCOUNT = MARKERCOUNT + 1; - #endif - - if(accTime > 0) then { - TRACE_5("", _xVec, _yVec, _zVec, _yaw, _pitch); - _outVector = [_missile, [_xVec, _yVec, _zVec], [_yaw, 1/accTime, _pitch]] call FUNC(translateToModelSpace); - - _vectorTo = _missilePos vectorFromTo _outVector; - TRACE_3("", _missile, _outVector, _vectorTo); - _missile setVectorDirAndUp [_vectorTo, vectorUp _missile]; - }; - - #ifdef DEBUG_MODE_FULL - hintSilent format["d: %1", _distanceToTarget]; - #endif - }; - }; - - _saveArgs = [_target,_targetStartPos, _launchPos, _wentTerminal]; - _args set[7, _saveArgs ]; - _this set[0, _args]; -}; - -FUNC(guidance_Javelin_LOBL_TOP_PFH) = { - TRACE_1("enter", _this); - private["_pitch", "_yaw", "_wentTerminal", "_target", "_targetPos", "_curVelocity", "_missile", - "_launchPos", "_targetStartPos", "_defPitch", "_defYaw"]; - _args = _this select 0; - //PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); - _shooter = _args select 0; - _missile = _args select 6; - - if((count _args) > 7) then { - _saveArgs = _args select 7; - _target = _saveArgs select 0; - _targetStartPos = _saveArgs select 1; - _launchPos = _saveArgs select 2; - _wentTerminal = _saveArgs select 3; - } else { - _wentTerminal = false; - _launchPos = getPosASL _shooter; - _target = ACE_player getVariable[QGVAR(currentTarget), objNull]; - _targetStartPos = ACE_player getVariable[QGVAR(currentTargetPos), [0,0,0]]; - }; - - if(!alive _missile || isNull _missile || isNull _target) exitWith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; - }; - - _targetPos = getPosASL _target; - _curVelocity = velocity _missile; - - TRACE_4("", _target, _targetPos, _launchPos, _targetStartPos); - - _addHeight = [0,0,0]; - if(!isNil "_target") then { - - _yVec = vectorDir _missile; - _zVec = vectorUp _missile; - _xVec = vectorNormalized (_yVec vectorCrossProduct _zVec); - - _missilePos = getPosASL _missile; - // player sideChat "G!"; - - TRACE_4("Phase Check", _launchPos, _missilePos, _targetPos, (_missilePos distance _targetPos)); - if((count _targetPos) > 0) then { - _distanceToTarget = [(_missilePos select 0), (_missilePos select 1), (_targetPos select 2)] vectorDistance _targetPos; - - if( (_missilePos select 2) < (_targetPos select 2) + 200 && !_wentTerminal) then { - _addHeight = [0,0, ( (_distanceToTarget * 2) + 400)]; - - _defPitch = 0.25; - _defYaw = 0.035; - - TRACE_1("Climb phase", _addHeight); - } else { - _wentTerminal = true; - _this set[2, _wentTerminal]; - - _defPitch = 0.25; - _defYaw = 0.25; - - TRACE_1("TERMINAL", ""); - }; - _targetPos = _targetPos vectorAdd _addHeight; - - _targetVectorSeeker = [_missile, [_xVec, _yVec, _zVec], _targetPos] call FUNC(translateToWeaponSpace); - TRACE_5("", _missile, _xVec, _yVec, _zVec, _targetPos); - - _yaw = 0.0; - _pitch = 0.0; - - // Stop jinking on terminal final decent - if((_missilePos distance _targetPos) < 150) then { - _defPitch = 0.0015; - _defYaw = 0.0015; - }; - - if((_targetVectorSeeker select 0) < 0) then { - _yaw = -_defYaw; - } else { - if((_targetVectorSeeker select 0) > 0) then { - _yaw = _defYaw; - }; - }; - - if((_targetVectorSeeker select 2) < 0) then { - _pitch = -_defPitch; - } else { - if((_targetVectorSeeker select 2) > 0) then { - _pitch = _defPitch; - }; - }; - - TRACE_3("", _targetVectorSeeker, _pitch, _yaw); - - #ifdef DEBUG_MODE_FULL - drawLine3D [(ASLtoATL _targetPos) vectorAdd _addHeight, ASLtoATL _targetPos, [0,1,0,1]]; - - _light = "#lightpoint" createVehicleLocal (getPos _missile); - _light setLightBrightness 1.0; - _light setLightAmbient [1.0, 0.0, 0.0]; - _light setLightColor [1.0, 0.0, 0.0]; - - drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,1,1,1], ASLtoATL _missilePos, 0.75, 0.75, 0, str _vectorTo, 1, 0.025, "TahomaB"]; - drawLine3D [ASLtoATL _missilePos, ASLtoATL _targetPos, [1,0,0,1]]; - - MARKERCOUNT = MARKERCOUNT + 1; - #endif - - if(accTime > 0) then { - TRACE_5("", _xVec, _yVec, _zVec, _yaw, _pitch); - _outVector = [_missile, [_xVec, _yVec, _zVec], [_yaw, 1/accTime, _pitch]] call FUNC(translateToModelSpace); - - _vectorTo = _missilePos vectorFromTo _outVector; - TRACE_3("", _missile, _outVector, _vectorTo); - _missile setVectorDirAndUp [_vectorTo, vectorUp _missile]; - }; - - #ifdef DEBUG_MODE_FULL - hintSilent format["d: %1", _distanceToTarget]; - #endif - }; - }; - - _saveArgs = [_target,_targetStartPos, _launchPos, _wentTerminal]; - _args set[7, _saveArgs ]; - _this set[0, _args]; -}; - -FUNC(guidance_Javelin_LOBL_TOP) = { - PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); - - GVAR(lastTime) = time; - [FUNC(guidance_Javelin_LOBL_TOP_PFH), 0, _this] call cba_fnc_addPerFrameHandler; -}; - -FUNC(guidance_Javelin_LOBL_DIR) = { - PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); - - GVAR(lastTime) = time; - [FUNC(guidance_Javelin_LOBL_DIR_PFH), 0, _this] call cba_fnc_addPerFrameHandler; -}; - -if(!local _shooter) exitWith { false }; -if(_ammo == "M_Titan_AT") then { - _fireMode = _shooter getVariable ["ace_missileguidance_attackProfile", ACE_JAV_FIREMODE_TOP]; - - switch (_fireMode) do { - // Default to FIREMODE_DIRECT_LOAL - // FIREMODE_DIRECT_LOAL - case ACE_JAV_FIREMODE_DIR: { - LOG("Initiating Javelin FIREMODE_LOBL_DIR"); - _this call FUNC(guidance_Javelin_LOBL_DIR); - }; - default { - LOG("Initiating Javelin FIREMODE_LOBL_TOP"); - _this call FUNC(guidance_Javelin_LOBL_TOP); - }; - }; -}; \ No newline at end of file diff --git a/addons/wep_javelin/functions/fnc_onOpticDraw.sqf b/addons/wep_javelin/functions/fnc_onOpticDraw.sqf index 6a74b3ed57..afd882ea42 100644 --- a/addons/wep_javelin/functions/fnc_onOpticDraw.sqf +++ b/addons/wep_javelin/functions/fnc_onOpticDraw.sqf @@ -68,7 +68,7 @@ if (isNull _newTarget) then { __JavelinIGUITargetingGate ctrlShow false; __JavelinIGUITargetingLines ctrlShow false; - ACE_player setVariable [QGVAR(currentTarget),nil, 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];}; @@ -91,8 +91,7 @@ if (isNull _newTarget) then { __JavelinIGUINFOV ctrlSetTextColor __ColorNull; __JavelinIGUITargetingConstrains ctrlShow true; - ACE_player setVariable[QGVAR(currentTarget), _currentTarget, false]; - ACE_player setVariable[QGVAR(currentTargetPos), getPosASL _currentTarget, false]; + ACE_player setVariable["ace_missileguidance_target", _currentTarget, false]; if(diag_tickTime > _soundTime) then { playSound "ACE_Javelin_Locked"; @@ -115,7 +114,7 @@ if (isNull _newTarget) then { __JavelinIGUITargetingGate ctrlShow false; __JavelinIGUITargetingLines ctrlShow false; - ACE_player setVariable [QGVAR(currentTarget),nil, false]; + ACE_player setVariable ["ace_missileguidance_target",nil, false]; }; }; From fe147c4986ce38f280d2679fb2c0a96df4ba4440 Mon Sep 17 00:00:00 2001 From: jaynus Date: Thu, 9 Apr 2015 09:39:23 -0700 Subject: [PATCH 25/76] Config expansion. --- addons/missileguidance/CfgAmmo.hpp | 6 +++++- addons/wep_javelin/functions/fnc_cycleFireMode.sqf | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index 686d940e69..9fd77ea500 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -63,6 +63,8 @@ class CfgAmmo { seekerAngle = 90; // Angle in front of the missile which can be searched seekerAccuracy = 1; // seeker accuracy multiplier + + seekerMinRange = 1; seekerMaxRange = 2500; // Range from the missile which the seeker can visually search // Attack profile type selection @@ -121,11 +123,13 @@ class CfgAmmo { seekerAngle = 90; // Angle in front of the missile which can be searched seekerAccuracy = 1; // seeker accuracy multiplier + + seekerMinRange = 1; seekerMaxRange = 2500; // Range from the missile which the seeker can visually search // Attack profile type selection defaultAttackProfile = "TOP"; - attackProfiles[] = { "TOP" }; + attackProfiles[] = { "TOP", "LIN" }; }; }; }; \ No newline at end of file diff --git a/addons/wep_javelin/functions/fnc_cycleFireMode.sqf b/addons/wep_javelin/functions/fnc_cycleFireMode.sqf index e3a1090987..56b93a121a 100644 --- a/addons/wep_javelin/functions/fnc_cycleFireMode.sqf +++ b/addons/wep_javelin/functions/fnc_cycleFireMode.sqf @@ -5,13 +5,13 @@ TRACE_1("enter", _this); private["_player", "_currentFireMode"]; _currentFireMode = ACE_player getVariable["ace_missileguidance_attackProfile", "TOP"]; -if(_currentFireMode == "DIR") then { +if(_currentFireMode == "LIN") then { _currentFireMode = "TOP"; __JavelinIGUITop ctrlSetTextColor __ColorGreen; __JavelinIGUIDir ctrlSetTextColor __ColorGray; } else { - _currentFireMode = "DIR"; + _currentFireMode = "LIN"; __JavelinIGUITop ctrlSetTextColor __ColorGray; __JavelinIGUIDir ctrlSetTextColor __ColorGreen; From 198d4f3540f296f182499e7fd13ef606506ad114 Mon Sep 17 00:00:00 2001 From: jaynus Date: Thu, 9 Apr 2015 13:03:28 -0700 Subject: [PATCH 26/76] Fixed private variable overrides and timing failure. --- addons/missileguidance/CfgAmmo.hpp | 2 +- addons/missileguidance/functions/fnc_fired.sqf | 2 +- .../functions/fnc_guidancePFH.sqf | 18 ++++++++++++------ .../functions/fnc_seekerType_SALH.sqf | 2 +- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index 9fd77ea500..3ca6a2d5d0 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -68,7 +68,7 @@ class CfgAmmo { seekerMaxRange = 2500; // Range from the missile which the seeker can visually search // Attack profile type selection - defaultAttackProfile = "PYM"; + defaultAttackProfile = "LIN"; attackProfiles[] = { "LIN", "DIR", "MID", "HI", "TOP", "PYM" }; }; }; diff --git a/addons/missileguidance/functions/fnc_fired.sqf b/addons/missileguidance/functions/fnc_fired.sqf index 9c0e3e63a2..b82d179886 100644 --- a/addons/missileguidance/functions/fnc_fired.sqf +++ b/addons/missileguidance/functions/fnc_fired.sqf @@ -38,7 +38,7 @@ if ( isNil "_lockMode" || { ! ( _lockMode in (getArray (_config >> "seekerLockMo TRACE_4("Beginning ACE guidance system",_target,_ammo,_seekerType,_attackProfile); -[FUNC(guidancePFH), 0.1, [_this, +[FUNC(guidancePFH), 0, [_this, [ACE_player, [_target, _targetPos, _launchPos], _seekerType, diff --git a/addons/missileguidance/functions/fnc_guidancePFH.sqf b/addons/missileguidance/functions/fnc_guidancePFH.sqf index bc4b1000f1..6d4d643d78 100644 --- a/addons/missileguidance/functions/fnc_guidancePFH.sqf +++ b/addons/missileguidance/functions/fnc_guidancePFH.sqf @@ -1,7 +1,11 @@ -//#define DEBUG_MODE_FULL +#define DEBUG_MODE_FULL #include "script_component.hpp" -private["_args", "_launchParams", "_targetLaunchParams", "_config", "_flightParams", "_seekerParams"]; +private["_args", "_stateParams", "_launchParams", "_targetLaunchParams", "_config", "_flightParams", "_seekerParams", "_seekerTargetPos"]; +private["_lastRunTime", "_runtimeDelta", "_profileAdjustedTargetPos", "_targetVectorSeeker", "_targetVector"]; +private["_minDeflection", "_maxDeflection", "_incDeflection"]; +private["_yVec", "_zVec", "_xVec"]; + _args = _this select 0; EXPLODE_7_PVT((_args select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); @@ -26,11 +30,11 @@ _seekerTargetPos = [ [0,0,0], _args] call FUNC(doSeekerSearch); if(!isNil "_seekerTargetPos") then { _profileAdjustedTargetPos = [_seekerTargetPos,_args] call FUNC(doAttackProfile); - + _minDeflection = _flightParams select 0; _maxDeflection = _flightParams select 1; _incDeflection = _flightParams select 2; - + _yVec = vectorDir _projectile; _zVec = vectorUp _projectile; _xVec = vectorNormalized (_yVec vectorCrossProduct _zVec); @@ -41,6 +45,7 @@ if(!isNil "_seekerTargetPos") then { _targetVector = [0,0,0] vectorFromTo _targetVectorSeeker; TRACE_1("", _targetVectorSeeker, _targetVector); + private["_yaw", "_pitch"]; _yaw = 0; _pitch = 0; @@ -65,9 +70,10 @@ if(!isNil "_seekerTargetPos") then { #endif if(accTime > 0) then { + private["_adjustTime", "_outVector", "_vectorTo"]; _adjustTime = 1/accTime; - _adjustTime = _adjustTime * (_runtimeDelta / 0.1); - + _adjustTime = _adjustTime * (_runtimeDelta / 0.01); + TRACE_4("Adjust timing", 1/accTime, _adjustTime, _runtimeDelta, (_runtimeDelta / 0.1)); _outVector = [_projectile, [_xVec, _yVec, _zVec], [_yaw, _adjustTime, _pitch]] call FUNC(translateToModelSpace); _vectorTo = _projectilePos vectorFromTo _outVector; diff --git a/addons/missileguidance/functions/fnc_seekerType_SALH.sqf b/addons/missileguidance/functions/fnc_seekerType_SALH.sqf index f4d36285d8..7fa23d028e 100644 --- a/addons/missileguidance/functions/fnc_seekerType_SALH.sqf +++ b/addons/missileguidance/functions/fnc_seekerType_SALH.sqf @@ -1,4 +1,4 @@ -//#define DEBUG_MODE_FULL +#define DEBUG_MODE_FULL #include "script_component.hpp" EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); From 8fe11c36ee799b0715fdb46367326f8a002dbb3f Mon Sep 17 00:00:00 2001 From: jaynus Date: Thu, 9 Apr 2015 14:11:15 -0700 Subject: [PATCH 27/76] Linear altitude comparison. --- addons/missileguidance/CfgAmmo.hpp | 4 +-- .../functions/fnc_attackProfile_DIR.sqf | 35 +------------------ .../functions/fnc_attackProfile_LIN.sqf | 18 +++++++--- .../functions/fnc_attackProfile_PYM.sqf | 35 +------------------ 4 files changed, 18 insertions(+), 74 deletions(-) diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index 3ca6a2d5d0..e9048d829e 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -100,8 +100,8 @@ class CfgAmmo { manualControl = 0; // ACE uses these values - trackOversteer = 1; - trackLead = 0; + //trackOversteer = 1; + //trackLead = 0; // Begin ACE guidance Configs class ACE_MissileGuidance { diff --git a/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf b/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf index 259289b44d..e4776adcdf 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf @@ -1,37 +1,4 @@ #define DEBUG_MODE_FULL #include "script_component.hpp" -EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"]; -private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos"]; -_seekerTargetPos = _this select 0; -_launchParams = _this select 1; - -_target = _launchParams select 0; -_targetLaunchParams = _launchParams select 1; - -_shooterPos = getPosASL _shooter; -_projectilePos = getPosASL _projectile; - -_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; -_distanceToShooter = _projectilePos vectorDistance _shooterPos; - -TRACE_2("", _distanceToTarget, _distanceToShooter); - -_addHeight = [0,0,0]; -if(_distanceToShooter < 100) then { - _addHeight = [0,0,_distanceToTarget]; -} else { - _addHeight = [0,0, _distanceToTarget*0.02]; -}; - -TRACE_3("", _distanceToTarget,_distanceToShooter,_addHeight); - -_returnTargetPos = _seekerTargetPos vectorAdd _addHeight; - -#ifdef DEBUG_MODE_FULL -drawLine3D [(ASLtoATL _returnTargetPos) vectorAdd _addHeight, ASLtoATL _returnTargetPos, [0,1,0,1]]; -#endif - -TRACE_1("Adjusted target position", _returnTargetPos); -_returnTargetPos; \ No newline at end of file +_this call FUNC(attackProfile_LIN); \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf index 8b47847347..adaed2f6d4 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf @@ -18,12 +18,22 @@ _distanceToShooter = _projectilePos vectorDistance _shooterPos; TRACE_2("", _distanceToTarget, _distanceToShooter); -//_addHeight = [0,0,0]; -_addHeight = [0,0, _distanceToTarget*0.02]; +// Add height depending on distance for compensate +_addHeight =[0,0,0]; +if(_distanceToShooter < 50) then { + _addHeight = [0,0,_distanceToTarget]; +} else { + _addHeight = [0,0, _distanceToTarget*0.02]; +}; -TRACE_3("", _distanceToTarget, _distanceToShooter, _addHeight); +TRACE_3("", _distanceToTarget,_distanceToShooter,_addHeight); -_returnTargetPos = _seekerTargetPos vectorAdd _addHeight; +// Only add the guidance height if we are below the target +if((_shooterPos select 2) < (_seekerTargetPos select 2)) then { + _returnTargetPos = _seekerTargetPos vectorAdd _addHeight; +} else { + _returnTargetPos = _seekerTargetPos; +}; #ifdef DEBUG_MODE_FULL drawLine3D [(ASLtoATL _returnTargetPos) vectorAdd _addHeight, ASLtoATL _returnTargetPos, [0,1,0,1]]; diff --git a/addons/missileguidance/functions/fnc_attackProfile_PYM.sqf b/addons/missileguidance/functions/fnc_attackProfile_PYM.sqf index 259289b44d..e4776adcdf 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_PYM.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_PYM.sqf @@ -1,37 +1,4 @@ #define DEBUG_MODE_FULL #include "script_component.hpp" -EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"]; -private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos"]; -_seekerTargetPos = _this select 0; -_launchParams = _this select 1; - -_target = _launchParams select 0; -_targetLaunchParams = _launchParams select 1; - -_shooterPos = getPosASL _shooter; -_projectilePos = getPosASL _projectile; - -_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; -_distanceToShooter = _projectilePos vectorDistance _shooterPos; - -TRACE_2("", _distanceToTarget, _distanceToShooter); - -_addHeight = [0,0,0]; -if(_distanceToShooter < 100) then { - _addHeight = [0,0,_distanceToTarget]; -} else { - _addHeight = [0,0, _distanceToTarget*0.02]; -}; - -TRACE_3("", _distanceToTarget,_distanceToShooter,_addHeight); - -_returnTargetPos = _seekerTargetPos vectorAdd _addHeight; - -#ifdef DEBUG_MODE_FULL -drawLine3D [(ASLtoATL _returnTargetPos) vectorAdd _addHeight, ASLtoATL _returnTargetPos, [0,1,0,1]]; -#endif - -TRACE_1("Adjusted target position", _returnTargetPos); -_returnTargetPos; \ No newline at end of file +_this call FUNC(attackProfile_LIN); \ No newline at end of file From 1eadcade721a913e8f18106aacf86a70c1e3eb0e Mon Sep 17 00:00:00 2001 From: jaynus Date: Thu, 9 Apr 2015 15:34:42 -0700 Subject: [PATCH 28/76] Linear work javelin. --- .../functions/fnc_attackProfile_LIN.sqf | 29 ++++++++++++------- .../functions/fnc_seekerType_Optic.sqf | 2 +- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf index adaed2f6d4..c920e7942c 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf @@ -19,21 +19,28 @@ _distanceToShooter = _projectilePos vectorDistance _shooterPos; TRACE_2("", _distanceToTarget, _distanceToShooter); // Add height depending on distance for compensate -_addHeight =[0,0,0]; -if(_distanceToShooter < 50) then { - _addHeight = [0,0,_distanceToTarget]; -} else { - _addHeight = [0,0, _distanceToTarget*0.02]; +_addHeight = [0,0,0]; + +// Always climb an arc on initial launch if we are close to the round +if( ((ASLtoATL _projectilePos) select 2) < 20 && _distanceToShooter < 50) then { + _addHeight = _addHeight vectorAdd [0,0,_distanceToTarget]; }; +// If we are below the target, increase the climbing arc +if((_projectilePos select 2) < (_seekerTargetPos select 2) && _distanceToTarget > 100) then { + _addHeight = _addHeight vectorAdd [0,0, _distanceToTarget*0.02]; +}; + +// Handle arcing terminal low for high decent +if( (_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget < 100) then { + _addHeight = _addHeight vectorDiff [0,0, ((_projectilePos select 2) - (_seekerTargetPos select 2)) * 0.25]; +}; + + + TRACE_3("", _distanceToTarget,_distanceToShooter,_addHeight); -// Only add the guidance height if we are below the target -if((_shooterPos select 2) < (_seekerTargetPos select 2)) then { - _returnTargetPos = _seekerTargetPos vectorAdd _addHeight; -} else { - _returnTargetPos = _seekerTargetPos; -}; + _returnTargetPos = _seekerTargetPos vectorAdd _addHeight; #ifdef DEBUG_MODE_FULL drawLine3D [(ASLtoATL _returnTargetPos) vectorAdd _addHeight, ASLtoATL _returnTargetPos, [0,1,0,1]]; diff --git a/addons/missileguidance/functions/fnc_seekerType_Optic.sqf b/addons/missileguidance/functions/fnc_seekerType_Optic.sqf index 05b922ceba..207a491ddd 100644 --- a/addons/missileguidance/functions/fnc_seekerType_Optic.sqf +++ b/addons/missileguidance/functions/fnc_seekerType_Optic.sqf @@ -16,7 +16,7 @@ TRACE_1("", _launchParams); // TODO:: Make sure the missile maintains LOS _foundTargetPos = [0,0,0]; if(!isNil "_target") then { - _foundTargetPos = getPosASL (_target); + _foundTargetPos = getPosASL _target; }; TRACE_2("", _target, _foundTargetPos); From cef9a6454a381f78d1acb8c85ab2e8b1b9f14a0a Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 00:38:24 +0200 Subject: [PATCH 29/76] Update stringtable.xml Updated spanish terms, on moved english to first raws. --- addons/common/stringtable.xml | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/addons/common/stringtable.xml b/addons/common/stringtable.xml index bcd2b149aa..9612fb9d08 100644 --- a/addons/common/stringtable.xml +++ b/addons/common/stringtable.xml @@ -296,54 +296,64 @@ Nincs hang - Akceptuj prośby - Aceptar Peticiones Accept Requests + Akceptuj prośby + Aceptar peticiones - Ignoruj prośby - Rechazar Peticiones Decline Requests + Ignoruj prośby + Rechazar peticiones - Akceptuj prośby wysłane przez innych graczy. Akceptacji wymagają między innymi akcje używania / współdzielenia wyposażenia, wykonywania określonych czynności. - Acepta Peticiones de otros jugadores. Pueden ser solicitudes para usar / compartir equipamiento, realizar ciertas acciones. Accept Requests send by other players. These can be requests to use / share equipment, perform certain actions. + Akceptuj prośby wysłane przez innych graczy. Akceptacji wymagają między innymi akcje używania / współdzielenia wyposażenia, wykonywania określonych czynności. + Acepta peticiones de otros jugadores. Pueden ser solicitudes para usar / compartir equipamiento, realizar ciertas acciones. - Ignoruj prośby wysłane przez innych graczy. Akceptacji wymagają między innymi akcje używania / współdzielenia wyposażenia, wykonywania określonych czynności. - Rechazar Peticiones de otros jugadores. Pueden ser solicitudes para usar / compartir equipamiento, realizar ciertas acciones. Decline Requests send by other players. These can be requests to use / share equipment, perform certain actions. + Ignoruj prośby wysłane przez innych graczy. Akceptacji wymagają między innymi akcje używania / współdzielenia wyposażenia, wykonywania określonych czynności. + Rechazar peticiones de otros jugadores. Pueden ser solicitudes para usar / compartir equipamiento, realizar ciertas acciones. Feedback icons + Iconos de respuesta Select the position of or disable the feedback icons on your screen. These icons will show to provide extra feedback on your character status and actions performed. + Seleccionar la posición de o desactivar los íconos de respuesta en la pantalla. Estos iconos se mostrarán para proporcionar información adicional sobre el estado de su personaje y las acciones a realizar. Progress bar location + Ubicación de la barra de progreso Set the desired location of the progress bar on your screen. + Seleccionar la ubicación deseada de la barra de progreso en tu pantalla Hint Background color + Color de fondo de las indicaciones The color of the background from the ACE hints. + El color de fondo de las indicaciones del ACE Hint text font color + El color del texto de las indicaciones The color of the text font from the ACE hints. This color is the default color for all text displayed through the ACE Hint system, if the hint text has no other color specified. + El color del texto de las indicaciones del ACE. Este es el color predeterminado para todo el texto que se muestra a través del sistema de indicaciones del ACE, si el texto de indicacion no tiene otro color especificado. Banana + Banana A banana is an edible fruit, botanically a berry, produced by several kinds of large herbaceous flowering plants in the genus Musa. + Una banana es una fruta comestible, botanicamente una baya, producida por varios tipos de grandes plantas herbáceas del género Musa. - \ No newline at end of file + From dc44b73a36bab73a6a768e61f72a7cedae2d54ad Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 01:12:31 +0200 Subject: [PATCH 30/76] Update stringtable.xml updated spanish terms --- addons/frag/stringtable.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/frag/stringtable.xml b/addons/frag/stringtable.xml index f3562ee5b1..4658520a48 100644 --- a/addons/frag/stringtable.xml +++ b/addons/frag/stringtable.xml @@ -9,7 +9,7 @@ (Æ) Wyłącz głowice fragmentacyjne (Æ) Выключить разлёт осколков (Æ) Disable Fragmentation -(Æ) Disable Fragmentation +(Æ) Desactivar fragmentación (Æ) Disable Fragmentation (Æ) Disable Fragmentation From df314425993c34fb3d431986048eea2b74735daf Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 01:13:33 +0200 Subject: [PATCH 31/76] Update stringtable.xml added spanish terms --- addons/explosives/stringtable.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/explosives/stringtable.xml b/addons/explosives/stringtable.xml index 57ef190460..09095c2601 100644 --- a/addons/explosives/stringtable.xml +++ b/addons/explosives/stringtable.xml @@ -492,6 +492,7 @@ Pick up + Recoger From b8b151e62efe4b18a6138960b8e5dca575da1a70 Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 01:20:39 +0200 Subject: [PATCH 32/76] Update stringtable.xml added spanish terms --- addons/interact_menu/stringtable.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/interact_menu/stringtable.xml b/addons/interact_menu/stringtable.xml index 6e5ce8fdb2..9f7cf0676f 100644 --- a/addons/interact_menu/stringtable.xml +++ b/addons/interact_menu/stringtable.xml @@ -4,18 +4,23 @@ Always display cursor for self interaction + Mostrar siempre el cursor para la interacción propia Interact Key + Tecla de interacción Self Interaction Key + Tecla de interacción propia Self Actions + Acciones propias Vehicle Actions + Acciones de vehículo - \ No newline at end of file + From 65b3566d418a97cd65e70d3e20aae704f7487d9f Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 01:24:37 +0200 Subject: [PATCH 33/76] Update stringtable.xml fixed spanish terms. --- addons/common/stringtable.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/common/stringtable.xml b/addons/common/stringtable.xml index 9612fb9d08..dc16e2e201 100644 --- a/addons/common/stringtable.xml +++ b/addons/common/stringtable.xml @@ -333,19 +333,19 @@ Hint Background color - Color de fondo de las indicaciones + Color de fondo de las notificaciones The color of the background from the ACE hints. - El color de fondo de las indicaciones del ACE + El color de fondo de las notificaciones del ACE Hint text font color - El color del texto de las indicaciones + El color del texto de las notificaciones The color of the text font from the ACE hints. This color is the default color for all text displayed through the ACE Hint system, if the hint text has no other color specified. - El color del texto de las indicaciones del ACE. Este es el color predeterminado para todo el texto que se muestra a través del sistema de indicaciones del ACE, si el texto de indicacion no tiene otro color especificado. + El color del texto de las notificaciones del ACE. Este es el color predeterminado para todo el texto que se muestra a través del sistema de notificaciones del ACE, si el texto de notificacion no tiene otro color especificado. Banana From 5f5ce47bec79104149b260718cff8115349d05be Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 01:26:06 +0200 Subject: [PATCH 34/76] Update stringtable.xml fixed one term in spanish --- addons/common/stringtable.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/common/stringtable.xml b/addons/common/stringtable.xml index dc16e2e201..895f751626 100644 --- a/addons/common/stringtable.xml +++ b/addons/common/stringtable.xml @@ -345,7 +345,7 @@ The color of the text font from the ACE hints. This color is the default color for all text displayed through the ACE Hint system, if the hint text has no other color specified. - El color del texto de las notificaciones del ACE. Este es el color predeterminado para todo el texto que se muestra a través del sistema de notificaciones del ACE, si el texto de notificacion no tiene otro color especificado. + El color del texto de las notificaciones del ACE. Este es el color predeterminado para todo el texto que se muestra a través del sistema de notificaciones del ACE, si el texto de notificación no tiene otro color especificado. Banana From 2542f994d623abb301da34e789a204a84c28aabb Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 01:29:52 +0200 Subject: [PATCH 35/76] Update stringtable.xml added spanish translation --- addons/interaction/stringtable.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/addons/interaction/stringtable.xml b/addons/interaction/stringtable.xml index dcd87056e2..bebb77e9ba 100644 --- a/addons/interaction/stringtable.xml +++ b/addons/interaction/stringtable.xml @@ -4,27 +4,35 @@ Interactions + Interacciones Torso + Torso Head + Cabeza Left Arm + Brazo izquierdo Right Arm + Brazo derecho Left Leg + Pierna izquierda Right Leg + Pierna derecha Weapon + Arma Interaction Menu @@ -655,6 +663,7 @@ Passengers + Pasajeros From 2e9f6a70583f92cc337c9f16f6f3e3dd76a1d797 Mon Sep 17 00:00:00 2001 From: jaynus Date: Thu, 9 Apr 2015 16:31:14 -0700 Subject: [PATCH 36/76] Better projected up/down. --- .../functions/fnc_attackProfile_LIN.sqf | 16 ++++++++++------ .../functions/fnc_guidancePFH.sqf | 5 +++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf index c920e7942c..364a42c14c 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf @@ -24,16 +24,20 @@ _addHeight = [0,0,0]; // Always climb an arc on initial launch if we are close to the round if( ((ASLtoATL _projectilePos) select 2) < 20 && _distanceToShooter < 50) then { _addHeight = _addHeight vectorAdd [0,0,_distanceToTarget]; -}; - -// If we are below the target, increase the climbing arc -if((_projectilePos select 2) < (_seekerTargetPos select 2) && _distanceToTarget > 100) then { - _addHeight = _addHeight vectorAdd [0,0, _distanceToTarget*0.02]; +} else { + // If we are below the target, increase the climbing arc + if((_projectilePos select 2) < (_seekerTargetPos select 2) && _distanceToTarget > 100) then { + _addHeight = _addHeight vectorAdd [0,0, ((_seekerTargetPos select 2) - (_projectilePos select 2))]; + }; }; // Handle arcing terminal low for high decent if( (_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget < 100) then { - _addHeight = _addHeight vectorDiff [0,0, ((_projectilePos select 2) - (_seekerTargetPos select 2)) * 0.25]; + _addHeight = _addHeight vectorDiff [0,0, ((_projectilePos select 2) - (_seekerTargetPos select 2)) * 0.5]; +} else { + if((_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget > 100) then { + _addHeight = _addHeight vectorAdd [0,0, _distanceToTarget*0.02]; + }; }; diff --git a/addons/missileguidance/functions/fnc_guidancePFH.sqf b/addons/missileguidance/functions/fnc_guidancePFH.sqf index 6d4d643d78..3786f28469 100644 --- a/addons/missileguidance/functions/fnc_guidancePFH.sqf +++ b/addons/missileguidance/functions/fnc_guidancePFH.sqf @@ -72,8 +72,9 @@ if(!isNil "_seekerTargetPos") then { if(accTime > 0) then { private["_adjustTime", "_outVector", "_vectorTo"]; _adjustTime = 1/accTime; - _adjustTime = _adjustTime * (_runtimeDelta / 0.01); - TRACE_4("Adjust timing", 1/accTime, _adjustTime, _runtimeDelta, (_runtimeDelta / 0.1)); + _adjustTime = _adjustTime * ( 1 / (_runtimeDelta / 0.1)); + TRACE_4("Adjust timing", 1/accTime, _adjustTime, _runtimeDelta, ( 1 / (_runtimeDelta / 0.1)) ); + _outVector = [_projectile, [_xVec, _yVec, _zVec], [_yaw, _adjustTime, _pitch]] call FUNC(translateToModelSpace); _vectorTo = _projectilePos vectorFromTo _outVector; From 5a849fe8a48e41d1bb33e117e1443feb7638f395 Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 01:33:08 +0200 Subject: [PATCH 37/76] Update stringtable.xml added spanish translation --- addons/inventory/stringtable.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/inventory/stringtable.xml b/addons/inventory/stringtable.xml index 9ca01373d1..2a798f4bfa 100644 --- a/addons/inventory/stringtable.xml +++ b/addons/inventory/stringtable.xml @@ -4,9 +4,11 @@ Make Inventory Display Bigger + Hacer la pantalla de inventario mas grande Normally inventory display is scaled by UI size. This allows scaling the Inventory UI size up, but doesn't increase font size allowing more rows displayed. + Normalmente la pantalla de inventario se escala por el tamaño de la interfaz de usuario. Esto permite ampliar el tamaño de la interfaz de usuario de inventario, pero no aumenta el tamaño de fuente, permitiendo mostrar más filas. - \ No newline at end of file + From 245666086788a34b8518b60591229388697707e4 Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 01:36:42 +0200 Subject: [PATCH 38/76] Update stringtable.xml --- addons/laser_selfdesignate/stringtable.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/laser_selfdesignate/stringtable.xml b/addons/laser_selfdesignate/stringtable.xml index 70f8912cfe..c598e10ecf 100644 --- a/addons/laser_selfdesignate/stringtable.xml +++ b/addons/laser_selfdesignate/stringtable.xml @@ -4,9 +4,11 @@ Laser<br/>Designator On + Laser<br/>Designador encendido Laser<br/>Designator Off + Laser<br/>Designador apagado - \ No newline at end of file + From e63b9c7aa90fed91c0a6f51ba402359ee6188da3 Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 01:38:31 +0200 Subject: [PATCH 39/76] Update stringtable.xml added spanish translation --- addons/logistics_wirecutter/stringtable.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/logistics_wirecutter/stringtable.xml b/addons/logistics_wirecutter/stringtable.xml index cf6e96c1aa..b385e49171 100644 --- a/addons/logistics_wirecutter/stringtable.xml +++ b/addons/logistics_wirecutter/stringtable.xml @@ -5,10 +5,11 @@ Wirecutter Drahtschneider - Wirecutter + Cortador de cables Wirecutter + Cortador de cables Cut Fence @@ -47,4 +48,4 @@ Забор вырезан - \ No newline at end of file + From 2a5e416dfcb2a62cdfbd88c5a79fa15b350e3ca2 Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 01:40:22 +0200 Subject: [PATCH 40/76] Update stringtable.xml fixed spanish terms --- addons/magazinerepack/stringtable.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/magazinerepack/stringtable.xml b/addons/magazinerepack/stringtable.xml index d8fd5ca177..d63dd2d2cd 100644 --- a/addons/magazinerepack/stringtable.xml +++ b/addons/magazinerepack/stringtable.xml @@ -77,12 +77,12 @@ Repacking Finished Wiederverpacken Fertig - Reembalaje Finalizado + Reembalaje finalizado Repacking Interrupted Umpacken Unterbrochen - Reempaque Interrupted + Reembalaje interrumpido %1 Full and %2 Partial @@ -90,4 +90,4 @@ %1 Total y %2 Parcial - \ No newline at end of file + From c1089dfffa9e94c207c14a278edc202f9360aeb6 Mon Sep 17 00:00:00 2001 From: jaynus Date: Thu, 9 Apr 2015 16:43:05 -0700 Subject: [PATCH 41/76] Working save, distance shots are off. --- addons/missileguidance/functions/fnc_guidancePFH.sqf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/missileguidance/functions/fnc_guidancePFH.sqf b/addons/missileguidance/functions/fnc_guidancePFH.sqf index 3786f28469..ee41ae9704 100644 --- a/addons/missileguidance/functions/fnc_guidancePFH.sqf +++ b/addons/missileguidance/functions/fnc_guidancePFH.sqf @@ -1,6 +1,8 @@ #define DEBUG_MODE_FULL #include "script_component.hpp" +#define TIMESTEP_FACTOR 0.01 + private["_args", "_stateParams", "_launchParams", "_targetLaunchParams", "_config", "_flightParams", "_seekerParams", "_seekerTargetPos"]; private["_lastRunTime", "_runtimeDelta", "_profileAdjustedTargetPos", "_targetVectorSeeker", "_targetVector"]; private["_minDeflection", "_maxDeflection", "_incDeflection"]; @@ -72,8 +74,8 @@ if(!isNil "_seekerTargetPos") then { if(accTime > 0) then { private["_adjustTime", "_outVector", "_vectorTo"]; _adjustTime = 1/accTime; - _adjustTime = _adjustTime * ( 1 / (_runtimeDelta / 0.1)); - TRACE_4("Adjust timing", 1/accTime, _adjustTime, _runtimeDelta, ( 1 / (_runtimeDelta / 0.1)) ); + _adjustTime = _adjustTime * (_runtimeDelta / TIMESTEP_FACTOR); + TRACE_4("Adjust timing", 1/accTime, _adjustTime, _runtimeDelta, (_runtimeDelta / TIMESTEP_FACTOR) ); _outVector = [_projectile, [_xVec, _yVec, _zVec], [_yaw, _adjustTime, _pitch]] call FUNC(translateToModelSpace); _vectorTo = _projectilePos vectorFromTo _outVector; From 52d476abd30552f575e5a7bc30c04d88a68252a9 Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 12:29:44 +0200 Subject: [PATCH 42/76] Update stringtable.xml Added spanisth translation, and two lines of english translation --- addons/medical/stringtable.xml | 142 +++++++++++++++++++++------------ 1 file changed, 91 insertions(+), 51 deletions(-) diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index ec01d3b626..a7949e20b3 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -5,6 +5,7 @@ Inject Atropine + Inyectar atropina Inject Epinephrine @@ -44,12 +45,15 @@ Transfuse Plasma + Transfundir plasma Transfuse Saline + Transfundir salino Apply Tourniquet + Aplicar torniquete Bandage @@ -161,6 +165,7 @@ Injecting Atropine ... + Inyectando Atropina ... Transfusing Blood ... @@ -176,9 +181,11 @@ Transfusing Saline ... + Transfusión de salino ... Transfusing Plasma ... + Transfusión de plasma ... Bandaging ... @@ -194,6 +201,7 @@ Applying Tourniquet ... + Aplicando torniquete ... Medical @@ -208,74 +216,97 @@ Field Dressing + Compresa de campaña Packing Bandage + Vendaje compresivo Elastic Bandage + Vendaje elástico QuikClot + QuikClot Check Pulse + Comprovar pulso Check Blood Pressure + Comprovar presión arterial Triage Card + Tarjeta de triaje Tourniquet + Torniquete Remove Tourniquet + Quitar torniquete Give Blood IV (1000ml) + Dar Sangre IV (1000ml) Give Blood IV (500ml) + Dar Sangre IV (500ml) Give Blood IV (250ml) + Dar Sangre IV (250ml) Give Plasma IV (1000ml) + Dar Plasma IV (1000ml) Give Plasma IV (500ml) + Dar Plasma IV (500ml) Give Plasma IV (250ml) + Dar Plasma IV (250ml) Give Saline IV (1000ml) + Dar Salino IV (1000ml) Give Saline IV (500ml) + Dar Salino IV (500ml) Give Saline IV (250ml) + Dar Salino IV (250ml) Minor + Menor Delayed + Retrasado Immediate + Inmediato Deceased + Fallecido None + Ninguno Normal breathing @@ -301,7 +332,7 @@ Almost no breathing Дыхания почти нет - Casi sin respirar + Casi sin respiración Respiration Faible Prawie brak oddechu @@ -315,14 +346,14 @@ In Pain Испытывает боль - Con Dolor + Con dolor A De La Douleur W bólu Lost a lot of Blood Большая кровопотеря - Mucha Sangre perdida + Mucha sangre perdida A Perdu Bcp de Sang Stracił dużo krwi @@ -335,6 +366,7 @@ Receiving IV [%1ml] + Reciviendo IV [%1ml] @@ -362,14 +394,14 @@ Packing Bandage Тампонирующая повязка - Vendaje Compresivo + Vendaje compresivo Bandage Mèche Bandaż (uciskowy) Used to pack medium to large wounds and stem the bleeding Для тампонирования ран среднего и большого размера и остановки кровотечения. - Se utiliza para vendar heridas medianas y grandes y detener el sangrado + Se utiliza para vendar heridas medianas o grandes y detener el sangrado Utiliser pour remplire la cavité créé dans une blessure moyenne et grande. Używany w celu opatrywania średnich i dużych ran oraz tamowania krwawienia. @@ -390,12 +422,12 @@ Bandage kit, Elastic Давящая повязка - Vendaje (Elástico) + Kit de vendaje (Elástico) Bandage Compressif Élastique Zestaw bandaży elastycznych. - + Allows an even compression and extra support to the injured area. Ce bandage peut etre utiliser pour compresser la plaie afin de ralentire le seignement et assurer la tenue du bandage lors de mouvment. Elastyczna opaska podtrzymująca opatrunek oraz usztywniająca okolice stawów. @@ -425,28 +457,28 @@ Morphine autoinjector Морфин в автоматическом шприце - Morfina auto-inyectable + Auto-inyectable de Morfina Auto-injecteur de Morphine Autostrzykawka z morfiną Used to combat moderate to severe pain experiences Для снятия средних и сильных болевых ощущений. - Usado para combatir los estados dolorosos moderados a severos + Usado para combatir los estados dolorosos de moderados a severos Utiliser pour contrer les douleurs modéré à severes. Morfina. Ma silne działanie przeciwbólowe. An analgesic used to combat moderate to severe pain experiences. Анальгетик для снятия средних и сильных болевых ощущений. - Analgésico usado para combatir los estados dolorosos de moderado a severo. + Analgésico usado para combatir los estados dolorosos de moderados a severos. Un Analgésique puissant servant a contrer les douleur modéré a severe. Organiczny związek chemiczny z grupy alkaloidów. Ma silne działanie przeciwbólowe. Atropin autoinjector Атропин в автоматическом шприце - Atropina auto-inyectable + Auto-inyectable de Atropina Auto-injecteur d'Atropine Autostrzykawka AtroPen @@ -460,14 +492,14 @@ A drug used by the Military in NBC scenarios. Препарат, используемый в войсках для защиты от оружия массового поражения. - Medicamento usado por Militares en escenarios NBQ + Medicamento usado por militares en escenarios NBQ Médicament utilisé par l'armée en cas d'attaque CBRN Atropina. Stosowana jako lek rozkurczowy i środek rozszerzający źrenice. Środek stosowany w przypadku zagrożeń NBC. Epinephrine autoinjector Адреналин в автоматическом шприце - Epinefrina auto-inyectable + Auto-inyectable Epinefrina Auto-injecteur d'épinéphrine Autostrzykawka EpiPen @@ -481,14 +513,14 @@ A drug that works on a sympathetic response to dilate the bronchi, increase heart rate and counter such effects given by allergic reactions (anaphylaxis). Used in sudden cardiac arrest scenarios with decreasing positive outcomes. Препарат, вызывающий симпатическую реакцию, приводящую к расширению бронхов, увеличению частоты сердечных сокращений и купированию аллергических реакций (анафилактического шока). Применяется при остановке сердца с уменьшением вероятности благоприятного исхода. - Medicamento que dilata los bronquios, aumenta la frecuencia cardiaca y contrarresta los efectos de las reacciones alérgicas (anafilaxis). Se utiliza en caso de paros cardiacos repentinos. + Medicamento que dilata los bronquios, aumenta la frecuencia cardiaca y contrarresta los efectos de las reacciones alérgicas (anafilaxis). Se utiliza en casos de paro cardiaco repentino. Un medicament qui fonctione sur le systeme sympatique créan une dilatation des bronches, augmente la fréquance cardiaque et contre les effet d'une reaction alergique (anaphylaxie). Utiliser lors d'arret cardio-respiratoire pour augmenté les chances retrouver un ryhtme. EpiPen z adrenaliną ma działanie sympatykomimetyczne, tj. pobudza receptory alfa- i beta-adrenergiczne. Pobudzenie układu współczulnego prowadzi do zwiększenia częstotliwości pracy serca, zwiększenia pojemności wyrzutowej serca i przyśpieszenia krążenia wieńcowego. Pobudzenie oskrzelowych receptorów beta-adrenergicznych wywołuje rozkurcz mięśni gładkich oskrzeli, co w efekcie zmniejsza towarzyszące oddychaniu świsty i duszności. Plasma IV (1000ml) Плазма для в/в вливания (1000 мл) - Plasma Intravenoso (1000ml) + Plasma IV (1000ml) Plasma Sanguin IV (1000ml) Osocze IV (1000ml) @@ -509,28 +541,28 @@ Plasma IV (500ml) Плазма для в/в вливания (500 мл) - Plasma Intravenoso (500ml) + Plasma IV (500ml) Plasma Sanguin IV (500ml) Osocze IV (500ml) Plasma IV (250ml) Плазма для в/в вливания (250 мл) - Plasma Intravenoso (250ml) + Plasma IV (250ml) Plasma Sanguin (250ml) Osocze IV (250ml) Blood IV (1000ml) Кровь для переливания (1000 мл) - Sangre Intravenosa (1000ml) + Sangre IV (1000ml) Cullot Sanguin IV (1000ml) Krew IV (1000ml) Blood IV, for restoring a patients blood (keep cold) Пакет крови для возмещения объема потерянной крови (хранить в холодильнике) - Sangre Intravenosa, para restarurar el volumen sanguíneo (mantener frío) + Sangre intravenosa, para restarurar el volumen sanguíneo (mantener fría) Cullot Sanguin IV, pour remplacer le volume sanguin (garder Réfrigeré) Krew IV, używana do uzupełnienia krwi u pacjenta, trzymać w warunkach chłodniczych @@ -539,33 +571,33 @@ Кровь I группы, резус-отрицательная, применяется по жизненным показаниям для возмещения объема потерянной крови на догоспитальном этапе оказания медицинской помощи. Cullot Sanguin O- ,utiliser seulement lors de perte sanguine majeur afin de remplacer le volume sanguin perdu. Habituelment utiliser lors du transport ou dans un etablisement de soin. Krew 0 Rh-, używana w rzadkich i szczególnych przypadkach do uzupełnienia krwi u pacjenta, zazwyczaj w trakcie fazie transportu rannej osoby do szpitala. - Utilice sólo durante gran pérdida de sangre para reemplazar el volumen de sangre perdido. Uso habitual durante el transporte de heridos. + Utilice sólo durante gran pérdida de sangre para reemplazar el volumen de sangre perdida. Uso habitual durante el transporte de heridos. Blood IV (500ml) Кровь для переливания (500 мл) - Sangre Intravenosa (500ml) + Sangre IV (500ml) Cullot Sanguin IV (500ml) Krew IV (500ml) Blood IV (250ml) Кровь для переливания (250 мл) - Sangre Intravenosa (250ml) + Sangre IV (250ml) Cullot Sanguin IV (250ml) Krew IV (250ml) Saline IV (1000ml) Физраствор для в/в вливания (1000 мл) - Solución Salina Intravenosa (1000ml) + Salino IV (1000ml) solution Saline 0.9% IV (1000ml) Solanka 0,9% IV (1000ml) Saline IV, for restoring a patients blood Пакет физраствора для возмещения объема потерянной крови - Solución Salina Intravenosa, para restaurar el volumen sanguíneo + Solución salina intravenosa, para restaurar el volumen sanguíneo Solution Saline 0.9% IV, pour retablir temporairement la tention arteriel Solanka 0,9%, podawana dożylnie (IV), używana w celu uzupełnienia krwi u pacjenta @@ -579,42 +611,42 @@ Saline IV (500ml) Физраствор для в/в вливания (500 мл) - Solución Salina Intravenosa (500ml) + Salino IV (500ml) Solution Saline 0.9% IV (500ml) Solanka 0,9% IV (500ml) Saline IV (250ml) Физраствор для в/в вливания (250 мл) - Solución Salina Intravenosa (250ml) + Salino IV (250ml) Solution Saline 0.9% IV (250ml) Solanka 0,9% IV (250ml) Basic Field Dressing (QuikClot) Первичный перевязочный пакет (QuikClot) - Vendaje Básico (Coagulante) + Vendaje básico (QuikClot) Bandage Regulier (Coagulant) Opatrunek QuikClot QuikClot bandage Гемостатический пакет QuikClot - Venda Coagulante + Vendaje QuikClot Bandage coagulant Podstawowy opatrunek stosowany na rany - + Hemostatic bandage with coagulant that stops bleeding. Un bandage servant a coaguler les seignements mineur à moyen. Proszkowy opatrunek adsorbcyjny przeznaczony do tamowania zagrażających życiu krwawień średniej i dużej intensywności. - Vendaje Hemostático con coagulante que detiene el sangrado. + Vendaje hemostático con coagulante que detiene el sangrado. Personal Aid Kit Аптечка - Kit de Soporte Vital Avanzado + Botiquín de primeros auxilios Équipement de support Vitale Apteczka osobista @@ -634,17 +666,17 @@ Surgical Kit Хирургический набор - Kit Quirúrgico + Kit quirúrgico Surgical Kit for in field advanced medical treatment Набор для хирургической помощи в полевых условиях - Kit Quirúrgico para el tratamiento avanzado en el campo de batalla + Kit quirúrgico para el tratamiento avanzado en el campo de batalla Surgical Kit for in field advanced medical treatment Набор для хирургической помощи в полевых условиях - Kit Quirúrgico para el tratamiento avanzado en el campo de batalla + Kit quirúrgico para el tratamiento avanzado en el campo de batalla Bodybag @@ -666,12 +698,12 @@ Blood Pressure Артериальное давление - Presión Arterial + Presión arterial Checking Blood Pressure.. Проверка артериального давления... - Comprobando Presión Arterial... + Comprobando presión arterial... You checked %1 @@ -681,32 +713,32 @@ You find a blood pressure of %2/%3 Артериальное давление %2/%3 - La Presión Arterial es %2/%3 + La presión arterial es %2/%3 You find a low blood pressure Давление низкое - La Presión Arterial es baja + La presión arterial es baja You find a normal blood pressure Давление нормальное - La Presión Arterial es normal + La presión srterial es normal You find a high blood pressure Давление высокое - La Presión Arterial es alta + La presión arterial es alta You find no blood pressure Давления нет - No hay Presión Arterial + No hay presión arterial You fail to find a blood pressure Артериальное давление не определяется - No puedes encontrar Presión Arterial + No puedes encontrar presión arterial Pulse @@ -716,7 +748,7 @@ Checking Heart Rate.. Проверка пульса... - Comprobando Pulso... + Comprobando ritmo cardíaco... You checked %1 @@ -726,32 +758,32 @@ You find a Heart Rate of %2 Пульс %2 уд./мин. - El Pulso es %2 + El ritmo cardíaco es de %2 You find a weak Heart Rate Пульс слабый - El Pulso es débil + El ritmo cardíaco es débil You find a strong Heart Rate Пульс учащенный - El Pulso está acelerado + El ritmo cardíaco está acelerado You find a normal Heart Rate Пульс в норме - El Pulso es bueno + El ritmo cardíaco es bueno You find no Heart Rate Пульс не прощупывается - No tiene Pulso + No tiene ritmo cardíaco Response Реакция - Reacciona + Respuesta You check response of patient @@ -806,7 +838,7 @@ Airway Дыхательные пути - Vías Aéreas + Vías aéreas %1 is treating your airway @@ -875,30 +907,38 @@ Unload patient + Descargar el paciente Load patient + Cargar el paciente en Place body in bodybag + Colocar cuerpo en bolsa para cadáveres Placing body in bodybag + Colocando cuerpo en bolsa para cadáveres %1 has bandaged patient + %1 has vendado al paciente %1 used %2 + %1 usado %2 %1 has given an IV + %1 has puesto una IV %1 applied a tourniquet + %1 aplicado torniquete - \ No newline at end of file + From cf769e09fbee8f582ed37517f92dda485d072d84 Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 12:46:31 +0200 Subject: [PATCH 43/76] Update stringtable.xml Add spanish translation --- addons/microdagr/stringtable.xml | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/addons/microdagr/stringtable.xml b/addons/microdagr/stringtable.xml index 772a7a172f..3431ad8fa9 100644 --- a/addons/microdagr/stringtable.xml +++ b/addons/microdagr/stringtable.xml @@ -4,21 +4,27 @@ MicroDAGR GPS + GPS MicroDAGR MicroDAGR advanced GPS receiver + Receptor avanzado GPS MicroDAGR Angular Unit: + Unidad angular: Mils + Mils Show Waypoints On Map: + Mostrar puntos de ruta en el mapa: Degrees + Grados On @@ -29,7 +35,7 @@ Wł. Ativar Вкл. - + Encendido Off @@ -40,36 +46,45 @@ Wył. Desativar Выкл. - No + Apagado Enter Grid Cords: + Introducir coordenadas de cuadrícula: Name of [%1] + Nombre de [%1] MGRS-New + Nuevo-MGRS WGD + WGD Range: + Distancia Reichweite: Compass Direction + Dirección de la brújula Mark + Marca Waypoints + Puntos de ruta Wegpunkte Connect To + Conectar a Settings @@ -78,9 +93,11 @@ SetWP + Establecer PR Add + Añadir Delete @@ -91,19 +108,23 @@ Usuń Excluir Удалить - Suprimir + Borrar Toggle MicroDAGR Display Mode + Conmutar modo de pantalla del MicroDAGR Show MicoDAGR + Mostrar MicroDAGR Configure MicroDAGR + Configurar MicroDAGR Close MicroDAGR + Cerrar MicroDAGR - \ No newline at end of file + From e0fc44cfa87701fc623d80ad96d60c8ca323bc4c Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 13:04:08 +0200 Subject: [PATCH 44/76] Update stringtable.xml Added spanishtr translation --- addons/nametags/stringtable.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/nametags/stringtable.xml b/addons/nametags/stringtable.xml index 622df44aca..2f37193b17 100644 --- a/addons/nametags/stringtable.xml +++ b/addons/nametags/stringtable.xml @@ -68,6 +68,7 @@ Show name tags for AI units + Mostrar etiquetas de nombre para unidades IA Show SoundWaves (requires player names) @@ -76,6 +77,7 @@ Default Nametag Color (Non Group Members) + Color de etiquetas de nombre por defecto (No miembros de grupo) - \ No newline at end of file + From a73c37ce050e964b6536c8c956e55a53e6df1a0e Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 13:14:33 +0200 Subject: [PATCH 45/76] Update stringtable.xml added spanish translation --- addons/optionsmenu/stringtable.xml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/addons/optionsmenu/stringtable.xml b/addons/optionsmenu/stringtable.xml index 76407da435..6975ff4223 100644 --- a/addons/optionsmenu/stringtable.xml +++ b/addons/optionsmenu/stringtable.xml @@ -16,16 +16,18 @@ Fix Animation + Arreglar animación Reset All Rücksetzen + Reiniciar todo Colors Farben цвета - Colors + Colores Options @@ -41,6 +43,7 @@ Values + Valores Yes @@ -75,33 +78,43 @@ Export + Exportar Open Export Menu + Abrir menu d'exportación String input. + Introducir frase Array. Seperate elements by using ,. + Matriz. Separa elementos usando ,. Number + Numero Uknown input type + Tipo de entrada desconocida Save input + Guardar entrada Include Client Settings + Incluir configuración de cliente Exclude Client Settings + Excluir configuración de cliente Settings exported to clipboard + Configuración exportada al portapapeles - \ No newline at end of file + From 470a12ed4699f943e7da5b6a50d110fc7a2d3a1b Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 13:19:26 +0200 Subject: [PATCH 46/76] Update stringtable.xml added spanish translation --- addons/overheating/stringtable.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/overheating/stringtable.xml b/addons/overheating/stringtable.xml index 5d2c9595df..bc28c3a47d 100644 --- a/addons/overheating/stringtable.xml +++ b/addons/overheating/stringtable.xml @@ -4,9 +4,11 @@ Display text on jam + Mostrar texto al encasquillar Display a notification whenever your weapon gets jammed + Mostrar notificación cada vez que el arma se encasquille Spare barrel @@ -153,4 +155,4 @@ Температура - \ No newline at end of file + From 6f69361a731866f8288e17601f8725983d482ca8 Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 13:34:16 +0200 Subject: [PATCH 47/76] Update stringtable.xml added spanish translation --- addons/reload/stringtable.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/reload/stringtable.xml b/addons/reload/stringtable.xml index 40f36c6549..a7873948b1 100644 --- a/addons/reload/stringtable.xml +++ b/addons/reload/stringtable.xml @@ -4,9 +4,11 @@ Check ammo on weapon reload + Comprovar munición al recargar el arma Check the ammo in your new magazine on magazine reload. + Comprueva la munición del nuevo cargador al recargar. Check Ammo @@ -34,9 +36,11 @@ Link belt + Enlazar cinta Linking belt... + Enlazando cinta... From c741154ff2ef3c0cd6fe345100561e202bcf1719 Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 13:36:17 +0200 Subject: [PATCH 48/76] Update stringtable.xml added spanish translation --- addons/reloadlaunchers/stringtable.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/reloadlaunchers/stringtable.xml b/addons/reloadlaunchers/stringtable.xml index 6677153419..87ebbe4b75 100644 --- a/addons/reloadlaunchers/stringtable.xml +++ b/addons/reloadlaunchers/stringtable.xml @@ -5,19 +5,23 @@ Load launcher Panzerabwehr laden + Cargar lanzador Loading launcher ... Panzerabwehr wird geladen ... + Cargando lanzador ... Launcher loaded Panzerabwehr geladen + Lanzador cargado Load %1 Lade %1 + Cargar %1 From 19da5b366e1425e9e53772631871297d1f791aae Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 13:38:19 +0200 Subject: [PATCH 49/76] Update stringtable.xml added spanish translation --- addons/respawn/stringtable.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/respawn/stringtable.xml b/addons/respawn/stringtable.xml index 59a9b2b31c..ae1f5d819f 100644 --- a/addons/respawn/stringtable.xml +++ b/addons/respawn/stringtable.xml @@ -4,18 +4,22 @@ Deploy in 5 seconds ... Wird in 5 Sekunden errichtet ... + Desplegando en 5 segundos ... Rallypoint deployed Rallypoint errichtet + Punto de reunión desplegado Teleported to Base Zur Basis teleportiert + Teletransportado a base Teleported to Rallypoint Zum Rallypoint teleportiert + Teletransportado al punto de reunión From f2a73ab9c67c0896ab77a94d0330c657f2aa774e Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 13:41:44 +0200 Subject: [PATCH 50/76] Update stringtable.xml added some spanish translation --- addons/weaponselect/stringtable.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/weaponselect/stringtable.xml b/addons/weaponselect/stringtable.xml index 3a39d59396..dd65d3a4d9 100644 --- a/addons/weaponselect/stringtable.xml +++ b/addons/weaponselect/stringtable.xml @@ -4,9 +4,11 @@ Display text on grenade throw + Mostrar texto al lanzar granada Display a hint or text on grenade throw. + Muestra una notificación o texto al lanzar granada Select Pistol @@ -251,4 +253,4 @@ Запустить дымовую завесу - \ No newline at end of file + From a224ec33716584ad454157ce6ea4bece5bc21d28 Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 13:43:07 +0200 Subject: [PATCH 51/76] Update stringtable.xml added spanish translation --- addons/wep_javelin/stringtable.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/wep_javelin/stringtable.xml b/addons/wep_javelin/stringtable.xml index 4068d6f0a6..a691c750cb 100644 --- a/addons/wep_javelin/stringtable.xml +++ b/addons/wep_javelin/stringtable.xml @@ -8,7 +8,7 @@ Lock Target (Hold) Lock Target (Hold) Lock Target (Hold) - Lock Target (Hold) + Fijar objetivo (Mantener) Lock Target (Hold) @@ -17,7 +17,7 @@ Cycle Fire Mode Cycle Fire Mode Cycle Fire Mode - Cycle Fire Mode + Cambiar modo de fuego Cycle Fire Mode From c7d3618d794b0859087df3517e94e0059f55727a Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 13:43:39 +0200 Subject: [PATCH 52/76] Update stringtable.xml fix spanish term --- addons/winddeflection/stringtable.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/winddeflection/stringtable.xml b/addons/winddeflection/stringtable.xml index b52100046f..a1e67fa0d4 100644 --- a/addons/winddeflection/stringtable.xml +++ b/addons/winddeflection/stringtable.xml @@ -20,7 +20,7 @@ Weather Information Informacje o pogodzie - Información Meteorológica + Información meteorológica Humidity: %1% From fa9923c0276d85d12bd304bab25b3f2a0739a3bb Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 16:15:53 +0200 Subject: [PATCH 53/76] Update AUTHORS.txt added my email --- AUTHORS.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index b931d774ac..db2fe092fd 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -50,7 +50,7 @@ havena Hawkins jokoho48 Jonpas -Legolasindar +Legolasindar "Viper" licht-im-Norden87 MarcBook Michail Nikolaev From 2fe55b3117f90e8e32b526b869b351e9cf060ad1 Mon Sep 17 00:00:00 2001 From: jaynus Date: Fri, 10 Apr 2015 10:14:30 -0700 Subject: [PATCH 54/76] Attack profile buildout. --- .../functions/fnc_attackProfile_DIR.sqf | 52 ++++++++++++++++++- .../functions/fnc_attackProfile_HI.sqf | 52 ++++++++++++++++++- .../functions/fnc_attackProfile_LIN.sqf | 2 +- .../functions/fnc_attackProfile_MID.sqf | 52 ++++++++++++++++++- .../functions/fnc_attackProfile_TOP.sqf | 52 ++++++++++++++++++- 5 files changed, 205 insertions(+), 5 deletions(-) diff --git a/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf b/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf index e4776adcdf..e0f2f8c78d 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf @@ -1,4 +1,54 @@ #define DEBUG_MODE_FULL #include "script_component.hpp" -_this call FUNC(attackProfile_LIN); \ No newline at end of file +EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"]; +private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos"]; +_seekerTargetPos = _this select 0; +_launchParams = _this select 1; + +_target = _launchParams select 0; +_targetLaunchParams = _launchParams select 1; + +_shooterPos = getPosASL _shooter; +_projectilePos = getPosASL _projectile; + +_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; +_distanceToShooter = _projectilePos vectorDistance _shooterPos; + +TRACE_2("", _distanceToTarget, _distanceToShooter); + +// Add height depending on distance for compensate +_addHeight = [0,0,0]; + +// Always climb an arc on initial launch if we are close to the round +if( ((ASLtoATL _projectilePos) select 2) < 50 && _distanceToShooter < 50) then { + _addHeight = _addHeight vectorAdd [0,0,_distanceToTarget]; +} else { + // If we are below the target, increase the climbing arc + if((_projectilePos select 2) < (_seekerTargetPos select 2) + 20 && _distanceToTarget > 100) then { + _addHeight = _addHeight vectorAdd [0,0, ((_seekerTargetPos select 2) - (_projectilePos select 2))+20]; + }; +}; + +// Handle arcing terminal low for high decent +if( (_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget < 100) then { + _addHeight = _addHeight vectorDiff [0,0, ((_projectilePos select 2) - (_seekerTargetPos select 2)) * 0.5]; +} else { + if((_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget > 100) then { + _addHeight = _addHeight vectorAdd [0,0, _distanceToTarget*0.02]; + }; +}; + + + +TRACE_3("", _distanceToTarget,_distanceToShooter,_addHeight); + + _returnTargetPos = _seekerTargetPos vectorAdd _addHeight; + +#ifdef DEBUG_MODE_FULL +drawLine3D [(ASLtoATL _returnTargetPos) vectorAdd _addHeight, ASLtoATL _returnTargetPos, [0,1,0,1]]; +#endif + +TRACE_1("Adjusted target position", _returnTargetPos); +_returnTargetPos; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_HI.sqf b/addons/missileguidance/functions/fnc_attackProfile_HI.sqf index e4776adcdf..cdae4bbbfa 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_HI.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_HI.sqf @@ -1,4 +1,54 @@ #define DEBUG_MODE_FULL #include "script_component.hpp" -_this call FUNC(attackProfile_LIN); \ No newline at end of file +EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"]; +private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos"]; +_seekerTargetPos = _this select 0; +_launchParams = _this select 1; + +_target = _launchParams select 0; +_targetLaunchParams = _launchParams select 1; + +_shooterPos = getPosASL _shooter; +_projectilePos = getPosASL _projectile; + +_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; +_distanceToShooter = _projectilePos vectorDistance _shooterPos; + +TRACE_2("", _distanceToTarget, _distanceToShooter); + +// Add height depending on distance for compensate +_addHeight = [0,0,0]; + +// Always climb an arc on initial launch if we are close to the round +if( ((ASLtoATL _projectilePos) select 2) < 50 && _distanceToShooter < 50) then { + _addHeight = _addHeight vectorAdd [0,0,_distanceToTarget]; +} else { + // If we are below the target, increase the climbing arc + if((_projectilePos select 2) < (_seekerTargetPos select 2) && _distanceToTarget > 100) then { + _addHeight = _addHeight vectorAdd [0,0, ((_seekerTargetPos select 2) - (_projectilePos select 2))+50]; + }; +}; + +// Handle arcing terminal low for high decent +if( (_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget < 100) then { + _addHeight = _addHeight vectorDiff [0,0, ((_projectilePos select 2) - (_seekerTargetPos select 2)) * 0.5]; +} else { + if((_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget > 100) then { + _addHeight = _addHeight vectorAdd [0,0, _distanceToTarget*0.02]; + }; +}; + + + +TRACE_3("", _distanceToTarget,_distanceToShooter,_addHeight); + + _returnTargetPos = _seekerTargetPos vectorAdd _addHeight; + +#ifdef DEBUG_MODE_FULL +drawLine3D [(ASLtoATL _returnTargetPos) vectorAdd _addHeight, ASLtoATL _returnTargetPos, [0,1,0,1]]; +#endif + +TRACE_1("Adjusted target position", _returnTargetPos); +_returnTargetPos; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf index 364a42c14c..ce31b178c5 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf @@ -22,7 +22,7 @@ TRACE_2("", _distanceToTarget, _distanceToShooter); _addHeight = [0,0,0]; // Always climb an arc on initial launch if we are close to the round -if( ((ASLtoATL _projectilePos) select 2) < 20 && _distanceToShooter < 50) then { +if( ((ASLtoATL _projectilePos) select 2) < 5 && _distanceToShooter < 15) then { _addHeight = _addHeight vectorAdd [0,0,_distanceToTarget]; } else { // If we are below the target, increase the climbing arc diff --git a/addons/missileguidance/functions/fnc_attackProfile_MID.sqf b/addons/missileguidance/functions/fnc_attackProfile_MID.sqf index e4776adcdf..f01955297c 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_MID.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_MID.sqf @@ -1,4 +1,54 @@ #define DEBUG_MODE_FULL #include "script_component.hpp" -_this call FUNC(attackProfile_LIN); \ No newline at end of file +EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"]; +private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos"]; +_seekerTargetPos = _this select 0; +_launchParams = _this select 1; + +_target = _launchParams select 0; +_targetLaunchParams = _launchParams select 1; + +_shooterPos = getPosASL _shooter; +_projectilePos = getPosASL _projectile; + +_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; +_distanceToShooter = _projectilePos vectorDistance _shooterPos; + +TRACE_2("", _distanceToTarget, _distanceToShooter); + +// Add height depending on distance for compensate +_addHeight = [0,0,0]; + +// Always climb an arc on initial launch if we are close to the round +if( ((ASLtoATL _projectilePos) select 2) < 50 && _distanceToShooter < 50) then { + _addHeight = _addHeight vectorAdd [0,0,_distanceToTarget]; +} else { + // If we are below the target, increase the climbing arc + if((_projectilePos select 2) < (_seekerTargetPos select 2) + 50 && _distanceToTarget > 100) then { + _addHeight = _addHeight vectorAdd [0,0, ((_seekerTargetPos select 2) - (_projectilePos select 2))+50]; + }; +}; + +// Handle arcing terminal low for high decent +if( (_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget < 100) then { + _addHeight = _addHeight vectorDiff [0,0, ((_projectilePos select 2) - (_seekerTargetPos select 2)) * 0.5]; +} else { + if((_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget > 100) then { + _addHeight = _addHeight vectorAdd [0,0, _distanceToTarget*0.02]; + }; +}; + + + +TRACE_3("", _distanceToTarget,_distanceToShooter,_addHeight); + + _returnTargetPos = _seekerTargetPos vectorAdd _addHeight; + +#ifdef DEBUG_MODE_FULL +drawLine3D [(ASLtoATL _returnTargetPos) vectorAdd _addHeight, ASLtoATL _returnTargetPos, [0,1,0,1]]; +#endif + +TRACE_1("Adjusted target position", _returnTargetPos); +_returnTargetPos; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_TOP.sqf b/addons/missileguidance/functions/fnc_attackProfile_TOP.sqf index e4776adcdf..cdae4bbbfa 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_TOP.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_TOP.sqf @@ -1,4 +1,54 @@ #define DEBUG_MODE_FULL #include "script_component.hpp" -_this call FUNC(attackProfile_LIN); \ No newline at end of file +EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"]; +private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos"]; +_seekerTargetPos = _this select 0; +_launchParams = _this select 1; + +_target = _launchParams select 0; +_targetLaunchParams = _launchParams select 1; + +_shooterPos = getPosASL _shooter; +_projectilePos = getPosASL _projectile; + +_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; +_distanceToShooter = _projectilePos vectorDistance _shooterPos; + +TRACE_2("", _distanceToTarget, _distanceToShooter); + +// Add height depending on distance for compensate +_addHeight = [0,0,0]; + +// Always climb an arc on initial launch if we are close to the round +if( ((ASLtoATL _projectilePos) select 2) < 50 && _distanceToShooter < 50) then { + _addHeight = _addHeight vectorAdd [0,0,_distanceToTarget]; +} else { + // If we are below the target, increase the climbing arc + if((_projectilePos select 2) < (_seekerTargetPos select 2) && _distanceToTarget > 100) then { + _addHeight = _addHeight vectorAdd [0,0, ((_seekerTargetPos select 2) - (_projectilePos select 2))+50]; + }; +}; + +// Handle arcing terminal low for high decent +if( (_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget < 100) then { + _addHeight = _addHeight vectorDiff [0,0, ((_projectilePos select 2) - (_seekerTargetPos select 2)) * 0.5]; +} else { + if((_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget > 100) then { + _addHeight = _addHeight vectorAdd [0,0, _distanceToTarget*0.02]; + }; +}; + + + +TRACE_3("", _distanceToTarget,_distanceToShooter,_addHeight); + + _returnTargetPos = _seekerTargetPos vectorAdd _addHeight; + +#ifdef DEBUG_MODE_FULL +drawLine3D [(ASLtoATL _returnTargetPos) vectorAdd _addHeight, ASLtoATL _returnTargetPos, [0,1,0,1]]; +#endif + +TRACE_1("Adjusted target position", _returnTargetPos); +_returnTargetPos; \ No newline at end of file From c428bf051f239a69f0df8b891a4acbb88e5736f6 Mon Sep 17 00:00:00 2001 From: jaynus Date: Fri, 10 Apr 2015 10:42:02 -0700 Subject: [PATCH 55/76] placeholder model for hellfire, optics refreshing on titan --- addons/missileguidance/CfgAmmo.hpp | 4 ++++ addons/wep_javelin/XEH_pre_init.sqf | 2 ++ addons/wep_javelin/functions/fnc_cycleFireMode.sqf | 6 ------ addons/wep_javelin/functions/fnc_onOpticDraw.sqf | 12 +++--------- addons/wep_javelin/functions/fnc_onOpticLoad.sqf | 5 +++++ addons/wep_javelin/functions/fnc_showFireMode.sqf | 14 ++++++++++++++ addons/wep_javelin/script_component.hpp | 9 +++++++++ 7 files changed, 37 insertions(+), 15 deletions(-) create mode 100644 addons/wep_javelin/functions/fnc_showFireMode.sqf diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index e9048d829e..68c9abee19 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -84,6 +84,10 @@ class CfgAmmo { displayNameShort = "ACE_Hellfire_AGM114K"; descriptionShort = "ACE_Hellfire_AGM114K"; + // @TODO: placeholder model to at least make it look different + model = "\A3\Weapons_F\Ammo\Missile_AT_03_fly_F"; + proxyShape = "\A3\Weapons_F\Ammo\Missile_AT_03_F"; + hit = 1400; indirectHit = 71; indirectHitRange = 4.5; diff --git a/addons/wep_javelin/XEH_pre_init.sqf b/addons/wep_javelin/XEH_pre_init.sqf index a860302d94..119eb25975 100644 --- a/addons/wep_javelin/XEH_pre_init.sqf +++ b/addons/wep_javelin/XEH_pre_init.sqf @@ -5,7 +5,9 @@ PREP(translateToModelSpace); PREP(lockKeyDown); PREP(lockKeyUp); + PREP(cycleFireMode); +PREP(showFireMode); PREP(onOpticLoad); PREP(onOpticDraw); diff --git a/addons/wep_javelin/functions/fnc_cycleFireMode.sqf b/addons/wep_javelin/functions/fnc_cycleFireMode.sqf index 56b93a121a..711baf0ceb 100644 --- a/addons/wep_javelin/functions/fnc_cycleFireMode.sqf +++ b/addons/wep_javelin/functions/fnc_cycleFireMode.sqf @@ -7,13 +7,7 @@ private["_player", "_currentFireMode"]; _currentFireMode = ACE_player getVariable["ace_missileguidance_attackProfile", "TOP"]; if(_currentFireMode == "LIN") then { _currentFireMode = "TOP"; - - __JavelinIGUITop ctrlSetTextColor __ColorGreen; - __JavelinIGUIDir ctrlSetTextColor __ColorGray; } else { _currentFireMode = "LIN"; - - __JavelinIGUITop ctrlSetTextColor __ColorGray; - __JavelinIGUIDir ctrlSetTextColor __ColorGreen; }; ACE_player setVariable["ace_missileguidance_attackProfile", _currentFireMode, false]; diff --git a/addons/wep_javelin/functions/fnc_onOpticDraw.sqf b/addons/wep_javelin/functions/fnc_onOpticDraw.sqf index afd882ea42..586f4cb99e 100644 --- a/addons/wep_javelin/functions/fnc_onOpticDraw.sqf +++ b/addons/wep_javelin/functions/fnc_onOpticDraw.sqf @@ -7,15 +7,6 @@ #define __LOCKONTIMERANDOM 0.3 // Deviation in lock on time #define __SENSORSQUARE 1 // Locking on sensor square side in angles -#define __ConstraintTop (((ctrlPosition __JavelinIGUITargetingConstrainTop) select 1) + ((ctrlPosition (__JavelinIGUITargetingConstrainTop)) select 3)) -#define __ConstraintBottom ((ctrlPosition __JavelinIGUITargetingConstrainBottom) select 1) -#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 - - private["_args", "_lastTick", "_runTime", "_soundTime", "_lockTime", "_newTarget", "_currentTarget", "_range", "_pos", "_targetArray"]; // Reset arguments if we havnt rendered in over a second @@ -41,6 +32,9 @@ if ((velocity ACE_player) distance [0,0,0] > 0.5 && {cameraView == "GUNNER"} && ACE_player switchCamera "INTERNAL"; }; +// Refresh the firemode +[] call FUNC(showFireMode); + // Only start locking on holding tab if(!GVAR(isLockKeyDown)) exitWith { false }; diff --git a/addons/wep_javelin/functions/fnc_onOpticLoad.sqf b/addons/wep_javelin/functions/fnc_onOpticLoad.sqf index c4a7069630..b2192b8883 100644 --- a/addons/wep_javelin/functions/fnc_onOpticLoad.sqf +++ b/addons/wep_javelin/functions/fnc_onOpticLoad.sqf @@ -6,6 +6,11 @@ if((count _this) > 0) then { uiNameSpace setVariable ['ACE_RscOptics_javelin',_this select 0]; }; +ACE_player setVariable ["ace_missileguidance_target",nil, false]; + +__JavelinIGUISeek ctrlSetTextColor __ColorGray; +__JavelinIGUINFOV ctrlSetTextColor __ColorGray; + uiNameSpace setVariable [QGVAR(arguments), [ 0, // Last runtime diff --git a/addons/wep_javelin/functions/fnc_showFireMode.sqf b/addons/wep_javelin/functions/fnc_showFireMode.sqf new file mode 100644 index 0000000000..919fc63d8b --- /dev/null +++ b/addons/wep_javelin/functions/fnc_showFireMode.sqf @@ -0,0 +1,14 @@ +#define DEBUG_MODE_FULL +#include "script_component.hpp" +TRACE_1("enter", _this); + +private["_player", "_currentFireMode"]; + +_currentFireMode = ACE_player getVariable["ace_missileguidance_attackProfile", "TOP"]; +if(_currentFireMode == "LIN") then { + __JavelinIGUITop ctrlSetTextColor __ColorGreen; + __JavelinIGUIDir ctrlSetTextColor __ColorGray; +} else { + __JavelinIGUITop ctrlSetTextColor __ColorGray; + __JavelinIGUIDir ctrlSetTextColor __ColorGreen; +}; \ No newline at end of file diff --git a/addons/wep_javelin/script_component.hpp b/addons/wep_javelin/script_component.hpp index 3df1273422..69fe7efe57 100644 --- a/addons/wep_javelin/script_component.hpp +++ b/addons/wep_javelin/script_component.hpp @@ -46,6 +46,15 @@ #define __JavelinIGUITargetingLineH (__JavelinIGUI displayCtrl 699301) #define __JavelinIGUITargetingLineV (__JavelinIGUI displayCtrl 699302) +#define __ConstraintTop (((ctrlPosition __JavelinIGUITargetingConstrainTop) select 1) + ((ctrlPosition (__JavelinIGUITargetingConstrainTop)) select 3)) +#define __ConstraintBottom ((ctrlPosition __JavelinIGUITargetingConstrainBottom) select 1) +#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] From 97e277d7103901b83f648c44e8620b1b03591b3e Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 10 Apr 2015 12:55:42 -0500 Subject: [PATCH 56/76] #448 - Adjust Nightvision in vehicles --- addons/nightvision/XEH_postInitClient.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/nightvision/XEH_postInitClient.sqf b/addons/nightvision/XEH_postInitClient.sqf index 9d64baecb3..376059ce1b 100644 --- a/addons/nightvision/XEH_postInitClient.sqf +++ b/addons/nightvision/XEH_postInitClient.sqf @@ -40,7 +40,7 @@ GVAR(ppEffectMuzzleFlash) ppEffectCommit 0; ["ACE3", QGVAR(IncreaseNVGBrightness), localize "STR_ACE_NightVision_IncreaseNVGBrightness", { // Conditions: canInteract - if !([ACE_player, objNull, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, objNull, ["isNotEscorting", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific if ((currentVisionMode _player != 1)) exitWith {false}; @@ -54,7 +54,7 @@ GVAR(ppEffectMuzzleFlash) ppEffectCommit 0; ["ACE3", QGVAR(DecreaseNVGBrightness), localize "STR_ACE_NightVision_DecreaseNVGBrightness", { // Conditions: canInteract - if !([ACE_player, objNull, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, objNull, ["isNotEscorting", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific if ((currentVisionMode _player != 1)) exitWith {false}; From 1ae92f9387770f4684942c31f1ea863a881b75a9 Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 10 Apr 2015 19:56:56 +0200 Subject: [PATCH 57/76] add documentation to eventhandler system --- .../development/ace3-events-system.md | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/documentation/development/ace3-events-system.md b/documentation/development/ace3-events-system.md index 9075347f71..6b708b01dd 100644 --- a/documentation/development/ace3-events-system.md +++ b/documentation/development/ace3-events-system.md @@ -40,6 +40,7 @@ PREP(onTapShoulder); Event Key Description Source(s) + Passed Parameter(s) (_this) Locality @@ -48,6 +49,7 @@ PREP(onTapShoulder); "playerChanged" `player` changed (zeus/respawn) common + [_newPlayer, _oldPlayer] local @@ -55,6 +57,7 @@ PREP(onTapShoulder); "playerInventoryChanged" Inventory changed common + getAllGear-Array local @@ -62,13 +65,23 @@ PREP(onTapShoulder); "playerVisionModeChanged" Vision mode changed (e.g. NVG on) common + [_unit, _newVisionMode] local + + + "inventoryDisplayChanged" + Inventory display opened/closed + common + [_unit, _isOpen] + local + "zeusDisplayChanged" Zeus display opened/closed common + [_unit, _isOpen] local @@ -76,72 +89,91 @@ PREP(onTapShoulder); "cameraViewChanged" Camera view changed common + [_unit, _newCameraView] local "playerVehicleChanged" Player vehicle changed common + [_unit, _newVehicle] local "playerTurretChanged" Player turret changed common + [_unit, _newTurretIndexArray] local "infoDisplayChanged" On info box change (e.g. entering and leaving a vehicle) common + [_display, _type] local "inventoryDisplayLoaded" On opening the inventory display common + [_display] + local + + + "mapDisplayLoaded" + On loading the map (briefing and mission start) + common + [_display, _mapType] local "interactionMenuOpened" Interaction Menu Opened interaction + local "killedByFriendly" On TK/Civilian Killed respawn + local "drawing_requestMarkers" Request Drawing Markers map + target "drawing_sendbackMarkers" Send Drawing Markers map + target "drawing_addLineMarker" Line Drawn map + global "drawing_removeLineMarker" Line Deleted map + global "flashbangExplosion" Flashbang Goes Bang grenades + target From eec5f458db71aa2f825d8e534593a1460ec1c910 Mon Sep 17 00:00:00 2001 From: Tenga Date: Fri, 10 Apr 2015 20:05:33 +0200 Subject: [PATCH 58/76] Count the commander camera as a 3rd person camera --- AUTHORS.txt | 1 + addons/goggles/functions/fnc_externalCamera.sqf | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index b931d774ac..c50bb97935 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -62,6 +62,7 @@ Raspu86 Riccardo Petricca Robert Boklahánics simon84 +Sniperwolf572 Tonic Tourorist Valentin Torikian diff --git a/addons/goggles/functions/fnc_externalCamera.sqf b/addons/goggles/functions/fnc_externalCamera.sqf index 9161804a56..0a098cf8be 100644 --- a/addons/goggles/functions/fnc_externalCamera.sqf +++ b/addons/goggles/functions/fnc_externalCamera.sqf @@ -16,4 +16,4 @@ #include "script_component.hpp" if (GVAR(showInThirdPerson)) exitWith { false }; -(cameraView == "External") +(cameraView == "EXTERNAL" || cameraView == "GROUP") From 33570c94e4fa7da08bec91697296756837913fea Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 10 Apr 2015 13:05:14 -0500 Subject: [PATCH 59/76] #428 - Only work on locked vehicles. --- addons/vehiclelock/functions/fnc_lockpick.sqf | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/vehiclelock/functions/fnc_lockpick.sqf b/addons/vehiclelock/functions/fnc_lockpick.sqf index 4fee354824..d268646b8b 100644 --- a/addons/vehiclelock/functions/fnc_lockpick.sqf +++ b/addons/vehiclelock/functions/fnc_lockpick.sqf @@ -27,6 +27,7 @@ PARAMS_3(_unit,_veh,_funcType); if (isNull _unit) exitWith {ERROR("null unit"); false}; if (isNull _veh) exitWith {ERROR("null vehicle"); false}; + //need lockpick item if (!("ACE_key_lockpick" in (items _unit))) exitWith {false}; From db5861da52633891b963ac2e011ba04219e40e30 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 10 Apr 2015 13:05:34 -0500 Subject: [PATCH 60/76] #428 - GJ Git --- addons/vehiclelock/functions/fnc_lockpick.sqf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/vehiclelock/functions/fnc_lockpick.sqf b/addons/vehiclelock/functions/fnc_lockpick.sqf index d268646b8b..fc7fecc693 100644 --- a/addons/vehiclelock/functions/fnc_lockpick.sqf +++ b/addons/vehiclelock/functions/fnc_lockpick.sqf @@ -27,6 +27,8 @@ PARAMS_3(_unit,_veh,_funcType); if (isNull _unit) exitWith {ERROR("null unit"); false}; if (isNull _veh) exitWith {ERROR("null vehicle"); false}; +//Exit if vehicle unlocked: +if ((locked _veh) == 0) exitWith {false}; //need lockpick item if (!("ACE_key_lockpick" in (items _unit))) exitWith {false}; From 5083a5a0d2b4b10a56a19cc2bae7e8deaac552fa Mon Sep 17 00:00:00 2001 From: jaynus Date: Fri, 10 Apr 2015 11:37:03 -0700 Subject: [PATCH 61/76] Javelin locking fire modes were reversed. --- addons/missileguidance/CfgAmmo.hpp | 10 +++------- .../functions/fnc_attackProfile_TOP.sqf | 6 +++--- addons/missileguidance/functions/fnc_fired.sqf | 8 +++++++- addons/missileguidance/functions/fnc_guidancePFH.sqf | 3 +++ addons/wep_javelin/functions/fnc_showFireMode.sqf | 2 +- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index 68c9abee19..ee4027c82f 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -9,15 +9,11 @@ class CfgAmmo { class M_PG_AT : MissileBase { model = "\A3\Weapons_F\Ammo\Rocket_01_fly_F"; proxyShape = "\A3\Weapons_F\Ammo\Rocket_01_F"; - + irLock = 0; laserLock = 0; airLock = 0; weaponLockSystem = "2 + 16"; - - hit = 600; - indirectHit = 50; - indirectHitRange = 4; maxSpeed = 720; maxControlRange = 5000; @@ -29,7 +25,7 @@ class CfgAmmo { initTime = 0.002; thrustTime = 1.07; thrust = 530; - fuseDistance = 5; + fuseDistance = 2; effectsMissileInit = "MissileDAR1"; effectsMissile = "missile2"; @@ -132,7 +128,7 @@ class CfgAmmo { seekerMaxRange = 2500; // Range from the missile which the seeker can visually search // Attack profile type selection - defaultAttackProfile = "TOP"; + defaultAttackProfile = "LIN"; attackProfiles[] = { "TOP", "LIN" }; }; }; diff --git a/addons/missileguidance/functions/fnc_attackProfile_TOP.sqf b/addons/missileguidance/functions/fnc_attackProfile_TOP.sqf index cdae4bbbfa..0690877725 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_TOP.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_TOP.sqf @@ -22,11 +22,11 @@ TRACE_2("", _distanceToTarget, _distanceToShooter); _addHeight = [0,0,0]; // Always climb an arc on initial launch if we are close to the round -if( ((ASLtoATL _projectilePos) select 2) < 50 && _distanceToShooter < 50) then { +if( ((ASLtoATL _projectilePos) select 2) < 140 && _distanceToShooter < 50) then { _addHeight = _addHeight vectorAdd [0,0,_distanceToTarget]; } else { // If we are below the target, increase the climbing arc - if((_projectilePos select 2) < (_seekerTargetPos select 2) && _distanceToTarget > 100) then { + if((_projectilePos select 2) < (_seekerTargetPos select 2) + 140 && _distanceToTarget > 100) then { _addHeight = _addHeight vectorAdd [0,0, ((_seekerTargetPos select 2) - (_projectilePos select 2))+50]; }; }; @@ -36,7 +36,7 @@ if( (_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget _addHeight = _addHeight vectorDiff [0,0, ((_projectilePos select 2) - (_seekerTargetPos select 2)) * 0.5]; } else { if((_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget > 100) then { - _addHeight = _addHeight vectorAdd [0,0, _distanceToTarget*0.02]; + _addHeight = _addHeight vectorDiff [0,0, ((_projectilePos select 2) - (_seekerTargetPos select 2)) * 0.5]; }; }; diff --git a/addons/missileguidance/functions/fnc_fired.sqf b/addons/missileguidance/functions/fnc_fired.sqf index b82d179886..4378fa0bc2 100644 --- a/addons/missileguidance/functions/fnc_fired.sqf +++ b/addons/missileguidance/functions/fnc_fired.sqf @@ -35,7 +35,6 @@ if ( isNil "_attackProfile" || { ! ( _attackProfile in (getArray (_config >> "at if ( isNil "_lockMode" || { ! ( _lockMode in (getArray (_config >> "seekerLockModes" ) ) ) } ) then { _lockMode = getText (_config >> "defaultSeekerLockMode"); }; - TRACE_4("Beginning ACE guidance system",_target,_ammo,_seekerType,_attackProfile); [FUNC(guidancePFH), 0, [_this, @@ -58,3 +57,10 @@ TRACE_4("Beginning ACE guidance system",_target,_ammo,_seekerType,_attackProfile [ diag_tickTime ] ] ] call cba_fnc_addPerFrameHandler; + +/* Clears locking settings +(vehicle _shooter) setVariable [QGVAR(target), nil]; +(vehicle _shooter) setVariable [QGVAR(seekerType), nil]; +(vehicle _shooter) setVariable [QGVAR(attackProfile), nil]; +(vehicle _shooter) setVariable [QGVAR(lockMode), nil]; +*/ \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_guidancePFH.sqf b/addons/missileguidance/functions/fnc_guidancePFH.sqf index ee41ae9704..a6de3d4219 100644 --- a/addons/missileguidance/functions/fnc_guidancePFH.sqf +++ b/addons/missileguidance/functions/fnc_guidancePFH.sqf @@ -77,6 +77,9 @@ if(!isNil "_seekerTargetPos") then { _adjustTime = _adjustTime * (_runtimeDelta / TIMESTEP_FACTOR); TRACE_4("Adjust timing", 1/accTime, _adjustTime, _runtimeDelta, (_runtimeDelta / TIMESTEP_FACTOR) ); + // @TODO: Apply velocity multiplier to yaw/pitch. Basically, it can adjust faster at lower speeds + //_adjustDeflection = (vectorMagnitude velocity _projectile); + _outVector = [_projectile, [_xVec, _yVec, _zVec], [_yaw, _adjustTime, _pitch]] call FUNC(translateToModelSpace); _vectorTo = _projectilePos vectorFromTo _outVector; diff --git a/addons/wep_javelin/functions/fnc_showFireMode.sqf b/addons/wep_javelin/functions/fnc_showFireMode.sqf index 919fc63d8b..58712ce743 100644 --- a/addons/wep_javelin/functions/fnc_showFireMode.sqf +++ b/addons/wep_javelin/functions/fnc_showFireMode.sqf @@ -5,7 +5,7 @@ TRACE_1("enter", _this); private["_player", "_currentFireMode"]; _currentFireMode = ACE_player getVariable["ace_missileguidance_attackProfile", "TOP"]; -if(_currentFireMode == "LIN") then { +if(_currentFireMode == "TOP") then { __JavelinIGUITop ctrlSetTextColor __ColorGreen; __JavelinIGUIDir ctrlSetTextColor __ColorGray; } else { From c28ac5b4a91ddcc1da88c8a9faed6849f9dc80f8 Mon Sep 17 00:00:00 2001 From: jaynus Date: Fri, 10 Apr 2015 11:40:18 -0700 Subject: [PATCH 62/76] Compensate for target velocity. --- addons/missileguidance/functions/fnc_seekerType_Optic.sqf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addons/missileguidance/functions/fnc_seekerType_Optic.sqf b/addons/missileguidance/functions/fnc_seekerType_Optic.sqf index 207a491ddd..90ed14f05a 100644 --- a/addons/missileguidance/functions/fnc_seekerType_Optic.sqf +++ b/addons/missileguidance/functions/fnc_seekerType_Optic.sqf @@ -21,4 +21,12 @@ if(!isNil "_target") then { TRACE_2("", _target, _foundTargetPos); +_projectileSpeed = (vectorMagnitude velocity _projectile); +_distanceToTarget = (getPosASL _projectile) vectorDistance _foundTargetPos; + +_eta = _distanceToTarget / _projectileSpeed; + +_adjustVelocity = (velocity _target) vectorMultiply _eta; +_foundTargetPos = _foundTargetPos vectorAdd _adjustVelocity; + _foundTargetPos; \ No newline at end of file From 58d13237f8a2af24b86b0f8d0c38c5d2100114e7 Mon Sep 17 00:00:00 2001 From: Legolasindar Date: Fri, 10 Apr 2015 20:56:58 +0200 Subject: [PATCH 63/76] Update stringtable.xml fixed "comprobar" in spanish translation --- addons/medical/stringtable.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index a7949e20b3..6ec6b8bdf0 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -232,11 +232,11 @@ Check Pulse - Comprovar pulso + Comprobar pulso Check Blood Pressure - Comprovar presión arterial + Comprobar presión arterial Triage Card From bcb7d18e7eb632a5cc2e756704030756ebcf2c85 Mon Sep 17 00:00:00 2001 From: jaynus Date: Fri, 10 Apr 2015 11:57:50 -0700 Subject: [PATCH 64/76] remove debug. --- addons/wep_javelin/functions/fnc_cycleFireMode.sqf | 2 +- addons/wep_javelin/functions/fnc_showFireMode.sqf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/wep_javelin/functions/fnc_cycleFireMode.sqf b/addons/wep_javelin/functions/fnc_cycleFireMode.sqf index 711baf0ceb..4fed8e05cc 100644 --- a/addons/wep_javelin/functions/fnc_cycleFireMode.sqf +++ b/addons/wep_javelin/functions/fnc_cycleFireMode.sqf @@ -1,4 +1,4 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" TRACE_1("enter", _this); diff --git a/addons/wep_javelin/functions/fnc_showFireMode.sqf b/addons/wep_javelin/functions/fnc_showFireMode.sqf index 58712ce743..35dff9dbd3 100644 --- a/addons/wep_javelin/functions/fnc_showFireMode.sqf +++ b/addons/wep_javelin/functions/fnc_showFireMode.sqf @@ -1,4 +1,4 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" TRACE_1("enter", _this); From 391b1556cb2c361da4b2d009a35e7432f252e39f Mon Sep 17 00:00:00 2001 From: jaynus Date: Fri, 10 Apr 2015 12:12:25 -0700 Subject: [PATCH 65/76] Disable all debug. --- addons/missileguidance/CfgAmmo.hpp | 2 + .../functions/fnc_attackProfile_DIR.sqf | 52 +------------------ .../functions/fnc_attackProfile_HI.sqf | 52 +------------------ .../functions/fnc_attackProfile_MID.sqf | 52 +------------------ .../functions/fnc_attackProfile_PYM.sqf | 2 +- .../functions/fnc_attackProfile_TOP.sqf | 10 ++-- .../wep_javelin/functions/fnc_lockKeyDown.sqf | 2 +- .../wep_javelin/functions/fnc_lockKeyUp.sqf | 2 +- 8 files changed, 12 insertions(+), 162 deletions(-) diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index ee4027c82f..0a9b3de77a 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -99,6 +99,8 @@ class CfgAmmo { // Turn off arma crosshair-guidance manualControl = 0; + hit = 1400; + // ACE uses these values //trackOversteer = 1; //trackLead = 0; diff --git a/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf b/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf index e0f2f8c78d..e4776adcdf 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf @@ -1,54 +1,4 @@ #define DEBUG_MODE_FULL #include "script_component.hpp" -EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"]; -private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos"]; -_seekerTargetPos = _this select 0; -_launchParams = _this select 1; - -_target = _launchParams select 0; -_targetLaunchParams = _launchParams select 1; - -_shooterPos = getPosASL _shooter; -_projectilePos = getPosASL _projectile; - -_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; -_distanceToShooter = _projectilePos vectorDistance _shooterPos; - -TRACE_2("", _distanceToTarget, _distanceToShooter); - -// Add height depending on distance for compensate -_addHeight = [0,0,0]; - -// Always climb an arc on initial launch if we are close to the round -if( ((ASLtoATL _projectilePos) select 2) < 50 && _distanceToShooter < 50) then { - _addHeight = _addHeight vectorAdd [0,0,_distanceToTarget]; -} else { - // If we are below the target, increase the climbing arc - if((_projectilePos select 2) < (_seekerTargetPos select 2) + 20 && _distanceToTarget > 100) then { - _addHeight = _addHeight vectorAdd [0,0, ((_seekerTargetPos select 2) - (_projectilePos select 2))+20]; - }; -}; - -// Handle arcing terminal low for high decent -if( (_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget < 100) then { - _addHeight = _addHeight vectorDiff [0,0, ((_projectilePos select 2) - (_seekerTargetPos select 2)) * 0.5]; -} else { - if((_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget > 100) then { - _addHeight = _addHeight vectorAdd [0,0, _distanceToTarget*0.02]; - }; -}; - - - -TRACE_3("", _distanceToTarget,_distanceToShooter,_addHeight); - - _returnTargetPos = _seekerTargetPos vectorAdd _addHeight; - -#ifdef DEBUG_MODE_FULL -drawLine3D [(ASLtoATL _returnTargetPos) vectorAdd _addHeight, ASLtoATL _returnTargetPos, [0,1,0,1]]; -#endif - -TRACE_1("Adjusted target position", _returnTargetPos); -_returnTargetPos; \ No newline at end of file +_this call FUNC(attackProfile_LIN); \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_HI.sqf b/addons/missileguidance/functions/fnc_attackProfile_HI.sqf index cdae4bbbfa..e4776adcdf 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_HI.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_HI.sqf @@ -1,54 +1,4 @@ #define DEBUG_MODE_FULL #include "script_component.hpp" -EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"]; -private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos"]; -_seekerTargetPos = _this select 0; -_launchParams = _this select 1; - -_target = _launchParams select 0; -_targetLaunchParams = _launchParams select 1; - -_shooterPos = getPosASL _shooter; -_projectilePos = getPosASL _projectile; - -_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; -_distanceToShooter = _projectilePos vectorDistance _shooterPos; - -TRACE_2("", _distanceToTarget, _distanceToShooter); - -// Add height depending on distance for compensate -_addHeight = [0,0,0]; - -// Always climb an arc on initial launch if we are close to the round -if( ((ASLtoATL _projectilePos) select 2) < 50 && _distanceToShooter < 50) then { - _addHeight = _addHeight vectorAdd [0,0,_distanceToTarget]; -} else { - // If we are below the target, increase the climbing arc - if((_projectilePos select 2) < (_seekerTargetPos select 2) && _distanceToTarget > 100) then { - _addHeight = _addHeight vectorAdd [0,0, ((_seekerTargetPos select 2) - (_projectilePos select 2))+50]; - }; -}; - -// Handle arcing terminal low for high decent -if( (_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget < 100) then { - _addHeight = _addHeight vectorDiff [0,0, ((_projectilePos select 2) - (_seekerTargetPos select 2)) * 0.5]; -} else { - if((_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget > 100) then { - _addHeight = _addHeight vectorAdd [0,0, _distanceToTarget*0.02]; - }; -}; - - - -TRACE_3("", _distanceToTarget,_distanceToShooter,_addHeight); - - _returnTargetPos = _seekerTargetPos vectorAdd _addHeight; - -#ifdef DEBUG_MODE_FULL -drawLine3D [(ASLtoATL _returnTargetPos) vectorAdd _addHeight, ASLtoATL _returnTargetPos, [0,1,0,1]]; -#endif - -TRACE_1("Adjusted target position", _returnTargetPos); -_returnTargetPos; \ No newline at end of file +_this call FUNC(attackProfile_LIN); \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_MID.sqf b/addons/missileguidance/functions/fnc_attackProfile_MID.sqf index f01955297c..e4776adcdf 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_MID.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_MID.sqf @@ -1,54 +1,4 @@ #define DEBUG_MODE_FULL #include "script_component.hpp" -EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"]; -private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos"]; -_seekerTargetPos = _this select 0; -_launchParams = _this select 1; - -_target = _launchParams select 0; -_targetLaunchParams = _launchParams select 1; - -_shooterPos = getPosASL _shooter; -_projectilePos = getPosASL _projectile; - -_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; -_distanceToShooter = _projectilePos vectorDistance _shooterPos; - -TRACE_2("", _distanceToTarget, _distanceToShooter); - -// Add height depending on distance for compensate -_addHeight = [0,0,0]; - -// Always climb an arc on initial launch if we are close to the round -if( ((ASLtoATL _projectilePos) select 2) < 50 && _distanceToShooter < 50) then { - _addHeight = _addHeight vectorAdd [0,0,_distanceToTarget]; -} else { - // If we are below the target, increase the climbing arc - if((_projectilePos select 2) < (_seekerTargetPos select 2) + 50 && _distanceToTarget > 100) then { - _addHeight = _addHeight vectorAdd [0,0, ((_seekerTargetPos select 2) - (_projectilePos select 2))+50]; - }; -}; - -// Handle arcing terminal low for high decent -if( (_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget < 100) then { - _addHeight = _addHeight vectorDiff [0,0, ((_projectilePos select 2) - (_seekerTargetPos select 2)) * 0.5]; -} else { - if((_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget > 100) then { - _addHeight = _addHeight vectorAdd [0,0, _distanceToTarget*0.02]; - }; -}; - - - -TRACE_3("", _distanceToTarget,_distanceToShooter,_addHeight); - - _returnTargetPos = _seekerTargetPos vectorAdd _addHeight; - -#ifdef DEBUG_MODE_FULL -drawLine3D [(ASLtoATL _returnTargetPos) vectorAdd _addHeight, ASLtoATL _returnTargetPos, [0,1,0,1]]; -#endif - -TRACE_1("Adjusted target position", _returnTargetPos); -_returnTargetPos; \ No newline at end of file +_this call FUNC(attackProfile_LIN); \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_PYM.sqf b/addons/missileguidance/functions/fnc_attackProfile_PYM.sqf index e4776adcdf..498b754287 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_PYM.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_PYM.sqf @@ -1,4 +1,4 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" _this call FUNC(attackProfile_LIN); \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_TOP.sqf b/addons/missileguidance/functions/fnc_attackProfile_TOP.sqf index 0690877725..767f5df351 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_TOP.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_TOP.sqf @@ -1,4 +1,4 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); @@ -32,16 +32,14 @@ if( ((ASLtoATL _projectilePos) select 2) < 140 && _distanceToShooter < 50) then }; // Handle arcing terminal low for high decent -if( (_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget < 100) then { +if( (_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget < 140) then { _addHeight = _addHeight vectorDiff [0,0, ((_projectilePos select 2) - (_seekerTargetPos select 2)) * 0.5]; } else { - if((_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget > 100) then { - _addHeight = _addHeight vectorDiff [0,0, ((_projectilePos select 2) - (_seekerTargetPos select 2)) * 0.5]; + if((_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget > 140) then { + _addHeight = _addHeight vectorAdd [0,0, ((_projectilePos select 2) - (_seekerTargetPos select 2)) * 0.02]; }; }; - - TRACE_3("", _distanceToTarget,_distanceToShooter,_addHeight); _returnTargetPos = _seekerTargetPos vectorAdd _addHeight; diff --git a/addons/wep_javelin/functions/fnc_lockKeyDown.sqf b/addons/wep_javelin/functions/fnc_lockKeyDown.sqf index bc3198915b..2a537e2ae9 100644 --- a/addons/wep_javelin/functions/fnc_lockKeyDown.sqf +++ b/addons/wep_javelin/functions/fnc_lockKeyDown.sqf @@ -1,3 +1,3 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" TRACE_1("enter", _this); \ No newline at end of file diff --git a/addons/wep_javelin/functions/fnc_lockKeyUp.sqf b/addons/wep_javelin/functions/fnc_lockKeyUp.sqf index bc3198915b..2a537e2ae9 100644 --- a/addons/wep_javelin/functions/fnc_lockKeyUp.sqf +++ b/addons/wep_javelin/functions/fnc_lockKeyUp.sqf @@ -1,3 +1,3 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" TRACE_1("enter", _this); \ No newline at end of file From 0225cb510c3ea03642e9f085eff093a5e2e9063a Mon Sep 17 00:00:00 2001 From: jaynus Date: Fri, 10 Apr 2015 12:16:18 -0700 Subject: [PATCH 66/76] Add missile strings. --- addons/missileguidance/CfgAmmo.hpp | 16 ++++-- addons/missileguidance/stringtable.xml | 77 ++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 6 deletions(-) diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index 0a9b3de77a..c4953fa4a2 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -70,15 +70,19 @@ class CfgAmmo { }; class ACE_Hydra70_DAGR : M_PG_AT { - displayName = "ACE_Hydra70_DAGR"; - displayNameShort = "ACE_Hydra70_DAGR"; - descriptionShort = "ACE_Hydra70_DAGR"; + displayName = "$STR_ACE_Hydra70_DAGR"; + displayNameShort = "$STR_ACE_Hydra70_DAGR_Short"; + + description = "$STR_ACE_Hydra70_DAGR"; + descriptionShort = "$STR_ACE_Hydra70_DAGR_Desc"; }; class ACE_Hellfire_AGM114K : ACE_Hydra70_DAGR { - displayName = "ACE_Hellfire_AGM114K"; - displayNameShort = "ACE_Hellfire_AGM114K"; - descriptionShort = "ACE_Hellfire_AGM114K"; + displayName = "$STR_ACE_Hellfire_AGM114K"; + displayNameShort = "$STR_ACE_Hellfire_AGM114K_Short"; + + description = "$STR_ACE_Hellfire_AGM114K_desc"; + descriptionShort = "$STR_ACE_Hellfire_AGM114K_desc"; // @TODO: placeholder model to at least make it look different model = "\A3\Weapons_F\Ammo\Missile_AT_03_fly_F"; diff --git a/addons/missileguidance/stringtable.xml b/addons/missileguidance/stringtable.xml index b8076bddbf..fc17de4722 100644 --- a/addons/missileguidance/stringtable.xml +++ b/addons/missileguidance/stringtable.xml @@ -26,5 +26,82 @@ + + /* Weapons */ + + Hydra-70 DAGR Missile + + + + + + + + + + + + DAGR + + + + + + + + + + + + Hydra-70 DAGR Laser Guided Missile + + + + + + + + + + + + /* Weapons */ + + Hellfire II AGM-114K Missile + + + + + + + + + + + + AGM-114K + + + + + + + + + + + + Hellfire II AGM-114K Laser Guided Missile + + + + + + + + + + + \ No newline at end of file From 5577a541ca6c82e8e8e3404fe6e67667fa509fe0 Mon Sep 17 00:00:00 2001 From: jaynus Date: Fri, 10 Apr 2015 12:19:02 -0700 Subject: [PATCH 67/76] Add example. --- .../Example_ACE_MissileGuidance.hpp | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 addons/missileguidance/Example_ACE_MissileGuidance.hpp diff --git a/addons/missileguidance/Example_ACE_MissileGuidance.hpp b/addons/missileguidance/Example_ACE_MissileGuidance.hpp new file mode 100644 index 0000000000..400a3a9a41 --- /dev/null +++ b/addons/missileguidance/Example_ACE_MissileGuidance.hpp @@ -0,0 +1,65 @@ +THIS IS A WIP FUNCTIONALITY, DUE TO CHANGE + + + class M_PG_AT : MissileBase { + model = "\A3\Weapons_F\Ammo\Rocket_01_fly_F"; + proxyShape = "\A3\Weapons_F\Ammo\Rocket_01_F"; + + irLock = 0; + laserLock = 0; + airLock = 0; + weaponLockSystem = "2 + 16"; + + maxSpeed = 720; + maxControlRange = 5000; + maneuvrability = 8; + timeToLive = 60; + simulationStep = 0.01; + airFriction = 0.1; + sideAirFriction = 0.16; + initTime = 0.002; + thrustTime = 1.07; + thrust = 530; + fuseDistance = 2; + + effectsMissileInit = "MissileDAR1"; + effectsMissile = "missile2"; + whistleDist = 4; + muzzleEffect = ""; + + // Turn off arma crosshair-guidance + manualControl = 0; + + // ACE uses these values + trackOversteer = 1; + trackLead = 0; + + // Begin ACE guidance Configs + class ACE_MissileGuidance { + enabled = 1; + + minDeflection = 0.005; // Minium flap deflection for guidance + maxDeflection = 0.025; // Maximum flap deflection for guidance + incDeflection = 0.005; // The incrmeent in which deflection adjusts. + //minDeflection = 0.005; + //maxDeflection = 0.5; + //incDeflection = 0.005; + + // Guidance type for munitions + defaultSeekerType = "SALH"; + seekerTypes[] = { "SALH", "LIDAR", "SARH", "Optic", "Thermal", "GPS", "SACLOS", "MCLOS" }; + + defaultSeekerLockMode = "LOAL"; + seekerLockModes[] = { "LOAL", "LOBL" }; + + seekerAngle = 90; // Angle in front of the missile which can be searched + seekerAccuracy = 1; // seeker accuracy multiplier + + seekerMinRange = 1; + seekerMaxRange = 2500; // Range from the missile which the seeker can visually search + + // Attack profile type selection + defaultAttackProfile = "LIN"; + attackProfiles[] = { "LIN", "DIR", "MID", "HI", "TOP", "PYM" }; + }; + }; \ No newline at end of file From 661ddc3562ed5708a3e33e4403d1e439407380ee Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 10 Apr 2015 14:35:04 -0500 Subject: [PATCH 68/76] #441 - Crash with no model on ace_fakeweapon --- addons/common/CfgWeapons.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/common/CfgWeapons.hpp b/addons/common/CfgWeapons.hpp index 6035ee84bf..c2d1532f40 100644 --- a/addons/common/CfgWeapons.hpp +++ b/addons/common/CfgWeapons.hpp @@ -15,7 +15,7 @@ class CfgWeapons { class ACE_FakePrimaryWeapon: Rifle_Base_F { scope = 2; displayName = ""; - model = ""; + model = "\A3\Weapons_f\empty"; picture = ""; magazines[] = {"ACE_FakeMagazine"}; discreteDistance[] = {}; From 8429b262f23b0d9c9d0a20035936b391434c77b5 Mon Sep 17 00:00:00 2001 From: jaynus Date: Fri, 10 Apr 2015 12:40:58 -0700 Subject: [PATCH 69/76] more debug removal, backup vanilla usage. --- addons/missileguidance/CfgAmmo.hpp | 2 +- addons/missileguidance/XEH_pre_init.sqf | 1 + .../functions/fnc_attackProfile_AIR.sqf | 54 +++++++++++++++++++ .../functions/fnc_attackProfile_DIR.sqf | 2 +- .../functions/fnc_attackProfile_HI.sqf | 2 +- .../functions/fnc_attackProfile_LIN.sqf | 2 +- .../functions/fnc_attackProfile_MID.sqf | 2 +- .../missileguidance/functions/fnc_fired.sqf | 16 +++++- .../functions/fnc_guidancePFH.sqf | 2 +- .../functions/fnc_seekerType_Optic.sqf | 2 +- .../functions/fnc_seekerType_SALH.sqf | 2 +- 11 files changed, 78 insertions(+), 9 deletions(-) create mode 100644 addons/missileguidance/functions/fnc_attackProfile_AIR.sqf diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index c4953fa4a2..5aaee5ff2f 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -5,7 +5,7 @@ enum { class CfgAmmo { class MissileBase; - + class M_PG_AT : MissileBase { model = "\A3\Weapons_F\Ammo\Rocket_01_fly_F"; proxyShape = "\A3\Weapons_F\Ammo\Rocket_01_F"; diff --git a/addons/missileguidance/XEH_pre_init.sqf b/addons/missileguidance/XEH_pre_init.sqf index c58e1679a4..801a780b16 100644 --- a/addons/missileguidance/XEH_pre_init.sqf +++ b/addons/missileguidance/XEH_pre_init.sqf @@ -19,6 +19,7 @@ PREP(attackProfile_MID); PREP(attackProfile_HI); PREP(attackProfile_TOP); PREP(attackprofile_PYM); +PREP(attackProfile_AIR); // Seeker search functions PREP(seekerType_SALH); diff --git a/addons/missileguidance/functions/fnc_attackProfile_AIR.sqf b/addons/missileguidance/functions/fnc_attackProfile_AIR.sqf new file mode 100644 index 0000000000..d416b6a9e2 --- /dev/null +++ b/addons/missileguidance/functions/fnc_attackProfile_AIR.sqf @@ -0,0 +1,54 @@ +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"]; +private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos"]; +_seekerTargetPos = _this select 0; +_launchParams = _this select 1; + +_target = _launchParams select 0; +_targetLaunchParams = _launchParams select 1; + +_shooterPos = getPosASL _shooter; +_projectilePos = getPosASL _projectile; + +_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; +_distanceToShooter = _projectilePos vectorDistance _shooterPos; + +TRACE_2("", _distanceToTarget, _distanceToShooter); + +// Add height depending on distance for compensate +_addHeight = [0,0,0]; + +// Always climb an arc on initial launch if we are close to the round +if( ((ASLtoATL _projectilePos) select 2) < 5 && _distanceToShooter < 15) then { + _addHeight = _addHeight vectorAdd [0,0,_distanceToTarget]; +} else { + // If we are below the target, increase the climbing arc + if((_projectilePos select 2) < (_seekerTargetPos select 2) && _distanceToTarget > 100) then { + _addHeight = _addHeight vectorAdd [0,0, ((_seekerTargetPos select 2) - (_projectilePos select 2))]; + }; +}; + +// Handle arcing terminal low for high decent +if( (_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget < 100) then { + _addHeight = _addHeight vectorDiff [0,0, ((_projectilePos select 2) - (_seekerTargetPos select 2))]; +} else { + if((_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget > 100) then { + _addHeight = _addHeight vectorAdd [0,0, _distanceToTarget]; + }; +}; + + + +TRACE_3("", _distanceToTarget,_distanceToShooter,_addHeight); + + _returnTargetPos = _seekerTargetPos vectorAdd _addHeight; + +#ifdef DEBUG_MODE_FULL +drawLine3D [(ASLtoATL _returnTargetPos) vectorAdd _addHeight, ASLtoATL _returnTargetPos, [0,1,0,1]]; +#endif + +TRACE_1("Adjusted target position", _returnTargetPos); +_returnTargetPos; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf b/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf index e4776adcdf..498b754287 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf @@ -1,4 +1,4 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" _this call FUNC(attackProfile_LIN); \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_HI.sqf b/addons/missileguidance/functions/fnc_attackProfile_HI.sqf index e4776adcdf..498b754287 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_HI.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_HI.sqf @@ -1,4 +1,4 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" _this call FUNC(attackProfile_LIN); \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf index ce31b178c5..90ec75ad7f 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf @@ -1,4 +1,4 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); diff --git a/addons/missileguidance/functions/fnc_attackProfile_MID.sqf b/addons/missileguidance/functions/fnc_attackProfile_MID.sqf index e4776adcdf..498b754287 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_MID.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_MID.sqf @@ -1,4 +1,4 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" _this call FUNC(attackProfile_LIN); \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_fired.sqf b/addons/missileguidance/functions/fnc_fired.sqf index 4378fa0bc2..bb162e1f09 100644 --- a/addons/missileguidance/functions/fnc_fired.sqf +++ b/addons/missileguidance/functions/fnc_fired.sqf @@ -1,4 +1,4 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" // Bail if guidance is disabled @@ -36,6 +36,20 @@ if ( isNil "_lockMode" || { ! ( _lockMode in (getArray (_config >> "seekerLockMo _lockMode = getText (_config >> "defaultSeekerLockMode"); }; +// If we didn't get a target, try to fall back on tab locking +if(isNil "_target") then { + _canUseLock = getNumber (_config >> "canVanillaLock"); + if(_canUseLock > 0) then { + // @TODO: Get vanilla target + _vanillaTarget = cursorTarget; + + TRACE_1("Using Vanilla Locking", _vanillaTarget); + if(!isNil "_vanillaTarget") then { + _target = _vanillaTarget; + }; + }; +}; + TRACE_4("Beginning ACE guidance system",_target,_ammo,_seekerType,_attackProfile); [FUNC(guidancePFH), 0, [_this, [ACE_player, diff --git a/addons/missileguidance/functions/fnc_guidancePFH.sqf b/addons/missileguidance/functions/fnc_guidancePFH.sqf index a6de3d4219..976832a1cd 100644 --- a/addons/missileguidance/functions/fnc_guidancePFH.sqf +++ b/addons/missileguidance/functions/fnc_guidancePFH.sqf @@ -1,4 +1,4 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" #define TIMESTEP_FACTOR 0.01 diff --git a/addons/missileguidance/functions/fnc_seekerType_Optic.sqf b/addons/missileguidance/functions/fnc_seekerType_Optic.sqf index 90ed14f05a..3ce123d89c 100644 --- a/addons/missileguidance/functions/fnc_seekerType_Optic.sqf +++ b/addons/missileguidance/functions/fnc_seekerType_Optic.sqf @@ -1,4 +1,4 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); diff --git a/addons/missileguidance/functions/fnc_seekerType_SALH.sqf b/addons/missileguidance/functions/fnc_seekerType_SALH.sqf index 7fa23d028e..f4d36285d8 100644 --- a/addons/missileguidance/functions/fnc_seekerType_SALH.sqf +++ b/addons/missileguidance/functions/fnc_seekerType_SALH.sqf @@ -1,4 +1,4 @@ -#define DEBUG_MODE_FULL +//#define DEBUG_MODE_FULL #include "script_component.hpp" EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); From c8cff6e91c259b55993fbfa062630a7b805faf29 Mon Sep 17 00:00:00 2001 From: Tenga Date: Fri, 10 Apr 2015 21:48:18 +0200 Subject: [PATCH 70/76] - Added isFeatureCameraActive to ace_common - ace_goggles_fnc_externalCamera now checks for cameras made by a BI feature --- addons/common/XEH_preInit.sqf | 1 + .../functions/fnc_isFeatureCameraActive.sqf | 31 +++++++++++++++++++ .../goggles/functions/fnc_externalCamera.sqf | 3 +- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 addons/common/functions/fnc_isFeatureCameraActive.sqf diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index a88c349180..e7169f1d23 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -107,6 +107,7 @@ PREP(isAutoWind); PREP(isAwake); PREP(isEngineer); PREP(isEOD); +PREP(isFeatureCameraActive); PREP(isInBuilding); PREP(isModLoaded); PREP(isPlayer); diff --git a/addons/common/functions/fnc_isFeatureCameraActive.sqf b/addons/common/functions/fnc_isFeatureCameraActive.sqf new file mode 100644 index 0000000000..dd60a90709 --- /dev/null +++ b/addons/common/functions/fnc_isFeatureCameraActive.sqf @@ -0,0 +1,31 @@ +/* + * Author: Sniperwolf572 + * + * Checks if one of the following BI feature cameras are active: + * + * - Classic camera (BIS_fnc_cameraOld) + * - Splendid camera (BIS_fnc_camera) + * - Arsenal camera (BIS_fnc_arsenal) + * - Animation viewer (BIS_fnc_animViewer) + * - Establishing shot (BIS_fnc_establishingShot) + * + * Arguments: + * None + * + * Return value: + * Is BI feature camera active (bool) + * + * Example: + * call ace_common_fnc_isFeatureCameraActive; + * + */ + +#include "script_component.hpp" + +( + !isNull (missionNamespace getVariable ["BIS_DEBUG_CAM", objNull]) || // Classic camera + {!isNull (missionNamespace getVariable ["BIS_fnc_camera_cam", objNull])} || // Splendid camera + {!isNull (uiNamespace getVariable ["BIS_fnc_arsenal_cam", objNull])} || // Arsenal camera + {!isNull (uiNamespace getVariable ["BIS_fnc_animViewer_cam", objNull])} || // Animation viewer camera + {!isNull (missionNamespace getVariable ["BIS_fnc_establishingShot_fakeUAV", objNull])} // Establishing shot camera +) \ No newline at end of file diff --git a/addons/goggles/functions/fnc_externalCamera.sqf b/addons/goggles/functions/fnc_externalCamera.sqf index 0a098cf8be..ddc05e6b87 100644 --- a/addons/goggles/functions/fnc_externalCamera.sqf +++ b/addons/goggles/functions/fnc_externalCamera.sqf @@ -16,4 +16,5 @@ #include "script_component.hpp" if (GVAR(showInThirdPerson)) exitWith { false }; -(cameraView == "EXTERNAL" || cameraView == "GROUP") + +(cameraView in ["EXTERNAL", "GROUP"] || {call EFUNC(common,isFeatureCameraActive)}) From 229590ed2045ce910595dcc93b3cb72430d22a23 Mon Sep 17 00:00:00 2001 From: Tenga Date: Fri, 10 Apr 2015 21:54:47 +0200 Subject: [PATCH 71/76] Formatting fixes for fnc_isFeatureCameraActive and fnc_externalCamera --- addons/common/functions/fnc_isFeatureCameraActive.sqf | 2 +- addons/goggles/functions/fnc_externalCamera.sqf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/common/functions/fnc_isFeatureCameraActive.sqf b/addons/common/functions/fnc_isFeatureCameraActive.sqf index dd60a90709..250beaa3ca 100644 --- a/addons/common/functions/fnc_isFeatureCameraActive.sqf +++ b/addons/common/functions/fnc_isFeatureCameraActive.sqf @@ -23,7 +23,7 @@ #include "script_component.hpp" ( - !isNull (missionNamespace getVariable ["BIS_DEBUG_CAM", objNull]) || // Classic camera + !isNull (missionNamespace getVariable ["BIS_DEBUG_CAM", objNull]) || // Classic camera {!isNull (missionNamespace getVariable ["BIS_fnc_camera_cam", objNull])} || // Splendid camera {!isNull (uiNamespace getVariable ["BIS_fnc_arsenal_cam", objNull])} || // Arsenal camera {!isNull (uiNamespace getVariable ["BIS_fnc_animViewer_cam", objNull])} || // Animation viewer camera diff --git a/addons/goggles/functions/fnc_externalCamera.sqf b/addons/goggles/functions/fnc_externalCamera.sqf index ddc05e6b87..be762ab4af 100644 --- a/addons/goggles/functions/fnc_externalCamera.sqf +++ b/addons/goggles/functions/fnc_externalCamera.sqf @@ -17,4 +17,4 @@ if (GVAR(showInThirdPerson)) exitWith { false }; -(cameraView in ["EXTERNAL", "GROUP"] || {call EFUNC(common,isFeatureCameraActive)}) +(cameraView in ["EXTERNAL", "GROUP"] || {call EFUNC(common,isFeatureCameraActive)}) \ No newline at end of file From b710c2543e1d184b6b389bb7f9f073c850116424 Mon Sep 17 00:00:00 2001 From: Tenga Date: Fri, 10 Apr 2015 21:59:28 +0200 Subject: [PATCH 72/76] Return the newline to fnc_externalCamera.sqf --- addons/goggles/functions/fnc_externalCamera.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/goggles/functions/fnc_externalCamera.sqf b/addons/goggles/functions/fnc_externalCamera.sqf index be762ab4af..ddc05e6b87 100644 --- a/addons/goggles/functions/fnc_externalCamera.sqf +++ b/addons/goggles/functions/fnc_externalCamera.sqf @@ -17,4 +17,4 @@ if (GVAR(showInThirdPerson)) exitWith { false }; -(cameraView in ["EXTERNAL", "GROUP"] || {call EFUNC(common,isFeatureCameraActive)}) \ No newline at end of file +(cameraView in ["EXTERNAL", "GROUP"] || {call EFUNC(common,isFeatureCameraActive)}) From adc7db9ae9b9e3c457726a5b234edd32900b3d4a Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 10 Apr 2015 15:02:36 -0500 Subject: [PATCH 73/76] #456 - Fix AI rotating while dead (disableAI func) Still some small head movements, but I don't know how to fix that. --- addons/common/functions/fnc_disableAI.sqf | 42 ++++++++++++------- .../medical/functions/fnc_setUnconscious.sqf | 2 +- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/addons/common/functions/fnc_disableAI.sqf b/addons/common/functions/fnc_disableAI.sqf index 9e1bf59a6f..92ad35c0f9 100644 --- a/addons/common/functions/fnc_disableAI.sqf +++ b/addons/common/functions/fnc_disableAI.sqf @@ -1,23 +1,37 @@ -/** - * fn_disableAI_f.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal, KoffeinFlummi + * Disables/Enables AI * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * 0: Unit + * 1: Disable AI + * + * Return Value: + * None + * + * Example: + * [bob, true] call ace_common_fnc_disableAI; + * + * Public: No */ #include "script_component.hpp" -private ["_unit","_disable"]; -_unit = [_this, 0,ObjNull,[ObjNull]] call BIS_fnc_Param; -_disable = [_this, 1,false,[false]] call BIS_fnc_Param; -if (local _unit && !(IsPlayer _unit)) then { +PARAMS_2(_unit,_disable); + +if ((local _unit) && {!([_unit] call EFUNC(common,isPlayer))}) then { if (_disable) then { - _unit disableAI "Move"; + _unit disableAI "MOVE"; _unit disableAI "TARGET"; + _unit disableAI "AUTOTARGET"; + _unit disableAI "FSM"; + _unit disableConversation true; } else { - _unit enableAI "Move"; + //Sanity check to make sure we don't enable unconsious AI + if (_unit getVariable ["ace_isunconscious", false]) exitWith {ERROR("Enabling AI for unconsious unit");}; + _unit enableAI "MOVE"; _unit enableAI "TARGET"; + _unit enableAI "AUTOTARGET"; + _unit enableAI "FSM"; + _unit disableConversation false; }; -}; \ No newline at end of file +}; diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index c518b93a97..e373901610 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -116,7 +116,7 @@ _startingTime = time; // Swhich the unit back to its original group [_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide); - [_unit, false] call EFUNC(common,disableAI_F); + [_unit, false] call EFUNC(common,disableAI); _unit setUnitPos _originalPos; // This is not position but stance (DOWN, MIDDLE, UP) _unit setUnconscious false; From 4188893839602b7c5d09a0cb14622274706697c5 Mon Sep 17 00:00:00 2001 From: jaynus Date: Fri, 10 Apr 2015 14:23:55 -0700 Subject: [PATCH 74/76] Move spatial model translations to ace_common --- addons/common/XEH_preInit.sqf | 3 +++ .../functions/fnc_translateToModelSpace.sqf | 0 .../functions/fnc_translateToWeaponSpace.sqf | 0 addons/missileguidance/XEH_pre_init.sqf | 3 --- addons/missileguidance/functions/fnc_guidancePFH.sqf | 4 ++-- 5 files changed, 5 insertions(+), 5 deletions(-) rename addons/{missileguidance => common}/functions/fnc_translateToModelSpace.sqf (100%) rename addons/{missileguidance => common}/functions/fnc_translateToWeaponSpace.sqf (100%) diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index e7169f1d23..3b47153c7a 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -178,6 +178,9 @@ PREP(useItem); PREP(useMagazine); PREP(waitAndExecute); +PREP(translateToWeaponSpace); +PREP(translateToModelSpace); + // config items PREP(getConfigType); PREP(getItemType); diff --git a/addons/missileguidance/functions/fnc_translateToModelSpace.sqf b/addons/common/functions/fnc_translateToModelSpace.sqf similarity index 100% rename from addons/missileguidance/functions/fnc_translateToModelSpace.sqf rename to addons/common/functions/fnc_translateToModelSpace.sqf diff --git a/addons/missileguidance/functions/fnc_translateToWeaponSpace.sqf b/addons/common/functions/fnc_translateToWeaponSpace.sqf similarity index 100% rename from addons/missileguidance/functions/fnc_translateToWeaponSpace.sqf rename to addons/common/functions/fnc_translateToWeaponSpace.sqf diff --git a/addons/missileguidance/XEH_pre_init.sqf b/addons/missileguidance/XEH_pre_init.sqf index 801a780b16..873715fef8 100644 --- a/addons/missileguidance/XEH_pre_init.sqf +++ b/addons/missileguidance/XEH_pre_init.sqf @@ -3,9 +3,6 @@ PREP(rotateVectLineGetMap); PREP(rotateVectLine); -PREP(translateToModelSpace); -PREP(translateToWeaponSpace); - PREP(fired); PREP(guidancePFH); diff --git a/addons/missileguidance/functions/fnc_guidancePFH.sqf b/addons/missileguidance/functions/fnc_guidancePFH.sqf index 976832a1cd..7041201ded 100644 --- a/addons/missileguidance/functions/fnc_guidancePFH.sqf +++ b/addons/missileguidance/functions/fnc_guidancePFH.sqf @@ -43,7 +43,7 @@ if(!isNil "_seekerTargetPos") then { _projectilePos = getPosASL _projectile; - _targetVectorSeeker = [_projectile, [_xVec, _yVec, _zVec], _profileAdjustedTargetPos] call FUNC(translateToWeaponSpace); + _targetVectorSeeker = [_projectile, [_xVec, _yVec, _zVec], _profileAdjustedTargetPos] call EFUNC(common,translateToWeaponSpace); _targetVector = [0,0,0] vectorFromTo _targetVectorSeeker; TRACE_1("", _targetVectorSeeker, _targetVector); @@ -80,7 +80,7 @@ if(!isNil "_seekerTargetPos") then { // @TODO: Apply velocity multiplier to yaw/pitch. Basically, it can adjust faster at lower speeds //_adjustDeflection = (vectorMagnitude velocity _projectile); - _outVector = [_projectile, [_xVec, _yVec, _zVec], [_yaw, _adjustTime, _pitch]] call FUNC(translateToModelSpace); + _outVector = [_projectile, [_xVec, _yVec, _zVec], [_yaw, _adjustTime, _pitch]] call EFUNC(common,translateToModelSpace); _vectorTo = _projectilePos vectorFromTo _outVector; _projectile setVectorDirAndUp [_vectorTo, vectorUp _projectile]; From eeb94b617fa48bac1a2a02e6eb8f460e71c27137 Mon Sep 17 00:00:00 2001 From: bux578 Date: Sat, 11 Apr 2015 08:14:38 +0200 Subject: [PATCH 75/76] add x64 make.py takes into account that mikero's tools are in Wow6432Node --- tools/make64.py | 828 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 828 insertions(+) create mode 100644 tools/make64.py diff --git a/tools/make64.py b/tools/make64.py new file mode 100644 index 0000000000..61dee96310 --- /dev/null +++ b/tools/make64.py @@ -0,0 +1,828 @@ +#!/usr/bin/env python +# vim: set fileencoding=utf-8 : + +# make.py +# An Arma 3 addon build system + +############################################################################### + +# The MIT License (MIT) + +# Copyright (c) 2013-2014 Ryan Schultz + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +############################################################################### + +__version__ = "0.3dev" + +import sys + +if sys.version_info[0] == 2: + print("Python 3 is required.") + sys.exit(1) + +import os +import os.path +import shutil +import platform +import glob +import subprocess +import hashlib +import configparser +import json +import traceback +import time +import re + +if sys.platform == "win32": + import winreg + +############################################################################### +# http://akiscode.com/articles/sha-1directoryhash.shtml +# Copyright (c) 2009 Stephen Akiki +# MIT License (Means you can do whatever you want with this) +# See http://www.opensource.org/licenses/mit-license.php +# Error Codes: +# -1 -> Directory does not exist +# -2 -> General error (see stack traceback) +def get_directory_hash(directory): + directory_hash = hashlib.sha1() + if not os.path.exists (directory): + return -1 + + try: + for root, dirs, files in os.walk(directory): + for names in files: + path = os.path.join(root, names) + try: + f = open(path, 'rb') + except: + # You can't open the file for some reason + f.close() + continue + + while 1: + # Read file in as little chunks + buf = f.read(4096) + if not buf: break + new = hashlib.sha1(buf) + directory_hash.update(new.digest()) + f.close() + + except: + # Print the stack traceback + traceback.print_exc() + return -2 + + return directory_hash.hexdigest() + +# Copyright (c) André Burgaud +# http://www.burgaud.com/bring-colors-to-the-windows-console-with-python/ +if sys.platform == "win32": + from ctypes import windll, Structure, c_short, c_ushort, byref + + SHORT = c_short + WORD = c_ushort + + class COORD(Structure): + """struct in wincon.h.""" + _fields_ = [ + ("X", SHORT), + ("Y", SHORT)] + + class SMALL_RECT(Structure): + """struct in wincon.h.""" + _fields_ = [ + ("Left", SHORT), + ("Top", SHORT), + ("Right", SHORT), + ("Bottom", SHORT)] + + class CONSOLE_SCREEN_BUFFER_INFO(Structure): + """struct in wincon.h.""" + _fields_ = [ + ("dwSize", COORD), + ("dwCursorPosition", COORD), + ("wAttributes", WORD), + ("srWindow", SMALL_RECT), + ("dwMaximumWindowSize", COORD)] + + # winbase.h + STD_INPUT_HANDLE = -10 + STD_OUTPUT_HANDLE = -11 + STD_ERROR_HANDLE = -12 + + # wincon.h + FOREGROUND_BLACK = 0x0000 + FOREGROUND_BLUE = 0x0001 + FOREGROUND_GREEN = 0x0002 + FOREGROUND_CYAN = 0x0003 + FOREGROUND_RED = 0x0004 + FOREGROUND_MAGENTA = 0x0005 + FOREGROUND_YELLOW = 0x0006 + FOREGROUND_GREY = 0x0007 + FOREGROUND_INTENSITY = 0x0008 # foreground color is intensified. + + BACKGROUND_BLACK = 0x0000 + BACKGROUND_BLUE = 0x0010 + BACKGROUND_GREEN = 0x0020 + BACKGROUND_CYAN = 0x0030 + BACKGROUND_RED = 0x0040 + BACKGROUND_MAGENTA = 0x0050 + BACKGROUND_YELLOW = 0x0060 + BACKGROUND_GREY = 0x0070 + BACKGROUND_INTENSITY = 0x0080 # background color is intensified. + + stdout_handle = windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE) + SetConsoleTextAttribute = windll.kernel32.SetConsoleTextAttribute + GetConsoleScreenBufferInfo = windll.kernel32.GetConsoleScreenBufferInfo + + def get_text_attr(): + """Returns the character attributes (colors) of the console screen + buffer.""" + csbi = CONSOLE_SCREEN_BUFFER_INFO() + GetConsoleScreenBufferInfo(stdout_handle, byref(csbi)) + return csbi.wAttributes + + def set_text_attr(color): + """Sets the character attributes (colors) of the console screen + buffer. Color is a combination of foreground and background color, + foreground and background intensity.""" + SetConsoleTextAttribute(stdout_handle, color) +############################################################################### + +def find_bi_tools(work_drive): + """Find BI tools.""" + + reg = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER) + try: + k = winreg.OpenKey(reg, r"Software\bohemia interactive\arma 3 tools") + arma3tools_path = winreg.QueryValueEx(k, "path")[0] + winreg.CloseKey(k) + except: + raise Exception("BadTools","Arma 3 Tools are not installed correctly or the P: drive needs to be created.") + + addonbuilder_path = os.path.join(arma3tools_path, "AddonBuilder", "AddonBuilder.exe") + dssignfile_path = os.path.join(arma3tools_path, "DSSignFile", "DSSignFile.exe") + dscreatekey_path = os.path.join(arma3tools_path, "DSSignFile", "DSCreateKey.exe") + cfgconvert_path = os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe") + + if os.path.isfile(addonbuilder_path) and os.path.isfile(dssignfile_path) and os.path.isfile(dscreatekey_path) and os.path.isfile(cfgconvert_path): + return [addonbuilder_path, dssignfile_path, dscreatekey_path, cfgconvert_path] + else: + raise Exception("BadTools","Arma 3 Tools are not installed correctly or the P: drive needs to be created.") + +def find_depbo_tools(regKey): + """Use registry entries to find DePBO-based tools.""" + stop = False + + if regKey == "HKCU": + reg = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER) + stop = True + else: + reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) + + try: + k = winreg.OpenKey(reg, r"Software\Wow6432Node\Mikero\pboProject") + try: + pboproject_path = winreg.QueryValueEx(k, "exe")[0] + winreg.CloseKey(k) + print("Found pboproject.") + except: + print_error("ERROR: Could not find pboProject.") + + k = winreg.OpenKey(reg, r"Software\Wow6432Node\Mikero\rapify") + try: + rapify_path = winreg.QueryValueEx(k, "exe")[0] + winreg.CloseKey(k) + print("Found rapify.") + except: + print_error("Could not find rapify.") + + k = winreg.OpenKey(reg, r"Software\Wow6432Node\Mikero\MakePbo") + try: + makepbo_path = winreg.QueryValueEx(k, "exe")[0] + winreg.CloseKey(k) + print("Found makepbo.") + except: + print_error("Could not find makepbo.") + except: + if stop == True: + raise Exception("BadDePBO", "DePBO tools not installed correctly") + return -1 + + + #Strip any quotations from the path due to a MikeRo tool bug which leaves a trailing space in some of its registry paths. + return [pboproject_path.strip('"'),rapify_path.strip('"'),makepbo_path.strip('"')] + +def color(color): + """Set the color. Works on Win32 and normal terminals.""" + if sys.platform == "win32": + if color == "green": + set_text_attr(FOREGROUND_GREEN | get_text_attr() & 0x0070 | FOREGROUND_INTENSITY) + elif color == "red": + set_text_attr(FOREGROUND_RED | get_text_attr() & 0x0070 | FOREGROUND_INTENSITY) + elif color == "blue": + set_text_attr(FOREGROUND_BLUE | get_text_attr() & 0x0070 | FOREGROUND_INTENSITY) + elif color == "reset": + set_text_attr(FOREGROUND_GREY | get_text_attr() & 0x0070) + elif color == "grey": + set_text_attr(FOREGROUND_GREY | get_text_attr() & 0x0070) + else : + if color == "green": + sys.stdout.write('\033[92m') + elif color == "red": + sys.stdout.write('\033[91m') + elif color == "blue": + sys.stdout.write('\033[94m') + elif color == "reset": + sys.stdout.write('\033[0m') + +def print_error(msg): + color("red") + print ("ERROR: " + msg) + color("reset") + +def print_green(msg): + color("green") + print(msg) + color("reset") + +def print_blue(msg): + color("blue") + print(msg) + color("reset") + +def print_yellow(msg): + color("yellow") + print(msg) + color("reset") + +############################################################################### + +def main(argv): + """Build an Arma addon suite in a directory from rules in a make.cfg file.""" + print_blue(("\nmake.py for Arma, v" + __version__)) + + if sys.platform != "win32": + print_error("Non-Windows platform (Cygwin?). Please re-run from cmd.") + sys.exit(1) + + reg = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER) + try: + k = winreg.OpenKey(reg, r"Software\bohemia interactive\arma 3 tools") + arma3tools_path = winreg.QueryValueEx(k, "path")[0] + winreg.CloseKey(k) + except: + raise Exception("BadTools","Arma 3 Tools are not installed correctly or the P: drive needs to be created.") + + # Default behaviors + test = False # Copy to Arma 3 directory? + arg_modules = False # Only build modules on command line? + make_release = False # Make zip file from the release? + release_version = 0 # Version of release + use_pboproject = True # Default to pboProject build tool + make_target = "DEFAULT" # Which section in make.cfg to use for the build + new_key = False # Make a new key and use it to sign? + quiet = False # Suppress output from build tool? + + # Parse arguments + if "help" in argv or "-h" in argv or "--help" in argv: + print (""" +make.py [help] [test] [force] [key ] [target ] [release ] + [module name] [module name] [...] + +test -- Copy result to Arma 3. +release -- Make archive with . +force -- Ignore cache and build all. +target -- Use rules in make.cfg under heading [] rather than + default [Make] +key -- Use key in working directory with to sign. If it does not + exist, create key. +quiet -- Suppress command line output from build tool. + +If module names are specified, only those modules will be built. + +Examples: + make.py force test + Build all modules (ignoring cache) and copy the mod folder to the Arma 3 + directory. + make.py mymodule_gun + Only build the module named 'mymodule_gun'. + make.py force key MyNewKey release 1.0 + Build all modules (ignoring cache), sign them with NewKey, and pack them + into a zip file for release with version 1.0. + + +If a file called $NOBIN$ is found in the module directory, that module will not be binarized. + +See the make.cfg file for additional build options. +""") + sys.exit(0) + + if "force" in argv: + argv.remove("force") + force_build = True + else: + force_build = False + + if "test" in argv: + test = True + argv.remove("test") + + if "release" in argv: + make_release = True + release_version = argv[argv.index("release") + 1] + argv.remove(release_version) + argv.remove("release") + + if "target" in argv: + make_target = argv[argv.index("target") + 1] + argv.remove("target") + argv.remove(make_target) + force_build = True + + if "key" in argv: + new_key = True + key_name = argv[argv.index("key") + 1] + argv.remove("key") + argv.remove(key_name) + + if "quiet" in argv: + quiet = True + argv.remove("quiet") + + # Get the directory the make script is in. + make_root = os.path.dirname(os.path.realpath(__file__)) + make_root_parent = os.path.abspath(os.path.join(os.getcwd(), os.pardir)) + os.chdir(make_root) + + # Get latest commit ID + try: + gitpath = os.path.join(os.path.dirname(make_root), ".git") + assert os.path.exists(gitpath) + + commit_id = subprocess.check_output(["git", "rev-parse", "HEAD"]) + commit_id = str(commit_id, "utf-8")[:8] + except: + print_error("FAILED TO DETERMINE COMMIT ID.") + commit_id = "NOGIT" + + cfg = configparser.ConfigParser(); + try: + cfg.read(os.path.join(make_root, "make.cfg")) + + # Project name (with @ symbol) + project = cfg.get(make_target, "project", fallback="@"+os.path.basename(os.getcwd())) + + # Private key path + key = cfg.get(make_target, "key", fallback=None) + + # Project prefix (folder path) + prefix = cfg.get(make_target, "prefix", fallback="") + + # Should we autodetect modules on a complete build? + module_autodetect = cfg.getboolean(make_target, "module_autodetect", fallback=True) + + # Manual list of modules to build for a complete build + modules = cfg.get(make_target, "modules", fallback=None) + # Parse it out + if modules: + modules = [x.strip() for x in modules.split(',')] + else: + modules = [] + + # List of directories to ignore when detecting + ignore = [x.strip() for x in cfg.get(make_target, "ignore", fallback="release").split(',')] + + # BI Tools work drive on Windows + work_drive = cfg.get(make_target, "work_drive", fallback="P:\\") + + # Which build tool should we use? + build_tool = cfg.get(make_target, "build_tool", fallback="addonbuilder").lower() + + # Release/build directory, relative to script dir + release_dir = cfg.get(make_target, "release_dir", fallback="release") + + # Project PBO file prefix (files are renamed to prefix_name.pbo) + pbo_name_prefix = cfg.get(make_target, "pbo_name_prefix", fallback=None) + + # Project module Root + module_root_parent = os.path.abspath(os.path.join(os.path.join(work_drive, prefix), os.pardir)) + module_root = cfg.get(make_target, "module_root", fallback=os.path.join(make_root_parent, "addons")) + print_green ("module_root: " + module_root) + if (os.path.isdir(module_root)): + os.chdir(module_root) + else: + print_error ("Directory " + module_root + " does not exist.") + sys.exit() + + except: + raise + print_error("Could not parse make.cfg.") + sys.exit(1) + + + + # See if we have been given specific modules to build from command line. + if len(argv) > 1 and not make_release: + arg_modules = True + modules = argv[1:] + + # Find the tools we need. + try: + tools = find_bi_tools(work_drive) + addonbuilder = tools[0] + dssignfile = tools[1] + dscreatekey = tools[2] + cfgconvert = tools[3] + + except: + print_error("Arma 3 Tools are not installed correctly or the P: drive has not been created.") + sys.exit(1) + + if build_tool == "pboproject": + try: + depbo_tools = find_depbo_tools("HKLM") + if depbo_tools == -1: + depbo_tools = find_depbo_tools("HKCU") + pboproject = depbo_tools[0] + rapifyTool = depbo_tools[1] + makepboTool = depbo_tools[2] + except: + raise + print_error("Could not find dePBO tools. Download the needed tools from: https://dev.withsix.com/projects/mikero-pbodll/files") + sys.exit(1) + + # Try to open and deserialize build cache file. + try: + cache = {} + with open(os.path.join(make_root, "make.cache"), 'r') as f: + cache_raw = f.read() + + cache = json.loads(cache_raw) + + except: + print ("No cache found.") + cache = {} + + # Get list of subdirs in make root. + dirs = next(os.walk(module_root))[1] + + # Autodetect what directories to build. + if module_autodetect and not arg_modules: + modules = [] + for path in dirs: + # Any dir that has a config.cpp in its root is an addon to build. + config_path = os.path.join(path, 'config.cpp') + if os.path.isfile(config_path) and not path in ignore: + modules.append(path) + + # Make the key specified from command line if necessary. + if new_key: + if not os.path.isfile(os.path.join(module_root, key_name + ".biprivatekey")): + print_green("\nRequested key does not exist.") + ret = subprocess.call([dscreatekey, key_name]) # Created in make_root + if ret == 0: + print_blue("Created: " + os.path.join(module_root, key_name + ".biprivatekey")) + else: + print_error("Failed to create key!") + + try: + print_blue("Copying public key to release directory.") + + try: + os.makedirs(os.path.join(module_root, release_dir, "Keys")) + except: + pass + + shutil.copyfile(os.path.join(module_root, key_name + ".bikey"), os.path.join(module_root, release_dir, "Keys", key_name + ".bikey")) + + except: + raise + print_error("Could not copy key to release directory.") + + else: + print_green("\nNOTE: Using key " + os.path.join(module_root, key_name + ".biprivatekey")) + + key = os.path.join(module_root, key_name + ".biprivatekey") + + + # For each module, prep files and then build. + for module in modules: + print_green("\nMaking " + module + "-"*max(1, (60-len(module)))) + + # Cache check + if module in cache: + old_sha = cache[module] + else: + old_sha = "" + + # Hash the module + new_sha = get_directory_hash(os.path.join(module_root, module)) + + # Check if it needs rebuilt + # print ("Hash:", new_sha) + if old_sha == new_sha: + if not force_build: + print("Module has not changed.") + # Skip everything else + continue + + # Only do this if the project isn't stored directly on the work drive. + # Split the path at the drive name and see if they are on the same drive (usually P:) + if os.path.splitdrive(module_root)[0] != os.path.splitdrive(work_drive)[0]: + try: + # Remove old work drive version (ignore errors) + shutil.rmtree(os.path.join(work_drive, prefix, module), True) + + # Copy module to the work drive + shutil.copytree(module, os.path.join(work_drive, prefix, module)) + + except: + raise + print_error("ERROR: Could not copy module to work drive. Does the module exist?") + input("Press Enter to continue...") + print("Resuming build...") + continue + #else: + #print("WARNING: Module is stored on work drive (" + work_drive + ").") + + try: + # Remove the old pbo, key, and log + old = os.path.join(module_root, release_dir, project, "Addons", module) + "*" + files = glob.glob(old) + for f in files: + os.remove(f) + + if pbo_name_prefix: + old = os.path.join(module_root, release_dir, project, "Addons", pbo_name_prefix+module) + "*" + files = glob.glob(old) + for f in files: + os.remove(f) + except: + raise + print_error("ERROR: Could not copy module to work drive. Does the module exist?") + input("Press Enter to continue...") + print("Resuming build...") + continue + + # Build the module into a pbo + print_blue("Building: " + os.path.join(work_drive, prefix, module)) + print_blue("Destination: " + os.path.join(module_root, release_dir, project, "Addons")) + + # Make destination folder (if needed) + try: + os.makedirs(os.path.join(module_root, release_dir, project, "Addons")) + except: + pass + + # Run build tool + build_successful = False + if build_tool == "pboproject": + try: + #PABST: Convert config (run the macro'd config.cpp through CfgConvert twice to produce a de-macro'd cpp that pboProject can read without fucking up: + shutil.copyfile(os.path.join(work_drive, prefix, module, "config.cpp"), os.path.join(work_drive, prefix, module, "config.backup")) + + os.chdir("P:\\") + + cmd = [os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe"), "-bin", "-dst", os.path.join(work_drive, prefix, module, "config.bin"), os.path.join(work_drive, prefix, module, "config.cpp")] + ret = subprocess.call(cmd) + if ret != 0: + print_error("CfgConvert -bin return code == " + str(ret)) + input("Press Enter to continue...") + + cmd = [os.path.join(arma3tools_path, "CfgConvert", "CfgConvert.exe"), "-txt", "-dst", os.path.join(work_drive, prefix, module, "config.cpp"), os.path.join(work_drive, prefix, module, "config.bin")] + ret = subprocess.call(cmd) + if ret != 0: + print_error("CfgConvert -txt) return code == " + str(ret)) + input("Press Enter to continue...") + + # Include build number + try: + configpath = os.path.join(work_drive, prefix, module, "config.cpp") + f = open(configpath, "r") + configtext = f.read() + f.close() + + patchestext = re.search(r"class CfgPatches\n\{(.*?)\n\}", configtext, re.DOTALL).group(1) + patchestext = re.sub(r'version(.*?)="(.*?)"', r'version\1="\2-{}"'.format(commit_id), patchestext) + configtext = re.sub(r"class CfgPatches\n\{(.*?)\n\}", "class CfgPatches\n{"+patchestext+"\n}", configtext, flags=re.DOTALL) + + f = open(configpath, "w") + f.write(configtext) + f.close() + except: + raise + print_error("Failed to include build number") + continue + + if os.path.isfile(os.path.join(work_drive, prefix, module, "$NOBIN$")): + print_green("$NOBIN$ Found. Proceeding with non-binarizing!") + cmd = [makepboTool, "-P","-A","-L","-N","-G", os.path.join(work_drive, prefix, module),os.path.join(module_root, release_dir, project,"Addons")] + + else: + cmd = [pboproject, "-P", os.path.join(work_drive, prefix, module), "+Engine=Arma3", "-S","+Noisy", "+X", "+Clean", "+Mod="+os.path.join(module_root, release_dir, project), "-Key"] + + color("grey") + if quiet: + devnull = open(os.devnull, 'w') + ret = subprocess.call(cmd, stdout=devnull) + devnull.close() + else: + ret = subprocess.call(cmd) + color("reset") + + if ret == 0: + print_green("pboProject return code == " + str(ret)) + # Prettyprefix rename the PBO if requested. + if pbo_name_prefix: + try: + os.rename(os.path.join(module_root, release_dir, project, "Addons", module+".pbo"), os.path.join(module_root, release_dir, project, "Addons", pbo_name_prefix+module+".pbo")) + except: + raise + print_error("Could not rename built PBO with prefix.") + # Sign result + if key: + print("Signing with " + key + ".") + if pbo_name_prefix: + ret = subprocess.call([dssignfile, key, os.path.join(module_root, release_dir, project, "Addons", pbo_name_prefix + module + ".pbo")]) + else: + ret = subprocess.call([dssignfile, key, os.path.join(module_root, release_dir, project, "Addons", module + ".pbo")]) + + if ret == 0: + build_successful = True + else: + build_successful = True + + if not build_successful: + print_error("pboProject return code == " + str(ret)) + print_error("Module not successfully built/signed.") + input("Press Enter to continue...") + print ("Resuming build...") + continue + + #PABST: cleanup config BS (you could comment this out to see the "de-macroed" cpp + #print_green("\Pabst (restoring): " + os.path.join(work_drive, prefix, module, "config.cpp")) + os.remove(os.path.join(work_drive, prefix, module, "config.cpp")) + os.remove(os.path.join(work_drive, prefix, module, "config.bin")) + os.rename(os.path.join(work_drive, prefix, module, "config.backup"), os.path.join(work_drive, prefix, module, "config.cpp")) + + # Back to the root + os.chdir(module_root) + + except: + raise + print_error("Could not run Addon Builder.") + input("Press Enter to continue...") + print ("Resuming build...") + continue + + elif build_tool== "addonbuilder": + # Detect $NOBIN$ and do not binarize if found. + if os.path.isfile(os.path.join(work_drive, prefix, module, "$NOBIN$")): + do_binarize = False + print("$NOBIN$ file found in module, packing only.") + else: + do_binarize = True + try: + # Call AddonBuilder + os.chdir("P:\\") + + cmd = [addonbuilder, os.path.join(work_drive, prefix, module), os.path.join(make_root, release_dir, project, "Addons"), "-clear", "-project="+work_drive] + if not do_binarize: + cmd.append("-packonly") + + if quiet: + previousDirectory = os.getcwd() + os.chdir(arma3tools_path) + devnull = open(os.devnull, 'w') + ret = subprocess.call(cmd, stdout=devnull) + devnull.close() + os.chdir(previousDirectory) + else: + previousDirectory = os.getcwd() + os.chdir(arma3tools_path) + print_error("Current directory - " + os.getcwd()) + ret = subprocess.call(cmd) + os.chdir(previousDirectory) + print_error("Current directory - " + os.getcwd()) + color("reset") + print_green("completed") + # Prettyprefix rename the PBO if requested. + if pbo_name_prefix: + try: + os.rename(os.path.join(make_root, release_dir, project, "Addons", module+".pbo"), os.path.join(make_root, release_dir, project, "Addons", pbo_name_prefix+module+".pbo")) + except: + raise + print_error("Could not rename built PBO with prefix.") + + if ret == 0: + # Sign result + if key: + print("Signing with " + key + ".") + if pbo_name_prefix: + ret = subprocess.call([dssignfile, key, os.path.join(make_root, release_dir, project, "Addons", pbo_name_prefix + module + ".pbo")]) + else: + ret = subprocess.call([dssignfile, key, os.path.join(make_root, release_dir, project, "Addons", module + ".pbo")]) + + if ret == 0: + build_successful = True + else: + build_successful = True + + if not build_successful: + print_error("Module not successfully built.") + + # Back to the root + os.chdir(make_root) + + except: + raise + print_error("Could not run Addon Builder.") + input("Press Enter to continue...") + print ("Resuming build...") + continue + + else: + print_error("Unknown build_tool " + build_tool + "!") + + # Update the hash for a successfully built module + if build_successful: + cache[module] = new_sha + + # Done building all modules! + + # Write out the cache state + cache_out = json.dumps(cache) + with open(os.path.join(make_root, "make.cache"), 'w') as f: + f.write(cache_out) + + # Delete the pboproject temp files if building a release. + if make_release and build_tool == "pboproject": + try: + shutil.rmtree(os.path.join(module_root, release_dir, project, "temp"), True) + except: + print_error("ERROR: Could not delete pboProject temp files.") + + print_green("\nDone.") + + # Make release + if make_release: + print_blue("\nMaking release: " + project + "-" + release_version + ".zip") + + try: + # Delete all log files + for root, dirs, files in os.walk(os.path.join(module_root, release_dir, project, "Addons")): + for currentFile in files: + if currentFile.lower().endswith("log"): + os.remove(os.path.join(root, currentFile)) + + # Create a zip with the contents of release/ in it + shutil.make_archive(project + "-" + release_version, "zip", os.path.join(module_root, release_dir)) + except: + raise + print_error("Could not make release.") + + # Copy to Arma 3 folder for testing + if test: + print_blue("\nCopying to Arma 3.") + + if sys.platform == "win32": + reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE) + try: + k = winreg.OpenKey(reg, r"SOFTWARE\Wow6432Node\Bohemia Interactive\Arma 3") + a3_path = winreg.EnumValue(k, 1)[1] + winreg.CloseKey(k) + except: + print_error("Could not find Arma 3's directory in the registry.") + else: + a3_path = cygwin_a3path + + if os.path.exists(a3_path): + try: + shutil.rmtree(os.path.join(a3_path, project), True) + shutil.copytree(os.path.join(module_root, release_dir, project), os.path.join(a3_path, project)) + except: + print_error("Could not copy files. Is Arma 3 running?") + +if __name__ == "__main__": + main(sys.argv) +input("Press Enter to continue...") From 5a5a1fd66ab1d9ab741e3bfc16727059a211eac5 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 11 Apr 2015 13:17:41 +0200 Subject: [PATCH 76/76] ACE_optic_SOS_PIP - iron sight was missing, fix #470 --- addons/optics/CfgWeapons.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/optics/CfgWeapons.hpp b/addons/optics/CfgWeapons.hpp index d947e73047..29a3ff8c98 100644 --- a/addons/optics/CfgWeapons.hpp +++ b/addons/optics/CfgWeapons.hpp @@ -230,6 +230,7 @@ class CfgWeapons { class Snip: Snip { modelOptics[] = {QUOTE(PATHTOF(models\ace_optics_pip.p3d)),QUOTE(PATHTOF(models\ace_optics_pip.p3d))}; }; + class Iron: Iron {}; }; }; };