Allow for debug info to be displayed via variable

This commit is contained in:
Brandon Danyluk 2021-04-16 15:43:31 -06:00
parent abc5babb50
commit 1b000d658a
14 changed files with 71 additions and 67 deletions

View File

@ -12,6 +12,5 @@
},
[15, [false, true, false]], false] call CBA_fnc_addKeybind; //Ctrl+Tab Key
#ifdef ENABLE_PROJECTILE_CAMERA
GVAR(dev_fnc_projectileCamera) = compile preprocessFileLineNumbers QPATHTOF(dev\projectileCamera.sqf);
#endif

View File

@ -11,4 +11,7 @@ PREP_RECOMPILE_END;
// As weapons take config changes, there is little point in being able to disable guidance
if (isNil QGVAR(enabled)) then { GVAR(enabled) = 2; };
GVAR(debug_enableMissileCamera) = true;
GVAR(debug_drawGuidanceInfo) = false;
ADDON = true;

View File

@ -26,8 +26,10 @@ _camera camCommitPrepared 0;
[_pfh] call CBA_fnc_removePerFrameHandler;
};
_camera camPrepareTarget _projectile;
_camera camPrepareRelPos [0, -5, 1];
private _currentProjectilePos = getPosATLVisual _projectile;
_camera camPrepareTarget _currentProjectilePos;
_camera camPreparePos (_currentProjectilePos vectorDiff ((vectorNormalized velocity _projectile) vectorMultiply 5));
_camera camCommitPrepared 0;
_args set [2, getPosATL _projectile];

View File

@ -29,10 +29,10 @@ if ((isNil "_attackProfilePos") || {_attackProfilePos isEqualTo [0,0,0]}) exitWi
[0,0,0]
};
#ifdef DRAW_GUIDANCE_INFO
drawLine3D [(ASLtoAGL _attackProfilePos), (ASLtoAGL _seekerTargetPos), [0,1,1,1]];
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [0,0,1,1], ASLtoAGL _attackProfilePos, 0.5, 0.5, 0, _attackProfileName, 1, 0.025, "TahomaB"];
#endif
if (GVAR(debug_drawGuidanceInfo)) then {
drawLine3D [(ASLtoAGL _attackProfilePos), (ASLtoAGL _seekerTargetPos), [0,1,1,1]];
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [0,0,1,1], ASLtoAGL _attackProfilePos, 0.5, 0.5, 0, _attackProfileName, 1, 0.025, "TahomaB"];
};
TRACE_2("return",_attackProfilePos,_attackProfileName);
_attackProfilePos;

View File

@ -30,9 +30,9 @@ if ((isNil "_seekerTargetPos") || {_seekerTargetPos isEqualTo [0,0,0]}) then { /
if (_seekLastTargetPos && {_lastKnownPos isNotEqualTo [0,0,0]}) then { // if enabled for the ammo, use last known position if we have one stored
TRACE_2("seeker returned bad pos - using last known",_seekLastTargetPos,_lastKnownPos);
_seekerTargetPos = _lastKnownPos;
#ifdef DRAW_GUIDANCE_INFO
if (GVAR(debug_drawGuidanceInfo)) then {
drawIcon3D ["\A3\ui_f\data\map\markers\military\unknown_CA.paa", [1,1,0,1], ASLtoAGL _lastKnownPos, 0.25, 0.25, 0, "LastKnownPos", 1, 0.02, "TahomaB"];
#endif
};
} else {
TRACE_1("seeker returned no pos",_seekerTargetPos);
_seekerTargetPos = [0,0,0];
@ -44,9 +44,9 @@ if ((isNil "_seekerTargetPos") || {_seekerTargetPos isEqualTo [0,0,0]}) then { /
};
};
#ifdef DRAW_GUIDANCE_INFO
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [0,1,0,1], ASLtoAGL _seekerTargetPos, 0.5, 0.5, 0, _seekerTypeName, 1, 0.025, "TahomaB"];
#endif
if (GVAR(debug_drawGuidanceInfo)) then {
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [0,1,0,1], ASLtoAGL _seekerTargetPos, 0.5, 0.5, 0, _seekerTypeName, 1, 0.025, "TahomaB"];
};
TRACE_2("return",_seekerTargetPos,_seekerTypeName);
_seekerTargetPos;

