From 198d4f3540f296f182499e7fd13ef606506ad114 Mon Sep 17 00:00:00 2001 From: jaynus Date: Thu, 9 Apr 2015 13:03:28 -0700 Subject: [PATCH] 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);