From ce4a9c36763177faa7482ba0db384146d9f6e963 Mon Sep 17 00:00:00 2001 From: jaynus Date: Thu, 16 Apr 2015 11:32:47 -0700 Subject: [PATCH] Apply javelin guidance to static titans. --- addons/javelin/CfgVehicles.hpp | 29 ++++++++++++++++++++ addons/javelin/CfgWeapons.hpp | 14 +++++++++- addons/javelin/config.cpp | 3 +- addons/javelin/functions/fnc_onFired.sqf | 5 +++- addons/javelin/functions/fnc_onOpticDraw.sqf | 19 +++++++++++-- addons/missileguidance/CfgAmmo.hpp | 5 ++-- 6 files changed, 67 insertions(+), 8 deletions(-) create mode 100644 addons/javelin/CfgVehicles.hpp diff --git a/addons/javelin/CfgVehicles.hpp b/addons/javelin/CfgVehicles.hpp new file mode 100644 index 0000000000..02b8789e1a --- /dev/null +++ b/addons/javelin/CfgVehicles.hpp @@ -0,0 +1,29 @@ +class CfgVehicles { + class LandVehicle; + class StaticWeapon : LandVehicle { + class Turrets; + }; + + class StaticMGWeapon : StaticWeapon { + class Turrets : Turrets { + class MainTurret; + }; + }; + + + class AT_01_base_F: StaticMGWeapon { + class Turrets : Turrets { + class MainTurret : MainTurret { + turretInfoType = "ACE_RscOptics_javelin"; + gunnerOpticsModel = PATHTOF(data\reticle_titan.p3d); + opticsZoomMin = 0.08333; + opticsZoomMax = 0.04167; + opticsZoomInit = 0.08333; + opticsPPEffects[] = {"OpticsCHAbera1","OpticsBlur1"}; + opticsFlare = 0; + discretefov[] = {0.08333,0.04167}; + discreteInitIndex = 0; + }; + }; + }; +}; \ No newline at end of file diff --git a/addons/javelin/CfgWeapons.hpp b/addons/javelin/CfgWeapons.hpp index 4e7091c653..0898fa6d3c 100644 --- a/addons/javelin/CfgWeapons.hpp +++ b/addons/javelin/CfgWeapons.hpp @@ -1,14 +1,26 @@ class CfgWeapons { class Launcher; + class MissileLauncher; + class Launcher_Base_F : Launcher { class WeaponSlotsInfo; }; + class missiles_titan : MissileLauncher { + weaponInfoType = "ACE_RscOptics_javelin"; + modelOptics = PATHTOF(data\reticle_titan.p3d); + + canLock = 0; + + lockingTargetSound[] = {"",0,1}; + lockedTargetSound[] = {"",0,1}; + }; + class launch_Titan_base : Launcher_Base_F { weaponInfoType = "ACE_RscOptics_javelin"; modelOptics = PATHTOF(data\reticle_titan.p3d); - canLock = 1; + canLock = 0; lockingTargetSound[] = {"",0,1}; diff --git a/addons/javelin/config.cpp b/addons/javelin/config.cpp index 9d7c14e448..cb76da0010 100644 --- a/addons/javelin/config.cpp +++ b/addons/javelin/config.cpp @@ -13,4 +13,5 @@ class CfgPatches { #include "CfgEventhandlers.hpp" #include "RscInGameUI.hpp" #include "CfgSounds.hpp" -#include "CfgWeapons.hpp" \ No newline at end of file +#include "CfgWeapons.hpp" +#include "CfgVehicles.hpp" \ No newline at end of file diff --git a/addons/javelin/functions/fnc_onFired.sqf b/addons/javelin/functions/fnc_onFired.sqf index 04a023c9d8..a4e351cd92 100644 --- a/addons/javelin/functions/fnc_onFired.sqf +++ b/addons/javelin/functions/fnc_onFired.sqf @@ -6,7 +6,10 @@ PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); // Bail on not missile if( _shooter != ACE_player) exitWith { false }; -if( ! ([ (configFile >> "CfgWeapons" >> (currentWeapon (vehicle ACE_player)) ), "launch_Titan_base"] call EFUNC(common,inheritsFrom)) ) exitWith { }; +if( ! ([ (configFile >> "CfgWeapons" >> (currentWeapon (vehicle ACE_player)) ), "launch_Titan_base"] call EFUNC(common,inheritsFrom)) + && + { ! ([ (configFile >> "CfgWeapons" >> (currentWeapon (vehicle ACE_player)) ), "missiles_titan"] call EFUNC(common,inheritsFrom)) } +) exitWith { }; _pfh_handle = uiNamespace getVariable ["ACE_RscOptics_javelin_PFH", nil]; if(!isNil "_pfh_handle") then { diff --git a/addons/javelin/functions/fnc_onOpticDraw.sqf b/addons/javelin/functions/fnc_onOpticDraw.sqf index 13669b9d2e..bc17865480 100644 --- a/addons/javelin/functions/fnc_onOpticDraw.sqf +++ b/addons/javelin/functions/fnc_onOpticDraw.sqf @@ -30,7 +30,10 @@ _soundTime = _args select 4; _randomLockInterval = _args select 5; _fireDisabledEH = _args select 6; -if( ! ([ (configFile >> "CfgWeapons" >> (currentWeapon (vehicle ACE_player)) ), "launch_Titan_base"] call EFUNC(common,inheritsFrom)) ) exitWith { +if( ! ([ (configFile >> "CfgWeapons" >> (currentWeapon (vehicle ACE_player)) ), "launch_Titan_base"] call EFUNC(common,inheritsFrom)) + && + { ! ([ (configFile >> "CfgWeapons" >> (currentWeapon (vehicle ACE_player)) ), "missiles_titan"] call EFUNC(common,inheritsFrom)) } + ) exitWith { __JavelinIGUITargeting ctrlShow false; __JavelinIGUITargetingGate ctrlShow false; __JavelinIGUITargetingLines ctrlShow false; @@ -55,8 +58,16 @@ if ((velocity ACE_player) distance [0,0,0] > 0.5 && {cameraView == "GUNNER"} && // bail on not loaded -if (ACE_player ammo (currentWeapon ACE_player) == 0) exitWith { }; - +if( (vehicle ACE_player) != ACE_player) then { + if( (vehicle player) magazineTurretAmmo ["1Rnd_GAT_missiles", [0]] < 1) exitWith { + TRACE_1("No turret ammo, exit", ""); + }; +} else { + if (ACE_player ammo (currentWeapon ACE_player) < 1 ) exitWith { + TRACE_1("No ammo, exit", ""); + }; +}; + _range = parseNumber (ctrlText __JavelinIGUIRangefinder); TRACE_1("Viewing range", _range); if (_range > 50 && {_range < 2500}) then { @@ -144,6 +155,8 @@ if (isNull _newTarget) then { // Disallow fire _fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire); } else { + _fov = [] call CBA_fnc_getFoV; + TRACE_1("FOV", _fov); if (_newTarget distance ACE_player < 2500 && {(call CBA_fnc_getFoV) select 1 > 9} && { (currentVisionMode ACE_player == 2)} diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index 3b74c87065..82045a1720 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -105,8 +105,9 @@ class CfgAmmo { // Turn off arma crosshair-guidance manualControl = 0; - hit = 1400; - + hit = 1400; // default: 800 + indirectHit = 20; + indirectHitRange = 2; // ACE uses these values //trackOversteer = 1; //trackLead = 0;