View File

@ -68,12 +68,12 @@ if ((_pitchRate != 0 || {_yawRate != 0}) && {_profileAdjustedTargetPos isNotEqua
ERROR_MSG("_commandedAcceleration is nil! Guidance cancelled");
};
#ifdef DRAW_GUIDANCE_INFO
if (GVAR(debug_drawGuidanceInfo)) then {
private _projectilePosAGL = ASLToAGL _projectilePos;
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,0,0,1], _projectilePosAGL vectorAdd [0, 0, 1], 0.75, 0.75, 0, str _commandedAcceleration, 1, 0.025, "TahomaB"];
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,1,0,1], _projectilePosAGL vectorAdd [0, 0, 2], 0.75, 0.75, 0, _navigationType, 1, 0.025, "TahomaB"];
drawLine3D [_projectilePosAGL, _projectilePosAGL vectorAdd _commandedAcceleration, [1, 0, 1, 1]];
#endif
};
// activate missile servos and change direction
if (!isGamePaused && accTime > 0) then {
@ -127,16 +127,16 @@ if ((_pitchRate != 0 || {_yawRate != 0}) && {_profileAdjustedTargetPos isNotEqua
_args set [4, _stateParams];
};
#ifdef DRAW_GUIDANCE_INFO
TRACE_3("",_projectilePos,_seekerTargetPos,_profileAdjustedTargetPos);
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,0,0,1], ASLtoAGL _projectilePos, 0.75, 0.75, 0, _ammo, 1, 0.025, "TahomaB"];
if (GVAR(debug_drawGuidanceInfo)) then {
TRACE_3("",_projectilePos,_seekerTargetPos,_profileAdjustedTargetPos);
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,0,0,1], ASLtoAGL _projectilePos, 0.75, 0.75, 0, _ammo, 1, 0.025, "TahomaB"];
if (!isGamePaused && accTime > 0) then {
if (!isGamePaused && accTime > 0) then {
private _ps = "#particlesource" createVehicleLocal (ASLtoAGL _projectilePos);
_PS setParticleParams [["\A3\Data_f\cl_basic", 8, 3, 1], "", "Billboard", 1, 3.0141, [0, 0, 2], [0, 0, 0], 1, 1.275, 1, 0, [1, 1], [[1, 0, 0, 1], [1, 0, 0, 1], [1, 0, 0, 1]], [1], 1, 0, "", "", nil];
_PS setDropInterval 1.0;
};
};
#endif
_stateParams set [0, diag_tickTime];

View File

@ -34,7 +34,7 @@ private _losDelta = _attackProfileDirection vectorDiff _lastLineOfSight;
private _losRate = if (_timestep == 0) then {
0
} else {
10 * (vectorMagnitude _losDelta) / _timestep;
1 * (vectorMagnitude _losDelta) / _timestep;
};
private _lateralAcceleration = _navigationGain * _losRate;

View File

@ -31,7 +31,7 @@ private _losDelta = _attackProfileDirection vectorDiff _lastLineOfSight;
private _losRate = if (_timestep == 0) then {
0
} else {
10 * (vectorMagnitude _losDelta) / _timestep;
1 * (vectorMagnitude _losDelta) / _timestep;
};
private _lateralAcceleration = _navigationGain * _losRate;

View File

