Isolate MCLOS

This commit is contained in:
Bailey Danyluk 2024-05-27 20:47:18 -06:00
parent bcb6ed7c68
commit ab423e2195
7 changed files with 142 additions and 2 deletions

View File

@ -80,6 +80,14 @@ class GVAR(SeekerTypes) {
functionName = QFUNC(seekerType_SACLOS);
onFired = QFUNC(SACLOS_onFired);
};
class MCLOS {
name = "";
visualName = "";
description = "";
functionName = QFUNC(seekerType_MCLOS);
onFired = QFUNC(MCLOS_onFired);
};
class MillimeterWaveRadar {
name = "";
visualName = "";

View File

@ -18,6 +18,8 @@ PREP(handleHandoff);
PREP(shouldFilterRadarHit);
PREP(mclosButtonPressed);
// Attack Profiles
PREP(attackProfile_AIR);
PREP(attackProfile_DIR);
@ -43,7 +45,7 @@ PREP(navigationType_direct);
PREP(seekerType_SALH);
PREP(seekerType_Optic);
PREP(seekerType_SACLOS);
PREP(seekerType_Doppler);
PREP(seekerType_MCLOS);
PREP(seekerType_MWR);
// Attack Profiles OnFired
@ -51,6 +53,7 @@ PREP(wire_onFired);
// Seeker OnFired
PREP(SACLOS_onFired);
PREP(MCLOS_onFired);
PREP(mwr_onFired);
// Navigation OnFired

View File

@ -10,5 +10,41 @@
},
[15, [false, true, false]], false] call CBA_fnc_addKeybind; //Ctrl+Tab Key
GVAR(dev_fnc_projectileCamera) = compile preprocessFileLineNumbers QPATHTOF(dev\projectileCamera.sqf);
// Each MCLOS argument is the vector which acceleration will be applied
["ACE3 Weapons", QGVAR(mclosUp), localize LSTRING(mclosUp), {
[[0, 0, 1], ACE_PLAYER] call FUNC(mclosButtonPressed);
false
}, {
[[0, 0, -1], ACE_PLAYER] call FUNC(mclosButtonPressed);
false
},
[0x48, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // Numpad 8
["ACE3 Weapons", QGVAR(mclosDown), localize LSTRING(mclosDown), {
[[0, 0, -1], ACE_PLAYER] call FUNC(mclosButtonPressed);
false
}, {
[[0, 0, 1], ACE_PLAYER] call FUNC(mclosButtonPressed);
false
},
[0x50, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // Numpad 2
["ACE3 Weapons", QGVAR(mclosLeft), localize LSTRING(mclosLeft), {
[[1, 0, 0], ACE_PLAYER] call FUNC(mclosButtonPressed);
false
}, {
[[-1, 0, 0], ACE_PLAYER] call FUNC(mclosButtonPressed);
false
},
[0x4D, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // Numpad 6
["ACE3 Weapons", QGVAR(mclosRight), localize LSTRING(mclosRight), {
[[-1, 0, 0], ACE_PLAYER] call FUNC(mclosButtonPressed);
false
}, {
[[1, 0, 0], ACE_PLAYER] call FUNC(mclosButtonPressed);
false
},
[0x4B, [false, false, false]], false, 0] call CBA_fnc_addKeybind; // Numpad 4
GVAR(dev_fnc_projectileCamera) = compile preprocessFileLineNumbers QPATHTOF(dev\projectileCamera.sqf);

View File

@ -0,0 +1,20 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Sets up MCLOS state arrays (called from missileGuidance's onFired).
*
* Arguments:
* Guidance Arg Array <ARRAY>
*
* Return Value:
* None
*
* Example:
* [] call ace_missileguidance_fnc_MCLOS_onFired
*
* Public: No
*/
params ["_firedEH", "", "", "", "_stateParams"];
_firedEH params ["_shooter","_weapon","","","","","_projectile"];
_stateParams params ["", "_seekerStateParams"];

View File

@ -0,0 +1,29 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Handles MCLOS guidance via keyboard keys
*
* Arguments:
* Acceleration vector
*
* Return Value:
* None
*
* Example:
* [0, 0, 1] call ace_missileguidance_fnc_mclosButtonPressed
*
* Public: No
*/
params ["_accelerationDirection", "_player"];
private _projectiles = _player getVariable [QGVAR(MCLOS_Projectiles), []];
_projectiles = _projectiles select { _x isNotEqualTo objNull };
_player setVariable [QGVAR(MCLOS_Projectiles), _projectiles];
private _vehicleHasMCLOS = 1 == getNumber ((configOf vehicle _player) >> QGVAR(hasMCLOSControl));
if (_vehicleHasMCLOS) then {
playSound "ACE_Sound_Click";
};
private _currentDirection = _player getVariable [QGVAR(MCLOS_direction), [0, 0, 0]];
_player setVariable [QGVAR(MCLOS_direction), _currentDirection vectorAdd _accelerationDirection];

View File

@ -0,0 +1,32 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* SACLOS seeker
*
* Arguments:
* 1: Guidance Arg Array <ARRAY>
* 2: Seeker State <ARRAY>
*
* Return Value:
* Position of wanted missile pos relative to the camera direction <ARRAY>
*
* Example:
* [] call ace_missileguidance_fnc_seekerType_SACLOS
*
* Public: No
*/
params ["", "_args"];
_args params ["_firedEH", "", "_flightParams"];
_firedEH params ["","","","","","","_projectile","_gunner"];
_flightParams params ["_pitchRate", "_yawRate"];
private _projectilePos = getPosASLVisual _projectile;
private _accelerationDirection = _projectile vectorModelToWorldVisual (_gunner getVariable [QGVAR(MCLOS_direction), [0, 0, 0]]);
private _returnPos = _projectilePos vectorAdd (_accelerationDirection vectorMultiply (_pitchRate max _yawRate));
_targetData set [0, _projectilePos vectorFromTo _returnPos];
_targetData set [2, _returnPos distance _projectilePos];
_returnPos

View File

@ -205,5 +205,17 @@
<Chinese>循環切換開火模式</Chinese>
<Turkish>Ateşleme Modunu Değiştir</Turkish>
</Key>
<Key ID="STR_ACE_MissileGuidance_mclosUp">
<English>MCLOS Up</English>
</Key>
<Key ID="STR_ACE_MissileGuidance_mclosDown">
<English>MCLOS Down</English>
</Key>
<Key ID="STR_ACE_MissileGuidance_mclosRight">
<English>MCLOS Right</English>
</Key>
<Key ID="STR_ACE_MissileGuidance_mclosLeft">
<English>MCLOS Left</English>
</Key>
</Package>
</Project>