@ -206,9 +206,9 @@ if (_onFiredFunc != "") then {
[LINKFUNC(guidancePFH),0, _args ] call CBA_fnc_addPerFrameHandler;
#ifdef ENABLE_PROJECTILE_CAMERA
[_projectile] call GVAR(dev_fnc_projectileCamera);
#endif
if (GVAR(debug_enableMissileCamera)) then {
[_projectile] call GVAR(dev_fnc_projectileCamera);
};
/* Clears locking settings

View File

@ -97,9 +97,9 @@ if (_isActive || { CBA_missionTime >= _timeWhenActive }) then {
_expectedTargetPos = _searchPos;
};
} else {
#ifdef DRAW_GUIDANCE_INFO
if (GVAR(debug_drawGuidanceInfo)) then {
_seekerTypeName = "DOPPLER - EXT";
#endif
};
// External radar homing
// if the target is in the remote targets for the side, whoever the donor is will "datalink" the target for the hellfire.
private _remoteTargets = listRemoteTargets side _shooter;
@ -112,9 +112,9 @@ if (_isActive || { CBA_missionTime >= _timeWhenActive }) then {
};
};
#ifdef DRAW_GUIDANCE_INFO
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,0,0,1], ASLtoAGL _expectedTargetPos, 0.75, 0.75, 0, "expected target pos", 1, 0.025, "TahomaB"];
#endif
if (GVAR(debug_drawGuidanceInfo)) then {
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,0,0,1], ASLtoAGL _expectedTargetPos, 0.75, 0.75, 0, "expected target pos", 1, 0.025, "TahomaB"];
};
if !(isNull _target) then {
// we check if the target is moving away from us or perpendicular to see if we maintain lock

View File

@ -101,7 +101,7 @@ if (TRACK_ON_PAUSE || {accTime > 0 && !isGamePaused}) then {
};
};
#ifdef DRAW_GUIDANCE_INFO
if (GVAR(debug_drawGuidanceInfo)) then {
private _flarePos = ASLToAGL getPosASLVisual _x;
private _colour = [1, 0, 0, 1];
if (_considering) then {
@ -111,7 +111,7 @@ if (TRACK_ON_PAUSE || {accTime > 0 && !isGamePaused}) then {
_colour = [0, 0, 1, 1];
};
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", _colour, _flarePos, 0.75, 0.75, 0, "F", 1, 0.025, "TahomaB"];
#endif
};
};
} forEach _nearby;

View File

@ -89,9 +89,9 @@ if (_isActive || { CBA_missionTime >= _timeWhenActive }) then {
_projectile setMissileTarget _target;
} else {
#ifdef DRAW_GUIDANCE_INFO
_seekerTypeName = "AHR - EXT";
#endif
if (GVAR(debug_drawGuidanceInfo)) then {
_seekerTypeName = "MWR - EXT";
};
// External radar homing
// if the target is in the remote targets for the side, whoever the donor is will "datalink" the target for the hellfire.
private _remoteTargets = listRemoteTargets side _shooter;
@ -104,9 +104,9 @@ if (_isActive || { CBA_missionTime >= _timeWhenActive }) then {
};
};
#ifdef DRAW_GUIDANCE_INFO
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,0,0,1], ASLtoAGL _expectedTargetPos, 0.75, 0.75, 0, "expected target pos", 1, 0.025, "TahomaB"];
#endif
if (GVAR(debug_drawGuidanceInfo)) then {
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,0,0,1], ASLtoAGL _expectedTargetPos, 0.75, 0.75, 0, "expected target pos", 1, 0.025, "TahomaB"];
};
if !(isNull _target) then {
private _centerOfObject = getCenterOfMass _target;

View File

@ -103,7 +103,7 @@ if !(_maskedByGround) exitWith {
};
};
#ifdef DRAW_GUIDANCE_INFO
if (GVAR(debug_drawGuidanceInfo)) then {
private _chaffPos = ASLToAGL getPosASLVisual _x;
private _colour = [1, 0, 0, 1];
if (_considering) then {
@ -113,7 +113,7 @@ if !(_maskedByGround) exitWith {
_colour = [0, 0, 1, 1];
};
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", _colour, _chaffPos, 0.75, 0.75, 0, "C", 1, 0.025, "TahomaB"];
#endif
};
} forEach _nearby;
_foundDecoy

View File

@ -2,9 +2,9 @@
#define COMPONENT_BEAUTIFIED Missile Guidance
#include "\z\ace\addons\main\script_mod.hpp"
#define DRAW_GUIDANCE_INFO
// #define DRAW_GUIDANCE_INFO
// #define ENABLE_PROJECTILE_CAMERA
#define DEBUG_MODE_FULL
// #define DEBUG_MODE_FULL
#define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS