Merge pull request #286 from KoffeinFlummi/lasers

Self designating lasers, Javelin Guidance, DAGR laser guidance, Comanche updated HUDS
This commit is contained in:
jaynus 2015-04-05 13:26:54 -07:00
commit e3ad83e109
95 changed files with 3557 additions and 976 deletions

View File

@ -95,29 +95,7 @@ class CfgVehicles {
};
};
class Heli_Attack_01_base_F: Helicopter_Base_F {
lockDetectionSystem = 12;
incomingMissileDetectionSystem = 16;
driverCanEject = 1;
class Turrets: Turrets {
class MainTurret: MainTurret {
canEject = 1;
showHMD = 1;
weapons[] = {"ACE_gatling_20mm_Comanche","missiles_DAGR","missiles_ASRAAM"};
magazines[] = {"ACE_500Rnd_20mm_shells_Comanche","4Rnd_AAA_missiles","24Rnd_PG_missiles"};
};
};
class AnimationSources: AnimationSources {
class Gatling {
weapon = "ACE_gatling_20mm_Comanche";
};
class Muzzle_flash {
weapon = "ACE_gatling_20mm_Comanche";
};
};
};
#include "Heli_Attack_01_base_F.hpp"
class B_Heli_Attack_01_F: Heli_Attack_01_base_F {};
@ -222,7 +200,7 @@ class CfgVehicles {
lockDetectionSystem = 0;
incomingMissileDetectionSystem = 16;
driverCanEject = 1;
weapons[] = {"M134_minigun","missiles_DAR","CMFlareLauncher"};
weapons[] = {"M134_minigun","missiles_DAR","CMFlareLauncher", "ACE_AIR_SAFETY" };
magazines[] = {"5000Rnd_762x51_Yellow_Belt","24Rnd_missiles","168Rnd_CMFlare_Chaff_Magazine"};
class Turrets: Turrets {

View File

@ -4,6 +4,23 @@ class Mode_Burst;
class Mode_FullAuto;
class CfgWeapons {
class RocketPods;
class ACE_AIR_SAFETY : RocketPods
{
CanLock = 0;
displayName = "SAFE";
displayNameMagazine = "SAFE";
shortNameMagazine = "SAFE";
nameSound = "cannon";
cursor = "EmptyCursor";
cursorAim = "EmptyCursor";
magazines[] = {"FakeMagazine"};
burst = 0;
reloadTime = 0.01;
magazineReloadTime = 0.1;
};
// Manual Switching Of Flare Mode
class SmokeLauncher;
class CMFlareLauncher: SmokeLauncher {

File diff suppressed because one or more lines are too long

View File

@ -3,6 +3,7 @@ ace_aircraft
Changes to air weaponry, flightmodels and HUDs.
* Contributations by Kimi for HUD updates
## Maintainers
@ -10,3 +11,4 @@ The people responsible for merging changes to this component or answering potent
- [KoffeinFlummi](https://github.com/KoffeinFlummi)
- [commy2](https://github.com/commy2)
- [jaynus](https://github.com/walterpearce)

View File

@ -0,0 +1,578 @@
class RscControlsGroup;
class RscText;
class RangeText: RscText{};
class RscPicture;
class RscOpticsText;
class RscIGProgress;
class RscOpticsValue;
class VScrollbar;
class HScrollbar;
class RscLadderPicture;
class RscInGameUI
{
class RscUnitInfo;
class Rsc_ACE_Helo_UI_Turret: RscUnitInfo
{
idd = 300;
controls[] = {"CA_Zeroing","CA_IGUI_elements_group","CA_VehicleToggles"};
class VScrollbar;
class HScrollbar;
class CA_IGUI_elements_group: RscControlsGroup
{
idc = 170;
class VScrollbar: VScrollbar
{
width = 0;
};
class HScrollbar: HScrollbar
{
height = 0;
};
x = "0 * (0.01875 * SafezoneH) + (SafezoneX + ((SafezoneW - SafezoneH) / 2))";
y = "0 * (0.025 * SafezoneH) + (SafezoneY)";
w = "53.5 * (0.01875 * SafezoneH)";
h = "40 * (0.025 * SafezoneH)";
class controls
{
class CA_Distance: RscText
{
idc = 151;
style = 2;
sizeEx = "0.0295*SafezoneH";
shadow = 0;
font = "EtelkaMonospacePro";
x = "24.78 * (0.01875 * SafezoneH)";
y = "30.88 * (0.025 * SafezoneH)";
w = "4 * (0.01875 * SafezoneH)";
h = "1.2 * (0.025 * SafezoneH)";
};
class CA_Speed: RangeText
{
idc = 188;
style = 2;
sizeEx = "0.0295*SafezoneH";
shadow = 0;
font = "EtelkaMonospacePro";
text = "120";
x = "14.78 * (0.01875 * SafezoneH)";
y = "30.88 * (0.025 * SafezoneH)";
w = "4 * (0.01875 * SafezoneH)";
h = "1.2 * (0.025 * SafezoneH)";
};
class CA_Alt: RangeText
{
idc = 189;
style = 2;
sizeEx = "0.0295*SafezoneH";
shadow = 0;
font = "EtelkaMonospacePro";
text = "3825";
x = "34.78 * (0.01875 * SafezoneH)";
y = "30.88 * (0.025 * SafezoneH)";
w = "4 * (0.01875 * SafezoneH)";
h = "1.2 * (0.025 * SafezoneH)";
};
class CA_VisionMode: RscText
{
idc = 152;
style = 0;
sizeEx = "0.0295*SafezoneH";
shadow = 0;
font = "EtelkaMonospacePro";
text = "VIS";
x = "12.58 * (0.01875 * SafezoneH)";
y = "8 * (0.025 * SafezoneH)";
w = "4 * (0.01875 * SafezoneH)";
h = "1.2 * (0.025 * SafezoneH)";
};
class CA_FlirMode: RscText
{
idc = 153;
style = 0;
sizeEx = "0.0295*SafezoneH";
shadow = 0;
font = "EtelkaMonospacePro";
text = "BHOT";
x = "15.78 * (0.01875 * SafezoneH)";
y = "8 * (0.025 * SafezoneH)";
w = "4.5 * (0.01875 * SafezoneH)";
h = "1.2 * (0.025 * SafezoneH)";
};
class ValueGrid: RangeText
{
idc = 172;
font = "EtelkaMonospacePro";
style = 2;
sizeEx = "0.0295*SafezoneH";
shadow = 0;
x = "12.20 * (0.01875 * SafezoneH)";
y = "3.5 * (0.025 * SafezoneH)";
w = "6 * (0.01875 * SafezoneH)";
h = "1 * (0.025 * SafezoneH)";
};
class TextTADS: RangeText
{
idc = 1010;
text = "TADS";
font = "EtelkaMonospacePro";
style = 2;
shadow = 0;
x = "12.30 * (0.01875 * SafezoneH)";
y = "5 * (0.025 * SafezoneH)";
w = "4 * (0.01875 * SafezoneH)";
h = "1.2 * (0.025 * SafezoneH)";
};
class ValueTime: RangeText
{
idc = 190;
text = "20:28:35";
font = "EtelkaMonospacePro";
style = 2;
sizeEx = "0.0295*SafezoneH";
shadow = 0;
x = "12.1 * (0.01875 * SafezoneH)";
y = "6.5 * (0.025 * SafezoneH)";
w = "6 * (0.01875 * SafezoneH)";
h = "1 * (0.025 * SafezoneH)";
};
class CA_Laser: RscText
{
idc = 158;
style = "0x30 + 0x800";
sizeEx = "0.038*SafezoneH";
shadow = 0;
font = "EtelkaMonospacePro";
text = PATHTOF(data\Helo_LaserON.paa);
x = "20.45 * (0.01875 * SafezoneH)";
y = "14.1 * (0.025 * SafezoneH)";
w = "12.5 * (0.01875 * SafezoneH)";
h = "12 * (0.025 * SafezoneH)";
};
class CA_Heading: RscText
{
idc = 156;
style = 0;
sizeEx = "0.038*SafezoneH";
shadow = 0;
font = "EtelkaMonospacePro";
text = "023";
x = "24.83 * (0.01875 * SafezoneH)";
y = "6 * (0.025 * SafezoneH)";
w = "4 * (0.01875 * SafezoneH)";
h = "1.2 * (0.025 * SafezoneH)";
};
};
};
};
class Rsc_ACE_Helo_UI_01: RscUnitInfo
{
controls[] = {"WeaponInfoControlsGroupRight","CA_TextFlaresMode","CA_TextFlares","CA_VehicleToggles","CA_Radar"};
};
class Rsc_ACE_Helo_UI_02: RscUnitInfo
{
controls[] = {"CA_TextFlaresMode","CA_TextFlares","CA_VehicleToggles","CA_Radar"};
};
class Rsc_ACE_Drones_UI_Turret: RscUnitInfo
{
idd = 300;
controls[] = {"CA_Zeroing","CA_IGUI_elements_group","CA_VehicleToggles"};
class CA_IGUI_elements_group: RscControlsGroup
{
idc = 170;
class VScrollbar: VScrollbar
{
width = 0;
};
class HScrollbar: HScrollbar
{
height = 0;
};
x = "0 * (0.01875 * SafezoneH) + (SafezoneX + ((SafezoneW - SafezoneH) / 2))";
y = "0 * (0.025 * SafezoneH) + (SafezoneY)";
w = "53.5 * (0.01875 * SafezoneH)";
h = "40 * (0.025 * SafezoneH)";
class controls
{
class CA_Distance: RscText
{
idc = 151;
style = 2;
sizeEx = "0.0295*SafezoneH";
shadow = 0;
font = "EtelkaMonospacePro";
x = "24.78 * (0.01875 * SafezoneH)";
y = "30.88 * (0.025 * SafezoneH)";
w = "4 * (0.01875 * SafezoneH)";
h = "1.2 * (0.025 * SafezoneH)";
};
class CA_Speed: RangeText
{
idc = 188;
style = 2;
sizeEx = "0.0295*SafezoneH";
shadow = 0;
font = "EtelkaMonospacePro";
text = "120";
x = "14.78 * (0.01875 * SafezoneH)";
y = "30.88 * (0.025 * SafezoneH)";
w = "4 * (0.01875 * SafezoneH)";
h = "1.2 * (0.025 * SafezoneH)";
};
class CA_Alt: RangeText
{
idc = 189;
style = 2;
sizeEx = "0.0295*SafezoneH";
shadow = 0;
font = "EtelkaMonospacePro";
text = "3825";
x = "34.78 * (0.01875 * SafezoneH)";
y = "30.88 * (0.025 * SafezoneH)";
w = "4 * (0.01875 * SafezoneH)";
h = "1.2 * (0.025 * SafezoneH)";
};
class ValueTime: RangeText
{
idc = 190;
text = "20:28:35";
font = "EtelkaMonospacePro";
style = 2;
sizeEx = "0.0295*SafezoneH";
shadow = 0;
x = "1.75 * (0.01875 * SafezoneH)";
y = "10.5 * (0.025 * SafezoneH)";
w = "6 * (0.01875 * SafezoneH)";
h = "1 * (0.025 * SafezoneH)";
};
class CA_VisionMode: RscText
{
idc = 152;
style = 0;
sizeEx = "0.0295*SafezoneH";
shadow = 0;
font = "EtelkaMonospacePro";
text = "VIS";
align = "right";
x = "2.6 * (0.01875 * SafezoneH)";
y = "12.0 * (0.025 * SafezoneH)";
w = "4 * (0.01875 * SafezoneH)";
h = "1.0 * (0.025 * SafezoneH)";
};
class CA_FlirMode: RscText
{
idc = 153;
style = 0;
sizeEx = "0.0295*SafezoneH";
shadow = 0;
font = "EtelkaMonospacePro";
text = "BHOT";
align = "right";
x = "6.18 * (0.01875 * SafezoneH)";
y = "12.0 * (0.025 * SafezoneH)";
w = "4.5 * (0.01875 * SafezoneH)";
h = "1.0 * (0.025 * SafezoneH)";
};
class TgT_Grid_text: RangeText
{
idc = 1005;
text = "TGT:";
font = "EtelkaMonospacePro";
style = 2;
sizeEx = "0.0295*SafezoneH";
shadow = 0;
x = "1.20 * (0.01875 * SafezoneH)";
y = "13.5 * (0.025 * SafezoneH)";
w = "6 * (0.01875 * SafezoneH)";
h = "1 * (0.025 * SafezoneH)";
};
class TGT_ValueGrid: RangeText
{
idc = 172;
font = "EtelkaMonospacePro";
colorText[] = {0.706,0.0745,0.0196,0.8};
style = 2;
sizeEx = "0.0295*SafezoneH";
shadow = 0;
x = "5.20 * (0.01875 * SafezoneH)";
y = "13.5 * (0.025 * SafezoneH)";
w = "6 * (0.01875 * SafezoneH)";
h = "1 * (0.025 * SafezoneH)";
};
class OWN_Grid_text: RangeText
{
idc = 1005;
text = "OWN:";
font = "EtelkaMonospacePro";
style = 2;
sizeEx = "0.0295*SafezoneH";
shadow = 0;
x = "1.20 * (0.01875 * SafezoneH)";
y = "15 * (0.025 * SafezoneH)";
w = "6 * (0.01875 * SafezoneH)";
h = "1 * (0.025 * SafezoneH)";
};
class OWN_ValueGrid: RangeText
{
idc = 171;
font = "EtelkaMonospacePro";
colorText[] = {0.15,1,0.15,0.8};
style = 2;
sizeEx = "0.0295*SafezoneH";
shadow = 0;
x = "5.20 * (0.01875 * SafezoneH)";
y = "15 * (0.025 * SafezoneH)";
w = "6 * (0.01875 * SafezoneH)";
h = "1 * (0.025 * SafezoneH)";
};
class CA_Laser: RscText
{
idc = 158;
style = "0x30 + 0x800";
sizeEx = "0.038*SafezoneH";
shadow = 0;
align = "right";
font = "EtelkaMonospacePro";
text = PATHTOF(data\Helo_LaserON.paa);
x = "20.45 * (0.01875 * SafezoneH)";
y = "14.1 * (0.025 * SafezoneH)";
w = "12.5 * (0.01875 * SafezoneH)";
h = "12 * (0.025 * SafezoneH)";
};
class CA_Heading: RscText
{
idc = 156;
style = 0;
sizeEx = "0.038*SafezoneH";
shadow = 0;
font = "EtelkaMonospacePro";
text = "023";
align = "right";
x = "25 * (0.01875 * SafezoneH)";
y = "5 * (0.025 * SafezoneH)";
w = "4 * (0.01875 * SafezoneH)";
h = "1.2 * (0.025 * SafezoneH)";
};
};
};
};
class Rsc_ACE_Drones_UI_Pilots: RscUnitInfo
{
idd = 300;
controls[] = {"WeaponInfoControlsGroupRight","CA_BackgroundVehicle","CA_BackgroundVehicleTitle","CA_BackgroundVehicleTitleDark","CA_BackgroundFuel","CA_Vehicle","CA_VehicleRole","CA_HitZones","CA_SpeedBackground","CA_SpeedUnits","CA_Speed","CA_ValueFuel","CA_AltBackground","CA_AltUnits","CA_Alt","CA_VehicleToggles","CA_Radar","DriverOpticsGroup"};
class DriverOpticsGroup: RscControlsGroup
{
idc = 392;
class VScrollbar: VScrollbar
{
width = 0;
};
class HScrollbar: HScrollbar
{
height = 0;
};
x = "0 * (0.01875 * SafezoneH) + (SafezoneX + ((SafezoneW - SafezoneH) / 2))";
y = "0 * (0.025 * SafezoneH) + (SafezoneY)";
w = "53.5 * (0.01875 * SafezoneH)";
h = "40 * (0.025 * SafezoneH)";
class controls
{
class TextGrid: RscText
{
style = 0;
sizeEx = "0.02*SafezoneH";
shadow = 0;
font = "EtelkaMonospacePro";
idc = 1005;
text = "GRID:";
x = "5.8 * (0.01875 * SafezoneH)";
y = "31.8 * (0.025 * SafezoneH)";
w = "5 * (0.01875 * SafezoneH)";
h = "1 * (0.025 * SafezoneH)";
};
class ValueGrid: TextGrid
{
idc = 189;
text = "382546";
x = "10.3 * (0.01875 * SafezoneH)";
y = "31.8 * (0.025 * SafezoneH)";
w = "6 * (0.01875 * SafezoneH)";
h = "1 * (0.025 * SafezoneH)";
};
class TextTime: TextGrid
{
idc = 1010;
text = "TIME [UTC]:";
x = "5.8 * (0.01875 * SafezoneH)";
y = "32.6 * (0.025 * SafezoneH)";
w = "5 * (0.01875 * SafezoneH)";
h = "1 * (0.025 * SafezoneH)";
};
class ValueTime: TextGrid
{
idc = 101;
text = "20:28:35";
x = "10 * (0.01875 * SafezoneH)";
y = "32.6 * (0.025 * SafezoneH)";
w = "6 * (0.01875 * SafezoneH)";
h = "1 * (0.025 * SafezoneH)";
};
class TextMag: TextGrid
{
idc = 1011;
text = "CAM MAG:";
x = "5.8 * (0.01875 * SafezoneH)";
y = "7 * (0.025 * SafezoneH)";
w = "5 * (0.01875 * SafezoneH)";
h = "1 * (0.025 * SafezoneH)";
};
class OpticsZoom: TextGrid
{
idc = 192;
text = "28x";
x = "10.3 * (0.01875 * SafezoneH)";
y = "7 * (0.025 * SafezoneH)";
w = "6 * (0.01875 * SafezoneH)";
h = "1 * (0.025 * SafezoneH)";
};
class BorderLineSpdTop: RscPicture
{
idc = 1203;
text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\border_line_ca.paa";
x = "3.343 * (0.01875 * SafezoneH)";
y = "12.4 * (0.025 * SafezoneH)";
w = "3 * (0.01875 * SafezoneH)";
h = "1 * (0.025 * SafezoneH)";
};
class BorderLineSpdBottom: RscPicture
{
idc = 1207;
text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\border_line_ca.paa";
x = "3.343 * (0.01875 * SafezoneH)";
y = "26.5 * (0.025 * SafezoneH)";
w = "3 * (0.01875 * SafezoneH)";
h = "1 * (0.025 * SafezoneH)";
};
class BorderLineAltTop: RscPicture
{
idc = 1205;
text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\border_line_ca.paa";
x = "47.16 * (0.01875 * SafezoneH)";
y = "12.4 * (0.025 * SafezoneH)";
w = "3 * (0.01875 * SafezoneH)";
h = "1 * (0.025 * SafezoneH)";
};
class BorderLineAltBottom: RscPicture
{
idc = 1206;
text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\border_line_ca.paa";
x = "47.16 * (0.01875 * SafezoneH)";
y = "26.5 * (0.025 * SafezoneH)";
w = "3 * (0.01875 * SafezoneH)";
h = "1 * (0.025 * SafezoneH)";
};
class TextSpd: TextGrid
{
idc = 1004;
text = "SPD";
x = "4.8 * (0.01875 * SafezoneH)";
y = "11.8 * (0.025 * SafezoneH)";
w = "5 * (0.01875 * SafezoneH)";
h = "1.2 * (0.025 * SafezoneH)";
};
class SpeedValueBorder: RscPicture
{
idc = 1200;
text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\altimeter_value_ca.paa";
x = "6.3 * (0.01875 * SafezoneH)";
y = "19 * (0.025 * SafezoneH)";
w = "5 * (0.01875 * SafezoneH)";
h = "2 * (0.025 * SafezoneH)";
};
class CA_Speed: TextGrid
{
idc = 190;
sizeEx = "0.03*SafezoneH";
text = "120";
x = "7.5 * (0.01875 * SafezoneH)";
y = "19.5 * (0.025 * SafezoneH)";
w = "6 * (0.01875 * SafezoneH)";
h = "1.2 * (0.025 * SafezoneH)";
};
class AnalogueSpeed: RscLadderPicture
{
idc = 384;
topValue = 1312;
bottomValue = -345;
visibleRange = -1;
text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\UAVspeedLadder_ca.paa";
x = "1.5 * (0.01875 * SafezoneH)";
y = "13 * (0.025 * SafezoneH)";
w = "5 * (0.01875 * SafezoneH)";
h = "14 * (0.025 * SafezoneH)";
};
class TextAlt: TextGrid
{
idc = 1006;
text = "ALT";
x = "46.9 * (0.01875 * SafezoneH)";
y = "11.8 * (0.025 * SafezoneH)";
w = "5 * (0.01875 * SafezoneH)";
h = "1.2 * (0.025 * SafezoneH)";
};
class AltValueBorder: RscPicture
{
idc = 1201;
text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\airspeed_value_ca.paa";
x = "42.25 * (0.01875 * SafezoneH)";
y = "19 * (0.025 * SafezoneH)";
w = "5 * (0.01875 * SafezoneH)";
h = "2 * (0.025 * SafezoneH)";
};
class CA_Alt: TextGrid
{
idc = 191;
sizeEx = "0.03*SafezoneH";
style = 1;
text = "3825";
x = "43 * (0.01875 * SafezoneH)";
y = "19.5 * (0.025 * SafezoneH)";
w = "3.2 * (0.01875 * SafezoneH)";
h = "1.2 * (0.025 * SafezoneH)";
};
class AnalogueAlt: RscLadderPicture
{
idc = 385;
topValue = 14430;
bottomValue = -2110;
visibleRange = -1;
text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\UAValtLadder_ca.paa";
x = "47 * (0.01875 * SafezoneH)";
y = "13 * (0.025 * SafezoneH)";
w = "2.5 * (0.01875 * SafezoneH)";
h = "14 * (0.025 * SafezoneH)";
};
class AnalogueHorizon: RscLadderPicture
{
idc = 383;
topValue = 90;
bottomValue = -90;
visibleRange = -1;
text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\horizon_ladder_ca.paa";
x = "16.75 * (0.01875 * SafezoneH)";
y = "5 * (0.025 * SafezoneH)";
w = "20 * (0.01875 * SafezoneH)";
h = "30 * (0.025 * SafezoneH)";
};
class HorizonCenter: RscPicture
{
idc = 1202;
text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\horizon_aircraft_ca.paa";
x = "24.75 * (0.01875 * SafezoneH)";
y = "19 * (0.025 * SafezoneH)";
w = "4 * (0.01875 * SafezoneH)";
h = "2 * (0.025 * SafezoneH)";
};
};
};
};
};

View File

@ -6,7 +6,7 @@ class CfgPatches {
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};
author[] = {"KoffeinFlummi","Crusty","commy2"};
author[] = {"KoffeinFlummi","Crusty","commy2","jaynus","Kimi"};
authorUrl = "https://github.com/KoffeinFlummi/";
VERSION_CONFIG;
};
@ -16,3 +16,4 @@ class CfgPatches {
#include "CfgMagazines.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"
#include "RscInGameUI.hpp"

Binary file not shown.

View File

@ -94,7 +94,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment
_unit removeAction _actionID;
if (GVAR(placeAction) == 1) then {
_startingPosition = _tempObject modelToWorld [0,0,0];
_startingPosition = _tempObject modelToWorldVisual [0,0,0];
[_unit, _attachToVehicle, _itemClassname, _itemVehClass, _onAtachText, _startingPosition] call FUNC(placeApprove);
};
deleteVehicle _tempObject;

View File

@ -25,6 +25,6 @@ _itemName = [_args, 0, ""] call CBA_fnc_defaultParam;
_attachLimit = [6, 1] select (_player == _attachToVehicle);
_attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []];
_playerPos = (ACE_player modelToWorld (ACE_player selectionPosition "pilot"));
_playerPos = (ACE_player modelToWorldVisual (ACE_player selectionPosition "pilot"));
(canStand _player) && {(_attachToVehicle distance _player) < 7} && {alive _attachToVehicle} && {(count _attachedObjects) < _attachLimit} && {_itemName in ((itemsWithMagazines _player) + [""])};

View File

@ -45,7 +45,7 @@ while {(_closeInMax - _closeInMin) > 0.01} do {
// systemChat format ["Trying %1 from %2 start %3", _closeInDistance, [_closeInMax, _closeInMin], _startDistanceFromCenter];
_endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance);
_endPosTestOffset set [2, (_startingOffset select 2)];
_endPosTest = _attachToVehicle modelToWorld _endPosTestOffset;
_endPosTest = _attachToVehicle modelToWorldVisual _endPosTestOffset;
_doesIntersect = false;
{

View File

@ -37,7 +37,7 @@ _sounds = [
QUOTE(PATHTO_R(sounds\zip_out.wav))
];
_position = _target modelToWorld (_target selectionPosition "Spine3");
_position = _target modelToWorldVisual (_target selectionPosition "Spine3");
_position = _position call EFUNC(common,positionToASL);
playSound3D [

View File

@ -0,0 +1,20 @@
class CfgAmmo {
class BulletCore;
class BulletBase: BulletCore {
timeToLive = 15; // Default: 6, doubleplusgood all munition range.
};
class B_20mm : BulletBase {
timeToLive = 30;
};
class B_25mm : BulletBase {
timeToLive = 30;
};
class B_35mm_AA : BulletBase {
timeToLive = 30;
};
class B_30mm_AP : BulletBase {
timeToLive = 30;
};
};

View File

@ -14,3 +14,4 @@ class CfgPatches {
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"
#include "CfgAmmo.hpp"

View File

@ -73,6 +73,15 @@ PREP(getStringFromMissionSQM);
PREP(getTargetAzimuthAndInclination);
PREP(getTargetDistance);
PREP(getTargetObject);
PREP(getTurretCommander);
PREP(getTurretConfigPath);
PREP(getTurretCopilot);
PREP(getTurretGunner);
PREP(getTurretIndex);
PREP(getTurrets);
PREP(getTurretsFFV);
PREP(getTurretsOther);
PREP(getTurretDirection);
PREP(getUavControlPosition);
PREP(getVehicleCargo);
PREP(getVehicleCodriver);

View File

@ -57,7 +57,7 @@ switch ((_type select 0)) do {
};
} else {
_addedToPlayer = false;
_pos = _unit modelToWorld [0,1,0.05];
_pos = _unit modelToWorldVisual [0,1,0.05];
_unit = createVehicle ["WeaponHolder_Single_F",_pos,[],0,"NONE"];
_unit addWeaponCargoGlobal [_classname,1];
_unit setPosATL _pos;
@ -73,7 +73,7 @@ switch ((_type select 0)) do {
};
} else {
_addedToPlayer = false;
_pos = _unit modelToWorld [0,1,0.05];
_pos = _unit modelToWorldVisual [0,1,0.05];
_unit = createVehicle ["WeaponHolder_Single_F",_pos,[],0,"NONE"];
_unit addMagazineCargoGlobal [_classname, 1];
_unit setPosATL _pos;
@ -89,7 +89,7 @@ switch ((_type select 0)) do {
};
} else {
_addedToPlayer = false;
_pos = _unit modelToWorld [0,1,0.05];
_pos = _unit modelToWorldVisual [0,1,0.05];
_unit = createVehicle ["WeaponHolder_Single_F",_pos,[],0,"NONE"];
_unit addItemCargoGlobal [_classname,1];
_unit setPosATL _pos;

View File

@ -242,10 +242,10 @@ _fnc_isInRange = {
private ["_unitPosition", "_distance"];
_unitPosition = getPos _unit;
_distance = _unitPosition distance (_vehicle modelToWorld _selectionPosition);
_distance = _unitPosition distance (_vehicle modelToWorldVisual _selectionPosition);
if (!isNil "_selectionPosition2") then {
_distance = _distance min (_unitPosition distance (_vehicle modelToWorld _selectionPosition2));
_distance = _distance min (_unitPosition distance (_vehicle modelToWorldVisual _selectionPosition2));
};
_distance < _radius

View File

@ -0,0 +1,37 @@
/*
* Author: jaynus
*
* Get the absolute turret direction for FOV/PIP turret.
*
* Argument:
* 0: Vehicle (Object)
* 1: Turret Position
*
* Return value:
* [position, direction]
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_vehicle,_position);
private ["_turrets", "_turret", "_config", "_turret", "_povPos", "_povDir", "_gunBeginPos", "_gunEndPos", "_pov"];
_turret = [_vehicle, _position] call CBA_fnc_getTurret;
_pov = getText (_turret >> "memoryPointGunnerOptics");
_gunBeg = getText (_turret >> "gunBeg");
_gunEnd = getText (_turret >> "gunEnd");
TRACE_3("", _pov, _gunBeg, _gunEnd);
// Pull the PIP pov or barrel direction, depending on how the model is set up
_povPos = ATLtoASL ( _vehicle modelToWorldVisual (_vehicle selectionPosition _pov ) );
_povDir = [0,0,0];
if(_pov == "pip0_pos") then {
_pipDir = ATLtoASL ( _vehicle modelToWorldVisual (_vehicle selectionPosition "pip0_dir" ) );
_povDir = _pipDir vectorDiff _povPos;
} else {
_gunBeginPos = ATLtoASL ( _vehicle modelToWorldVisual (_vehicle selectionPosition _gunBeg ) );
_gunEndPos = ATLtoASL ( _vehicle modelToWorldVisual (_vehicle selectionPosition _gunEnd ) );
_povDir = _gunBeginPos vectorDiff _gunEndPos;
};
[_povPos, _povDir]

View File

@ -14,7 +14,7 @@ private ["_unit","_return","_aslPos"];
_unit = _this select 0;
_return = false;
if ((surfaceIsWater getPos _unit)) then {
_aslPos = _unit modelToWorld (_unit selectionPosition "head");
_aslPos = _unit modelToWorldVisual (_unit selectionPosition "head");
if ((_aslPos select 2) <= 0) then {
_return = true;
};

View File

@ -36,7 +36,7 @@ if (_target isKindOf "CAManBase") then {
// add height offset of model
private "_offset";
_offset = (_target modelToWorld [0, 0, 0] select 2) - (_unit modelToWorld [0, 0, 0] select 2);
_offset = (_target modelToWorldVisual [0, 0, 0] select 2) - (_unit modelToWorldVisual [0, 0, 0] select 2);
_position = _position vectorAdd [0, 0, _offset];

View File

@ -25,7 +25,7 @@ _direction = _target getVariable [QGVAR(dragDirection), 0];
// add height offset of model
private "_offset";
_offset = (_target modelToWorld [0, 0, 0] select 2) - (_unit modelToWorld [0, 0, 0] select 2);
_offset = (_target modelToWorldVisual [0, 0, 0] select 2) - (_unit modelToWorldVisual [0, 0, 0] select 2);
_position = _position vectorAdd [0, 0, _offset];

View File

@ -36,7 +36,7 @@ if (_carriedItem isKindOf "CAManBase") exitWith {false};
private ["_position", "_maxHeight"];
_position = getPosATL _carriedItem;
_maxHeight = (_unit ModelToWorld [0,0,0]) select 2;
_maxHeight = (_unit modelToWorldVisual [0,0,0]) select 2;
_position set [2, ((_position select 2) + _scrollAmount min (_maxHeight + 1.5)) max _maxHeight];

View File

@ -19,7 +19,7 @@
#include "script_component.hpp"
EXPLODE_4_PVT(_this select 0,_unit,_i,_arr,_code);
if ((_i mod 4) == 0) then {
playSound3D [QUOTE(PATHTO_R(Data\Audio\DialTone.wss)), objNull, false, (_unit ModelToWorld [0,0.2,2]), 15,1,2.5];
playSound3D [QUOTE(PATHTO_R(Data\Audio\DialTone.wss)), objNull, false, (_unit modelToWorldVisual [0,0.2,2]), 15,1,2.5];
};
ctrlSetText [1400,format["Calling%1",_arr select (_i - 4)]];

View File

@ -15,7 +15,7 @@
* Placed explosive <OBJECT>
*
* Example:
* _explosive = [player, player modelToWorld [0,0.5, 0.1], 134,
* _explosive = [player, player modelToWorldVisual [0,0.5, 0.1], 134,
* "SatchelCharge_Remote_Mag", "Command", []] call ACE_Explosives_fnc_placeExplosive;
*
* Public: Yes

View File

@ -5,3 +5,6 @@ GVAR(time) = 0;
GVAR(position) = [0,0,0];
#include "initKeybinds.sqf"
// Register event for global updates
[QGVAR(forceUpdate), FUNC(onForceUpdate)] call ace_common_fnc_addEventHandler;

View File

@ -10,6 +10,7 @@ PREP(firedEH);
PREP(getAngle);
PREP(getRange);
PREP(handleAirBurstAmmunitionPFH);
PREP(onForceUpdate);
PREP(keyDown);
PREP(keyUp);
PREP(reset);

View File

@ -12,7 +12,7 @@
#include "script_component.hpp"
private ["_vehicle", "_turret", "_turretConfig", "_distance", "_magazines"];
private ["_vehicle", "_turret", "_turretConfig", "_distance", "_magazines", "_userChange"];
_vehicle = _this select 0;
_turret = _this select 1;
@ -46,7 +46,9 @@ if (_weaponDirection isEqualTo [0,0,0]) then { // dummy value for non main turr
_angleTarget = asin (_weaponDirection select 2);
if (count _this > 2) then {
_distance = _this select 2;
if((_this select 2) > -1) then {
_distance = _this select 2;
};
};
if (!(isNil QGVAR(backgroundCalculation)) and {!(scriptDone GVAR(backgroundCalculation))}) then {
@ -160,4 +162,11 @@ _FCSElevation = [];
[_vehicle, format ["%1_%2", QGVAR(Elevation), _turret], _FCSElevation] call EFUNC(common,setVariablePublic);
[_vehicle, format ["%1_%2", QGVAR(Azimuth), _turret], _FCSAzimuth] call EFUNC(common,setVariablePublic);
[format ["%1: %2", localize "STR_ACE_FCS_ZeroedTo", _distance]] call EFUNC(common,displayTextStructured);
_userChange = true;
if( (count _this) > 3) then {
_userChange = _this select 3;
};
if(_userChange) then {
[format ["%1: %2", localize "STR_ACE_FCS_ZeroedTo", _distance]] call EFUNC(common,displayTextStructured);
};

View File

@ -0,0 +1,7 @@
#include "script_component.hpp"
if !([ACE_player, vehicle ACE_player, []] call EFUNC(common,canInteractWith)) exitWith {false};
if !((!GVAR(enabled) && FUNC(canUseFCS)) || FUNC(canUseRangefinder)) exitWith {false};
[vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex), -1, false] call FUNC(keyDown);
[vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex), -1, false] call FUNC(keyUp);

View File

@ -28,24 +28,22 @@ if((count _this) > 2) then {
_pos = _this select 2;
} else {
if(typeName (_actionData select 7) == "ARRAY") then {
_pos = _object modelToWorld (_actionData select 7);
_pos = _object modelToWorldVisual (_actionData select 7);
} else {
if ((_actionData select 7) == "weapon") then {
// Craft a suitable position for weapon interaction
_weaponDir = _object weaponDirection currentWeapon _object;
_ref = _weaponDir call EFUNC(common,createOrthonormalReference);
_pos = (_object modelToWorld (_object selectionPosition "righthand")) vectorAdd ((_ref select 2) vectorMultiply 0.1);
_pos = (_object modelToWorldVisual (_object selectionPosition "righthand")) vectorAdd ((_ref select 2) vectorMultiply 0.1);
} else {
_pos = _object modelToWorld (_object selectionPosition (_actionData select 7));
_pos = _object modelToWorldVisual (_object selectionPosition (_actionData select 7));
};
};
// Compensate for movement during the frame to get rid of jittering
_pos = _pos vectorAdd ((visiblePositionASL _object) vectorDiff (getPosASL _object));
};
// For non-self actions, exit if the action is too far away
if (GVAR(openedMenuType) == 0 && vehicle ACE_player == ACE_player &&
{(ACE_player modelToWorld (ACE_player selectionPosition "pilot")) distance _pos >= _distance}) exitWith {false};
{(ACE_player modelToWorldVisual (ACE_player selectionPosition "pilot")) distance _pos >= _distance}) exitWith {false};
// Exit if the action is behind you
_sPos = if (count _pos != 2) then {

View File

@ -1,11 +1,11 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_pre_init));
};
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_pre_init));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_post_init));
};
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_post_init));
};
};

View File

@ -1,9 +1,9 @@
class CfgVehicles {
class All;
class All;
class LaserTarget: All {
class EventHandlers {
init = QUOTE(_this call FUNC(laser_init));
};
};
class LaserTarget: All {
class EventHandlers {
init = QUOTE(_this call FUNC(laser_init));
};
};
};

View File

@ -14,7 +14,7 @@ PREP(translateToWeaponSpace);
PREP(laser_init);
GVAR(laser) = nil; // a single hud draws 1 laser at a time
GVAR(laser) = nil; // a single hud draws 1 laser at a time
PREP(laserTargetPFH);

View File

@ -1,13 +1,13 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = { "ace_common" };
VERSION_CONFIG;
};
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = { "ace_common" };
VERSION_CONFIG;
};
};
#include "CfgEventhandlers.hpp"

View File

@ -7,7 +7,7 @@ _designator = _this select 2;
_seeker = _this select 3;
_spacing = 100;
if((count _this) > 4) then {
_spacing = _this select 4;
_spacing = _this select 4;
};
_return = true;
@ -21,11 +21,11 @@ _pos2 = [(_pos2 select 0) + _x, (_pos2 select 1) + _y, (_pos2 select 2) + _z];
// player sideChat format["new los check"];
if(terrainIntersect [_pos2, _pos1]) then {
_return = false;
_return = false;
} else {
if(lineIntersects [_pos2, _pos1]) then { // should take as arguments and add to this command objects to exclude - target and observer
// player sideChat format["with: %1", lineIntersectsWith [_pos1, _pos2]];
_return = false;
};
if(lineIntersects [_pos2, _pos1]) then { // should take as arguments and add to this command objects to exclude - target and observer
// player sideChat format["with: %1", lineIntersectsWith [_pos1, _pos2]];
_return = false;
};
};
_return;

View File

@ -1,7 +1,7 @@
#include "script_component.hpp"
private ["_missile", "_headingPitch", "_found", "_vectorTo", "_polarTo", "_dir", "_vertOk", "_horzOk", "_fov",
"_closestDistance", "_pos1", "_pos2", "_disCheck", "_currentTarget", "_potentialTargets", "_offset", "_vector"];
"_closestDistance", "_pos1", "_pos2", "_disCheck", "_currentTarget", "_potentialTargets", "_offset", "_vector"];
_missile = _this select 0;
_laserCode = _this select 1;
_fov = if (count _this > 2) then {_this select 2} else {75};
@ -14,57 +14,57 @@ _found = false;
LOG("Searching lasers");
if(!(isNil "ACE_LASERS")) then {
_potentialTargets = [];
TRACE_1("", ACE_LASERS);
_potentialTargets = [];
TRACE_1("", ACE_LASERS);
{
if(!(isNull _x)) then {
_sensorPos = ATLtoASL(_missile modelToWorld _offset);
_vectorTo = [_sensorPos, ([_x] call FUNC(getPosASL))] call BIS_fnc_vectorFromXToY;
_polarTo = _vectorTo call CBA_fnc_vect2polar;
_dir = _polarTo select 1;
_dir = _dir - (_headingPitch select 1);
{
if(!(isNull _x)) then {
_sensorPos = ATLtoASL(_missile modelToWorldVisual _offset);
_vectorTo = [_sensorPos, ([_x] call FUNC(getPosASL))] call BIS_fnc_vectorFromXToY;
_polarTo = _vectorTo call CBA_fnc_vect2polar;
_dir = _polarTo select 1;
_dir = _dir - (_headingPitch select 1);
TRACE_4("Calc", _sensorPos, _vectorTo, _polarTo, _dir);
TRACE_4("Calc", _sensorPos, _vectorTo, _polarTo, _dir);
if (_dir < 0) then {_dir = _dir + 360};
if (_dir > 360) then {_dir = _dir - 360};
_vertOk = false;
_horzOk = false;
if(_dir < _fov || {_dir > (360-_fov)}) then {
_horzOk = true;
};
if(abs((abs(_polarTo select 2))-(abs(_headingPitch select 2))) < _fov) then {
_vertOk = true;
};
if (_dir < 0) then {_dir = _dir + 360};
if (_dir > 360) then {_dir = _dir - 360};
_vertOk = false;
_horzOk = false;
if(_dir < _fov || {_dir > (360-_fov)}) then {
_horzOk = true;
};
if(abs((abs(_polarTo select 2))-(abs(_headingPitch select 2))) < _fov) then {
_vertOk = true;
};
TRACE_2("Results", _vertOk, _horzOk);
TRACE_2("Results", _vertOk, _horzOk);
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];
TRACE_1("Target in sight, checking code", _targetCode, _laserCode);
if(_targetCode == _laserCode) then {
_potentialTargets set[(count _potentialTargets), _x];
};
};
};
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];
TRACE_1("Target in sight, checking code", _targetCode, _laserCode);
if(_targetCode == _laserCode) then {
_potentialTargets set[(count _potentialTargets), _x];
};
};
};
} forEach ACE_LASERS;
} forEach ACE_LASERS;
TRACE_1("", _potentialTargets);
TRACE_1("", _potentialTargets);
_closestDistance = 100000;
{
_pos1 = (getPosASL _missile);
_pos2 = ([_x] call FUNC(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 {
_found = true;
_currentTarget = _x;
_closestDistance = _disCheck;
};
} forEach _potentialTargets;
_closestDistance = 100000;
{
_pos1 = (getPosASL _missile);
_pos2 = ([_x] call FUNC(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 {
_found = true;
_currentTarget = _x;
_closestDistance = _disCheck;
};
} forEach _potentialTargets;
};
[_found, _currentTarget]

View File

@ -7,43 +7,43 @@ _outliers = [];
_spot = [];
_testPos = (_list select 0) select 0;
{
_samplePos = _x select 0;
if(!lineIntersects [_samplePos, _checkPos] && {!terrainIntersectASL [_samplePos, _checkPos]}) then {
if(_samplePos distance _testPos < 2) then {
_spot pushBack _samplePos;
} else {
_outliers pushBack _samplePos;
};
};
_samplePos = _x select 0;
if(!lineIntersects [_samplePos, _checkPos] && {!terrainIntersectASL [_samplePos, _checkPos]}) then {
if(_samplePos distance _testPos < 2) then {
_spot pushBack _samplePos;
} else {
_outliers pushBack _samplePos;
};
};
} forEach _list;
_spots pushBack _spot;
if(count _outliers > 0) then {
for "_i" from 1 to 3 do {
_remainingSpots = _outliers;
_outliers = [];
_spot = [];
_testPos = (_remainingSpots select 0);
{
_samplePos = _x;
if(!lineIntersects [_samplePos, _checkPos] && {!terrainIntersectASL [_samplePos, _checkPos]}) then {
if(_samplePos distance _testPos < 2) then {
_spot pushBack _samplePos;
} else {
_outliers pushBack _samplePos;
};
};
} forEach _remainingSpots;
_spots pushBack _spot;
};
for "_i" from 1 to 3 do {
_remainingSpots = _outliers;
_outliers = [];
_spot = [];
_testPos = (_remainingSpots select 0);
{
_samplePos = _x;
if(!lineIntersects [_samplePos, _checkPos] && {!terrainIntersectASL [_samplePos, _checkPos]}) then {
if(_samplePos distance _testPos < 2) then {
_spot pushBack _samplePos;
} else {
_outliers pushBack _samplePos;
};
};
} forEach _remainingSpots;
_spots pushBack _spot;
};
};
_largest = 0;
_largestSpot = [];
{
if((count _x) > _largest) then {
_largest = (count _x);
_largestSpot = _x;
};
if((count _x) > _largest) then {
_largest = (count _x);
_largestSpot = _x;
};
} forEach _spots;
// player sideChat format["g: %1", _spots];
_largestSpot select (random (floor(count _largestSpot)));

View File

@ -6,8 +6,8 @@ _args = _this select 0;
_laserTarget = _args select 0;
if(isNull _laserTarget || !alive player) exitWith {
[(_this select 1)] call cba_fnc_removePerFrameHandler;
REM(ACE_LASERS, _laserTarget);
[(_this select 1)] call cba_fnc_removePerFrameHandler;
REM(ACE_LASERS, _laserTarget);
};
_end = diag_tickTime;
@ -18,8 +18,8 @@ _pos = [_laserTarget] call FUNC(getPosASL);
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\select_target_ca.paa", [1,0,0,1], (ASLtoATL _pos), 0.75, 0.75, 0, "", 0.5, 0.025, "TahomaB"];
{
drawLine3D [ASLtoATL (_x select 0), ASLtoATL (_x select 1), (_x select 2)];
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", (_x select 2), ASLtoATL (_x select 1), 0.75, 0.75, 0, "", 0.5, 0.025, "TahomaB"];
drawLine3D [ASLtoATL (_x select 0), ASLtoATL (_x select 1), (_x select 2)];
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", (_x select 2), ASLtoATL (_x select 1), 0.75, 0.75, 0, "", 0.5, 0.025, "TahomaB"];
} forEach DRAW_LINES;
DRAW_LINES = [];
#endif

View File

@ -16,10 +16,10 @@ 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", player, true];
[FUNC(laserTargetPFH), 0, [_laserTarget, player]] call cba_fnc_addPerFrameHandler;
[FUNC(laserTargetPFH), 0, [_laserTarget, player]] call cba_fnc_addPerFrameHandler;
} else {
// server side ownership of laser
//_laserTarget setVariable ["ACE_LASERTARGET_SHOOTER", nil, false];
// server side ownership of laser
//_laserTarget setVariable ["ACE_LASERTARGET_SHOOTER", nil, false];
};

View File

@ -17,50 +17,50 @@ _vecRotateMap = [_cp, _p1, _p2] call FUNC(rotateVectLineGetMap);
_result = [_pos, _vec] call FUNC(shootRay);
_resultPos = _result select 0;
if(!isNil "_resultPos") then {
_distance = _result select 1;
if(_distance < _shortestReturn) then {
_shortestReturn = _distance;
};
if(_distance > _longestReturn) then {
_longestReturn = _distance;
};
_resultPositions set[(count _resultPositions), _result];
_distance = _result select 1;
if(_distance < _shortestReturn) then {
_shortestReturn = _distance;
};
if(_distance > _longestReturn) then {
_longestReturn = _distance;
};
_resultPositions set[(count _resultPositions), _result];
#ifdef DEBUG_MODE_FULL
DRAW_LINES set[(count DRAW_LINES), [_pos, _resultPos, [0, 1, 0, 1]]];
DRAW_LINES set[(count DRAW_LINES), [_pos, _resultPos, [0, 1, 0, 1]]];
#endif
};
_count = 8;
_pos2 = [
(_pos select 0)+((_vec select 0)*1000),
(_pos select 1)+((_vec select 1)*1000),
(_pos select 2)+((_vec select 2)*1000)
];
(_pos select 0)+((_vec select 0)*1000),
(_pos select 1)+((_vec select 1)*1000),
(_pos select 2)+((_vec select 2)*1000)
];
{
for "_i" from 0 to ceil(_count*_x) do {
_radOffset = random 360;
_offset = [_vecRotateMap, (((360/_count)*_i)+_radOffset) mod 360] call FUNC(rotateVectLine);
_offsetPos = [
(_pos2 select 0)+((_offset select 0)*(_divergence*_x)),
(_pos2 select 1)+((_offset select 1)*(_divergence*_x)),
(_pos2 select 2)+((_offset select 2)*(_divergence*_x))
];
_offsetVector = [_pos, _offsetPos] call BIS_fnc_vectorFromXtoY;
_result = [_pos, _offsetVector] call FUNC(shootRay);
_resultPos = _result select 0;
if(!isNil "_resultPos") then {
_distance = _result select 1;
if(_distance < _shortestReturn) then {
_shortestReturn = _distance;
};
if(_distance > _longestReturn) then {
_longestReturn = _distance;
};
_resultPositions set[(count _resultPositions), _result];
for "_i" from 0 to ceil(_count*_x) do {
_radOffset = random 360;
_offset = [_vecRotateMap, (((360/_count)*_i)+_radOffset) mod 360] call FUNC(rotateVectLine);
_offsetPos = [
(_pos2 select 0)+((_offset select 0)*(_divergence*_x)),
(_pos2 select 1)+((_offset select 1)*(_divergence*_x)),
(_pos2 select 2)+((_offset select 2)*(_divergence*_x))
];
_offsetVector = [_pos, _offsetPos] call BIS_fnc_vectorFromXtoY;
_result = [_pos, _offsetVector] call FUNC(shootRay);
_resultPos = _result select 0;
if(!isNil "_resultPos") then {
_distance = _result select 1;
if(_distance < _shortestReturn) then {
_shortestReturn = _distance;
};
if(_distance > _longestReturn) then {
_longestReturn = _distance;
};
_resultPositions set[(count _resultPositions), _result];
#ifdef DEBUG_MODE_FULL
DRAW_LINES set[(count DRAW_LINES), [_pos, _resultPos, [0, 1, 0, 1]]];
DRAW_LINES set[(count DRAW_LINES), [_pos, _resultPos, [0, 1, 0, 1]]];
#endif
};
};
};
};
} forEach [1,0.5,0.25];
[_longestReturn, _shortestReturn, _resultPositions];

View File

@ -9,22 +9,22 @@ _resultPos = nil;
_fidelity = [1000,100,10,1,0.1];
_lastPos = +_pos;
{
scopeName "mainSearch";
for "_i" from 1 to 10 do {
_nextPos = [
(_lastPos select 0)+((_vec select 0)*_x),
(_lastPos select 1)+((_vec select 1)*_x),
(_lastPos select 2)+((_vec select 2)*_x)
];
scopeName "mainSearch";
for "_i" from 1 to 10 do {
_nextPos = [
(_lastPos select 0)+((_vec select 0)*_x),
(_lastPos select 1)+((_vec select 1)*_x),
(_lastPos select 2)+((_vec select 2)*_x)
];
if(lineIntersects [_lastPos, _nextPos] || terrainIntersectASL [_lastPos, _nextPos]) then {
_resultPos = _lastPos;
breakTo "mainSearch";
} else {
_distance = _distance + _x;
_lastPos = _nextPos;
};
};
if(lineIntersects [_lastPos, _nextPos] || terrainIntersectASL [_lastPos, _nextPos]) then {
_resultPos = _lastPos;
breakTo "mainSearch";
} else {
_distance = _distance + _x;
_lastPos = _nextPos;
};
};
} forEach _fidelity;
[_resultPos, _distance];

View File

@ -14,9 +14,9 @@ _y = _offset select 1;
_z = _offset select 2;
_out = [
((_xVec select 0)*_x) + ((_xVec select 1)*_y) + ((_xVec select 2)*_z),
((_yVec select 0)*_x) + ((_yVec select 1)*_y) + ((_yVec select 2)*_z),
((_zVec select 0)*_x) + ((_zVec select 1)*_y) + ((_zVec select 2)*_z)
];
((_xVec select 0)*_x) + ((_xVec select 1)*_y) + ((_xVec select 2)*_z),
((_yVec select 0)*_x) + ((_yVec select 1)*_y) + ((_yVec select 2)*_z),
((_zVec select 0)*_x) + ((_zVec select 1)*_y) + ((_zVec select 2)*_z)
];
_out;

View File

@ -2,11 +2,11 @@
#include "\z\ace\Addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_LASER
#define DEBUG_MODE_FULL
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_LASER
#define DEBUG_SETTINGS DEBUG_SETTINGS_LASER
#define DEBUG_SETTINGS DEBUG_SETTINGS_LASER
#endif
#include "\z\ace\Addons\main\script_macros.hpp"

View File

@ -10,18 +10,10 @@ class Extended_PostInit_EventHandlers {
};
};
class Extended_GetIn_EventHandlers {
class B_Heli_Attack_01_F {
class Extended_Init_EventHandlers {
class Helicopter {
class ADDON {
getIn = QUOTE(call FUNC(onGetin));
};
};
};
class Extended_GetOut_EventHandlers {
class B_Heli_Attack_01_F {
class ADDON {
getOut = QUOTE(call FUNC(onGetout));
init = QUOTE(_this call DFUNC(initDesignatorActions));
};
};
};

View File

@ -23,7 +23,8 @@ class CfgVehicles {
class B_Heli_Attack_01_F: Heli_Attack_01_base_F {
class Turrets: Turrets {
class MainTurret: MainTurret {
stabilizedInAxes = 4; // This stablizes the turret a bit more for laser designation
GVAR(Enabled) = 1; // Enable laser self-designation
stabilizedInAxes = 4; // This stablizes the turret a bit more for laser designation
};
};
};

View File

@ -1,10 +1,9 @@
#include "script_component.hpp"
PREP(onGetIn);
PREP(onGetOut);
PREP(initDesignatorActions);
PREP(laserHudDesignateOn);
PREP(laserHudDesignateOff);
PREP(unitTurretHasDesignator);
GVAR(laser) = nil;
GVAR(laserActive) = false;

View File

@ -5,7 +5,7 @@ class CfgPatches {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_main", "ace_laser"};
requiredAddons[] = {"ace_interaction", "ace_laser"};
version = VERSION;
};
};

View File

@ -0,0 +1,56 @@
/*
* Author: esteldunedain
* Initializes the actions for turning on/off the laser for vehicles that have them
*
* Argument:
* 0: Vehicle <OBJECT>
*
* Return value:
* NONE.
*/
#include "script_component.hpp"
EXPLODE_1_PVT(_this,_vehicle);
// Add action to class if it is not already done
private ["_type", "_initializedClasses"];
_type = typeOf _vehicle;
_initializedClasses = GETGVAR(initializedClasses,[]);
// do nothing if the class is already initialized
if (_type in _initializedClasses) exitWith {};
_initializedClasses pushBack _type;
{
private ["_turretConfig","_onAction","_offAction"];
_turretConfig = [configFile >> "CfgVehicles" >> _type, _x] call EFUNC(common,getTurretConfigPath);
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];
// Add actions
_onAction = [QGVAR(LaserOn), localize "STR_ACE_Laser_SelfDesignate_DesignatorOn", "",
{
// Statement
_this call FUNC(laserHudDesignateOn)
},
{
// Condition
!GVAR(laserActive) && {[ACE_player] call FUNC(unitTurretHasDesignator)}
}] call EFUNC(interact_menu,createAction);
_offAction = [QGVAR(LaserOff), localize "STR_ACE_Laser_SelfDesignate_DesignatorOff", "",
{
// Statement
_this call FUNC(laserHudDesignateOff)
},
{
// Condition
GVAR(laserActive) && {[ACE_player] call FUNC(unitTurretHasDesignator)}
}] call EFUNC(interact_menu,createAction);
[_type, 1, ["ACE_SelfActions"], _onAction] call EFUNC(interact_menu,addActionToClass);
[_type, 1, ["ACE_SelfActions"], _offAction] call EFUNC(interact_menu,addActionToClass);
};
} forEach allTurrets _vehicle;

View File

@ -1,15 +1,15 @@
#include "script_component.hpp"
if(isNil QGVAR(laser)) exitWith {
false
false
};
if(!local GVAR(laser)) then {
false
false
};
_handle = GVAR(laser) getVariable ["ACE_PFH_HANDLE", nil];
if(!isNil "_handle") then {
[_handle] call cba_fnc_removePerFrameHandler;
[_handle] call cba_fnc_removePerFrameHandler;
};
REM(ACE_LASERS, GVAR(laser));

View File

@ -1,90 +1,112 @@
//#define DEBUG_MODE_FULL
// #define DEBUG_MODE_FULL
#include "script_component.hpp"
TRACE_1("enter", _this);
#define FCS_UPDATE_DELAY 2.0
FUNC(magnitude) = {
_this distance [0, 0, 0]
_this distance [0, 0, 0]
};
FUNC(mat_normalize3d) = {
private ["_mag"];
PARAMS_3(_vx,_vy,_vz);
private ["_mag"];
PARAMS_3(_vx,_vy,_vz);
_mag = _this call FUNC(magnitude);
if (_mag == 0) then {_mag = 1};
[(_vx/_mag), (_vy/_mag), (_vz/_mag)]
_mag = _this call FUNC(magnitude);
if (_mag == 0) then {_mag = 1};
[(_vx/_mag), (_vy/_mag), (_vz/_mag)]
};
FUNC(laserHudDesignatePFH) = {
_args = _this select 0;
_laserTarget = _args select 0;
_shooter = _args select 1;
private["_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;
_vehicle = vehicle _shooter;
_weapon = currentWeapon _vehicle;
if( (count _args) < 3) then {
_args set[2, diag_tickTime + FCS_UPDATE_DELAY];
};
_forceUpdateTime = _args select 2;
if(!alive _shooter || isNull _vehicle || isNull _laserTarget || !GVAR(laserActive) ) exitWith {
[(_this select 1)] call cba_fnc_removePerFrameHandler;
};
_vehicle = vehicle _shooter;
_weapon = currentWeapon _vehicle;
// Retrieve the gunner and turret memory point information
_gunnerInfo = [_vehicle, _weapon] call CBA_fnc_getFirer;
TRACE_1("", _args);
_turret = [_vehicle, _gunnerInfo select 1] call CBA_fnc_getTurret;
_pov = getText (_turret >> "memoryPointGunnerOptics");
_gunBeg = getText (_turret >> "gunBeg");
_gunEnd = getText (_turret >> "gunEnd");
TRACE_3("", _pov, _gunBeg, _gunEnd);
if(!alive _shooter || isNull _vehicle || isNull _laserTarget || !GVAR(laserActive) ) exitWith {
[] call FUNC(laserHudDesignateOff);
};
if(!([ACE_player] call FUNC(unitTurretHasDesignator)) ) exitWith {
[] call FUNC(laserHudDesignateOff);
};
// Pull the PIP pov or barrel direction, depending on how the model is set up
_povPos = ATLtoASL ( _vehicle modelToWorld (_vehicle selectionPosition _pov ) );
_povDir = [0,0,0];
if(_pov == "pip0_pos") then {
_pipDir = ATLtoASL ( _vehicle modelToWorld (_vehicle selectionPosition "pip0_dir" ) );
_povDir = [_povPos, _pipDir] call BIS_fnc_vectorDiff;
} else {
_gunBeginPos = ATLtoASL ( _vehicle modelToWorld (_vehicle selectionPosition _gunBeg ) );
_gunEndPos = ATLtoASL ( _vehicle modelToWorld (_vehicle selectionPosition _gunEnd ) );
_povDir = [_gunEndPos, _gunBeginPos] call BIS_fnc_vectorDiff;
};
// Retrieve the gunner and turret memory point information
_gunnerInfo = [_vehicle, _weapon] call CBA_fnc_getFirer;
_turretInfo = [_vehicle, _gunnerInfo select 1] call EFUNC(common,getTurretDirection);
_povPos = _turretInfo select 0;
_povDir = _turretInfo select 1;
TRACE_4("", _povDir, _povPos, _gunBeginPos, _gunEndPos);
_result = [_povPos, _povDir] call EFUNC(laser,shootCone);
if((count _result) > 0) then {
_resultPositions = _result select 2;
_result = [_povPos, _povDir] call EFUNC(laser,shootCone);
if((count _result) > 0) then {
_resultPositions = _result select 2;
if((count _resultPositions) > 0) then {
_firstResult = _resultPositions select 0;
_pos = _firstResult select 0;
if((count _resultPositions) > 0) then {
_firstResult = _resultPositions select 0;
_pos = _firstResult select 0;
// 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.
//if( ((getPosASL _laserTarget) distance _pos) > 0.5) then {
_laserTarget setPosATL (ASLToATL _pos);
//};
// 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));
if(diag_tickTime > _forceUpdateTime) then {
TRACE_1("FCS Update", "");
["ace_fcs_forceUpdate", []] call ace_common_fnc_localEvent;
};
if( ((getPosASL _laserTarget) vectorDistance _pos) > 2) then {
TRACE_1("LaserPos Update", "");
_laserTarget setPosATL (ASLToATL _pos);
};
if(diag_tickTime > _forceUpdateTime) then {
_args set[3, diag_tickTime + FCS_UPDATE_DELAY];
};
#ifdef DEBUG_MODE_FULL
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,0,0,1], ASLToATL _pos, 0.75, 0.75, 0, "", 0.5, 0.025, "TahomaB"];
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,0,0,1], (getPosATL _laserTarget), 0.75, 0.75, 0, "", 0.5, 0.025, "TahomaB"];
{
private["_position"];
_position = _x select 0;
drawLine3d [ASLToATL _povPos, ASLToATL _position, [0,0,1,1] ];
} forEach _resultPositions;
#endif
};
};
};
};
_this set[0, _args];
};
private "_laserTarget";
private "_handle";
if(isNil QGVAR(laser)) then {
_laserTarget = "LaserTarget" createVehicle (getpos player);
GVAR(laserActive) = true;
_laserTarget = "LaserTargetW" createVehicle (getpos player);
_handle = [FUNC(laserHudDesignatePFH), 0, [_laserTarget, player]] call cba_fnc_addPerFrameHandler;
_laserTarget setVariable ["ACE_PFH_HANDLE", _handle, false];
GVAR(laserActive) = true;
GVAR(laser) = _laserTarget;
_handle = [FUNC(laserHudDesignatePFH), 0, [_laserTarget, player]] call cba_fnc_addPerFrameHandler;
_laserTarget setVariable ["ACE_PFH_HANDLE", _handle, false];
GVAR(laser) = _laserTarget;
} else {
[] call FUNC(laserHudDesignateOff);
[] call FUNC(laserHudDesignateOn);
[] call FUNC(laserHudDesignateOff);
[] call FUNC(laserHudDesignateOn);
};

View File

@ -1,13 +0,0 @@
#define DEBUG_MODE_FULL
#include "script_component.hpp"
// TODO: we should do this differently eventually
private["_onActionId", "_offActionId"];
TRACE_1("ENTER", _this);
// TODO: THIS SHOULD NOT BE ACTIONS EVENTUALLY
_onActionId = player addAction ["Laser Designator On", { _this call FUNC(laserHudDesignateOn) }, [], 1, false, false, "", QUOTE( (gunner (vehicle player)) == player && !GVAR(laserActive))];
player setVariable[QGVAR(onActionId), _onActionId, false];
_offActionId = player addAction ["Laser Designator Off", { _this call FUNC(laserHudDesignateOff) }, [], 1, false, false, "", QUOTE( (gunner (vehicle player)) == player && GVAR(laserActive))];
player setVariable[QGVAR(offActionId), _offActionId, false];

View File

@ -1,10 +0,0 @@
#include "script_component.hpp"
_onActionId = player getVariable[QGVAR(onActionId), -1];
_offActionId = player getVariable[QGVAR(offActionId), -1];
player removeAction _onActionId;
player removeAction _offActionId;
player setVariable[QGVAR(onActionId), -1, false];
player setVariable[QGVAR(offActionId), -1, false];

View File

@ -0,0 +1,21 @@
/*
* Author: esteldunedain
* Checks if the turret occupied by the given unit has a laser designator
*
* Argument:
* 0: Unit <OBJECT>
*
* Return value:
* Has designator? <BOOL>
*/
#include "script_component.hpp"
EXPLODE_1_PVT(_this,_unit);
// Get the player turret path
private ["_turret","_config","_turretConfig"];
_turret = [_unit] call EFUNC(common,getTurretIndex);
_config = configFile >> "CfgVehicles" >> typeOf vehicle _unit;
_turretConfig = [_config, _turret] call EFUNC(common,getTurretConfigPath);
getNumber (_turretConfig >> QGVAR(Enabled)) > 0

View File

@ -2,11 +2,11 @@
#include "\z\ace\Addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_LASER_SELFDESIGNATE
#define DEBUG_MODE_FULL
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_LASER_SELFDESIGNATE
#define DEBUG_SETTINGS DEBUG_SETTINGS_LASER_SELFDESIGNATE
#define DEBUG_SETTINGS DEBUG_SETTINGS_LASER_SELFDESIGNATE
#endif
#include "\z\ace\Addons\main\script_macros.hpp"

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2015-04-03 -->
<Project name="ACE">
<Package name="Laser_SelfDesignate">
<Key ID="STR_ACE_Laser_SelfDesignate_DesignatorOn">
<English>Laser&lt;br/&gt;Designator On</English>
</Key>
<Key ID="STR_ACE_Laser_SelfDesignate_DesignatorOff">
<English>Laser&lt;br/&gt;Designator Off</English>
</Key>
</Package>
</Project>

View File

@ -3,7 +3,7 @@
EXPLODE_3_PVT(_this,_unit,_range,_isGreen);
_p0Pos = _unit modelToWorld (_unit selectionPosition "righthand");
_p0Pos = _unit modelToWorldVisual (_unit selectionPosition "righthand");
// Convert _p0Pos to ASL
_p0 = + _p0Pos;

View File

@ -37,7 +37,7 @@ _medicalFacility =
"USMC_WarfareBFieldhHospital"
];
_objects = (lineIntersectsWith [_unit modelToWorld [0, 0, (_eyePos select 2)], _unit modelToWorld [0, 0, (_eyePos select 2) +10], _unit]);
_objects = (lineIntersectsWith [_unit modelToWorldVisual [0, 0, (_eyePos select 2)], _unit modelToWorldVisual [0, 0, (_eyePos select 2) +10], _unit]);
{
if (((typeOf _x) in _medicalFacility) || (_x getVariable [QGVAR(isMedicalFacility),false])) exitwith {
_isInBuilding = true;

View File

@ -1,10 +1,10 @@
class CfgAmmo {
class MissileBase;
class MissileBase;
class M_PG_AT : MissileBase {
irLock = 0;
laserLock = 0;
airLock = 0;
manualControl = 0;
};
class M_PG_AT : MissileBase {
irLock = 0;
laserLock = 0;
airLock = 0;
manualControl = 0;
};
};

View File

@ -1,17 +1,17 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_pre_init));
};
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_pre_init));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_post_init));
};
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_post_init));
};
};
class Extended_FiredBIS_EventHandlers {
class AllVehicles {
ADDON = QUOTE(_this call FUNC(fired));
};
class AllVehicles {
ADDON = QUOTE(_this call FUNC(fired));
};
};

View File

@ -1,34 +1,34 @@
class Mode_SemiAuto;
class CfgWeapons {
class CannonCore;
class LauncherCore;
class CannonCore;
class LauncherCore;
class RocketPods: LauncherCore {
canLock = 1;
};
class missiles_DAGR: RocketPods {
canLock = 1;
};
/*
class autocannon_Base_F: CannonCore {
canLock = 1;
};
class cannon_120mm: CannonCore {
canLock = 1;
class RocketPods: LauncherCore {
canLock = 1;
};
class missiles_DAGR: RocketPods {
canLock = 1;
};
/*
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 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;
};*/
class launch_NLAW_F: Launcher_Base_F
{
canLock = 1;
};*/
};

View File

@ -1,13 +1,13 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = { "ace_common", "ace_laser" };
VERSION_CONFIG;
};
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = { "ace_common", "ace_laser" };
VERSION_CONFIG;
};
};
#include "CfgEventhandlers.hpp"

View File

@ -7,12 +7,12 @@ 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);
};
case "GBU12BombLauncher": {
_this call FUNC(guidance_LGB);
};
case "missiles_DAGR": {
_this call FUNC(guidance_DAGR);
};
case "GBU12BombLauncher": {
_this call FUNC(guidance_LGB);
};
};
//_this call FUNC(guidance_HellfireII);

View File

@ -2,112 +2,119 @@
#include "script_component.hpp"
FUNC(guidance_DIRECT_LOAL_PFH) = {
//TRACE_1("enter", _this);
_args = _this select 0;
//PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
_shooter = _args select 0;
_dagr = _args select 6;
_curVelocity = velocity _dagr;
//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;
};
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;
TRACE_2("Targets", _target, _targets);
_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;
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,"","",""];
// 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,"","",""];
_yVec = vectorDir _dagr;
_zVec = vectorUp _dagr;
_xVec = vectorNormalized (_yVec vectorCrossProduct _zVec);
_yVec = vectorDir _dagr;
_zVec = vectorUp _dagr;
_xVec = vectorNormalized (_yVec vectorCrossProduct _zVec);
_dagrPos = getPosASL _dagr;
// player sideChat "G!";
_targetPos = getPosASL _target;
if((count _targetPos) > 0) then {
_distanceToTarget = _dagrPos vectorDistance _targetPos;
_dagrPos = getPosASL _dagr;
// player sideChat "G!";
_targetPos = getPosASL _target;
_shooterPos = getPosASL _shooter;
_addHeight = [0,0,(_dagrPos distance _targetPos)*0.02];
#ifdef DEBUG_MODE_FULL
drawLine3D [(ASLtoATL _targetPos) vectorAdd _addHeight, ASLtoATL _targetPos, [0,1,0,1]];
#endif
if((count _targetPos) > 0) then {
_distanceToTarget = _dagrPos vectorDistance _targetPos;
_distanceToShooter = _dagrPos vectorDistance _shooterPos;
_targetPos = _targetPos vectorAdd _addHeight;
_addHeight = [0,0,(_dagrPos distance _targetPos)*0.02];
#ifdef DEBUG_MODE_FULL
drawLine3D [(ASLtoATL _targetPos) vectorAdd _addHeight, ASLtoATL _targetPos, [0,1,0,1]];
#endif
_def = 0.0050;
_targetPos = _targetPos vectorAdd _addHeight;
_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;
} else {
if((_targetVectorSeeker select 0) > 0) then {
_yaw = _def;
};
};
_def = 0.0040;
if(_distanceToShooter > 100) then {
_def = 0.0025;
};
_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 _dagrPos, 0.75, 0.75, 0, str _vectorTo, 1, 0.025, "TahomaB"];
drawLine3D [ASLtoATL _dagrPos, ASLtoATL _targetPos, [1,0,0,1]];
_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;
} else {
if((_targetVectorSeeker select 0) > 0) then {
_yaw = _def;
};
};
_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";
_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 _dagrPos, 0.75, 0.75, 0, str _vectorTo, 1, 0.025, "TahomaB"];
drawLine3D [ASLtoATL _dagrPos, ASLtoATL _targetPos, [1,0,0,1]];
MARKERCOUNT = MARKERCOUNT + 1;
#endif
_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";
if(accTime > 0) then {
_outVector = [_dagr, [_xVec, _yVec, _zVec], [_yaw, 1/accTime, _pitch]] call FUNC(translateToModelSpace);
// _outVector = _dagr modelToWorld [_yaw, 1, _pitch];
// _outVector = ATLtoASL _outVector;
_vectorTo = _dagrPos vectorFromTo _outVector;
MARKERCOUNT = MARKERCOUNT + 1;
#endif
// hintSilent format["v: %1", _vectorTo];
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;
// _dagr setVectorDir _vectorTo;
_dagr setVectorDirAndUp [_vectorTo, vectorUp _dagr];
};
// hintSilent format["v: %1", _vectorTo];
#ifdef DEBUG_MODE_FULL
hintSilent format["d: %1", _distanceToTarget];
#endif
};
};
// _dagr setVectorDir _vectorTo;
_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);
PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
GVAR(lastTime) = time;
[FUNC(guidance_DIRECT_LOAL_PFH), 0, _this] call cba_fnc_addPerFrameHandler;
GVAR(lastTime) = time;
[FUNC(guidance_DIRECT_LOAL_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 DAGR FIREMODE_DIRECT_LOAL");
_this call FUNC(guidance_DAGR_DIRECT_LOAL);
};
// Default to FIREMODE_DIRECT_LOAL
// FIREMODE_DIRECT_LOAL
default {
LOG("Initiating DAGR FIREMODE_DIRECT_LOAL");
_this call FUNC(guidance_DAGR_DIRECT_LOAL);
};
};

View File

@ -2,248 +2,248 @@
#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;
//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;
};
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];
};
_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);
_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);
_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;
_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;
_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;
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;
_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;
};
};
_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]];
_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];
_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]];
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";
_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
MARKERCOUNT = MARKERCOUNT + 1;
#endif
if(accTime > 0) then {
_outVector = [_missile, [_xVec, _yVec, _zVec], [_yaw, 1/accTime, _pitch]] call FUNC(translateToModelSpace);
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];
};
_vectorTo = _missilePos vectorFromTo _outVector;
_missile setVectorDirAndUp [_vectorTo, vectorUp _missile];
};
#ifdef DEBUG_MODE_FULL
hintSilent format["d: %1", _distanceToTarget];
#endif
};
};
#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;
//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;
};
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];
};
_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);
_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);
_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;
_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;
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;
_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;
};
};
_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]];
_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];
_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]];
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";
_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
MARKERCOUNT = MARKERCOUNT + 1;
#endif
if(accTime > 0) then {
_outVector = [_missile, [_xVec, _yVec, _zVec], [_yaw, 1/accTime, _pitch]] call FUNC(translateToModelSpace);
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];
};
_vectorTo = _missilePos vectorFromTo _outVector;
_missile setVectorDirAndUp [_vectorTo, vectorUp _missile];
};
#ifdef DEBUG_MODE_FULL
hintSilent format["d: %1", _distanceToTarget];
#endif
};
};
#ifdef DEBUG_MODE_FULL
hintSilent format["d: %1", _distanceToTarget];
#endif
};
};
};
FUNC(guidance_Hellfire_LOAL_HI) = {
PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
GVAR(lastTime) = time;
[FUNC(guidance_Hellfire_LOAL_HI_PFH), 0, _this] call cba_fnc_addPerFrameHandler;
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);
PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
GVAR(lastTime) = time;
[FUNC(guidance_Hellfire_LOAL_DIR_PFH), 0, _this] call cba_fnc_addPerFrameHandler;
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_HI);
};
// Default to FIREMODE_DIRECT_LOAL
// FIREMODE_DIRECT_LOAL
default {
LOG("Initiating Hellfire II FIREMODE_LOAL_DIR");
_this call FUNC(guidance_Hellfire_LOAL_HI);
};
};

View File

@ -2,108 +2,108 @@
#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;
//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;
};
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);
_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;
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,"","",""];
// 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);
_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;
_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;
_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;
};
};
_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]];
_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";
_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
MARKERCOUNT = MARKERCOUNT + 1;
#endif
if(accTime > 0) then {
_outVector = [_lgb, [_xVec, _yVec, _zVec], [_yaw, 1/accTime, _pitch]] call FUNC(translateToModelSpace);
// _outVector = _lgb modelToWorld [_yaw, 1, _pitch];
// _outVector = ATLtoASL _outVector;
_vectorTo = _lgbPos vectorFromTo _outVector;
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];
// hintSilent format["v: %1", _vectorTo];
// _lgb setVectorDir _vectorTo;
_lgb setVectorDirAndUp [_vectorTo, vectorUp _lgb];
};
// _lgb setVectorDir _vectorTo;
_lgb setVectorDirAndUp [_vectorTo, vectorUp _lgb];
};
#ifdef DEBUG_MODE_FULL
hintSilent format["d: %1", _lgbPos vectorDistance _targetPos];
#endif
};
};
#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);
PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
[FUNC(guidance_LGB_LOAL_PFH), 0, _this] call cba_fnc_addPerFrameHandler;
[FUNC(guidance_LGB_LOAL_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 FIREMODE_DIRECT_LOAL");
_this call FUNC(guidance_LGB_LOAL);
};
// Default to FIREMODE_DIRECT_LOAL
// FIREMODE_DIRECT_LOAL
default {
LOG("Initiating FIREMODE_DIRECT_LOAL");
_this call FUNC(guidance_LGB_LOAL);
};
};

View File

@ -14,9 +14,9 @@ _y = _offset select 1;
_z = _offset select 2;
_out = [
((_xVec select 0)*_x) + ((_xVec select 1)*_y) + ((_xVec select 2)*_z),
((_yVec select 0)*_x) + ((_yVec select 1)*_y) + ((_yVec select 2)*_z),
((_zVec select 0)*_x) + ((_zVec select 1)*_y) + ((_zVec select 2)*_z)
];
((_xVec select 0)*_x) + ((_xVec select 1)*_y) + ((_xVec select 2)*_z),
((_yVec select 0)*_x) + ((_yVec select 1)*_y) + ((_yVec select 2)*_z),
((_zVec select 0)*_x) + ((_zVec select 1)*_y) + ((_zVec select 2)*_z)
];
_out;

View File

@ -2,11 +2,11 @@
#include "\z\ace\Addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_MISSILEGUIDANCE
#define DEBUG_MODE_FULL
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_MISSILEGUIDANCE
#define DEBUG_SETTINGS DEBUG_SETTINGS_MISSILEGUIDANCE
#define DEBUG_SETTINGS DEBUG_SETTINGS_MISSILEGUIDANCE
#endif
#include "\z\ace\Addons\main\script_macros.hpp"

View File

@ -21,7 +21,7 @@ private ["_unit", "_anim", "_pos"];
_unit = _this select 0;
_anim = _this select 1;
_pos = _unit modelToWorld (_unit selectionPosition "camera");
_pos = _unit modelToWorldVisual (_unit selectionPosition "camera");
[_unit, "AmovPknlMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
_pos = _pos vectorDiff (_unit selectionPosition "camera");

View File

@ -18,7 +18,7 @@ EXPLODE_3_PVT(_this,_unit,_vehicle,_weapon);
private ["_weaponPos", "_weaponDir", "_weaponPosDown"];
_weaponPos = ATLtoASL (_unit modelToWorld (_unit selectionPosition "RightHand"));
_weaponPos = ATLtoASL (_unit modelToWorldVisual (_unit selectionPosition "RightHand"));
_weaponDir = _unit weaponDirection _weapon;
_weaponPosDown = _weaponPos vectorAdd [0,0,-MAXHEIGHT];

View File

@ -26,7 +26,7 @@ if (count _sound < 3) then {_sound pushBack 1};
if (count _sound < 4) then {_sound pushBack 0};
private "_position";
_position = _unit modelToWorld (_unit selectionPosition "RightHand");
_position = _unit modelToWorldVisual (_unit selectionPosition "RightHand");
_position set [2, (_position select 2) + ((getPosASLW _unit select 2) - (getPosATL _unit select 2) max 0)];
playSound3D [_sound select 0, objNull, false, _position, _sound select 1, _sound select 2, _sound select 3];

View File

@ -27,7 +27,7 @@ if (count _sound < 4) then {_sound pushBack 0};
private "_position";
_position = _unit modelToWorld (_unit selectionPosition "RightHand");
_position = _unit modelToWorldVisual (_unit selectionPosition "RightHand");
_position set [2, (_position select 2) + ((getPosASLW _unit select 2) - (getPosATL _unit select 2) max 0)];
playSound3D [_sound select 0, objNull, false, _position, _sound select 1, _sound select 2, _sound select 3];

View File

@ -1,17 +1,18 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_pre_init));
};
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_pre_init));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_post_init));
};
class ADDON {
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));
};
class CAManBase {
ADDON = QUOTE(_this call FUNC(fired));
};
};

View File

@ -1,50 +0,0 @@
class RscControlsGroup;
class RscPicture;
class RscMapControl;
// Taken from AGM for optics management.
class RscInGameUI {
class RscOptics_titan {
class CA_javelin_elements_group: RscControlsGroup {
class Controls {
class CA_Javelin_Day_mode_off: RscPicture {};
class CA_Javelin_SEEK_off: CA_Javelin_Day_mode_off {
idc = 1005;
};
// From AGM
class GetLockedTarget: RscMapControl {
onDraw = QUOTE(_this call FUNC(onGetLockedTarget));
idc = -1;
w = 0;
h = 0;
};
};
};
};
};
// on colorText[] = {0.2941, 0.8745, 0.2157, 1.0};
// off colorText[] = {0.2941, 0.2941, 0.2941, 1.0};
// orange colorText[] = {0.9255, 0.5216, 0.1216, 1.0};
/*
CA_javelin_elements_group: 170
CA_Javelin_Day_mode_off: 1001
CA_Javelin_Day_mode: 160
CA_Javelin_WFOV_mode_off: 1004
CA_Javelin_WFOV_mode_group: 163
CA_Javelin_NFOV_mode_off: 1003
CA_Javelin_NFOV_mode_group: 162
CA_Javelin_SEEK_off: 1005 //1001
CA_Javelin_SEEK: 166
CA_Javelin_Missle_off: 1032
CA_Javelin_Missle: 167
CA_Javelin_CLU_off: 1027
CA_Javelin_HangFire_off: 1028
CA_Javelin_TOP_off: 1006
CA_Javelin_DIR: 1007
CA_Javelin_FLTR_mode_off: 1002
CA_Javelin_FLTR_mode: 161
*/

View File

@ -0,0 +1,13 @@
class CfgSounds {
class ACE_Javelin_Locking {
name = "ACE_Javelin_Locking";
sound[] = {PATHTOF(data\sounds\javelin_locking.ogg), db+0, 1.0};
titles[] = {};
};
class ACE_Javelin_Locked {
name = "ACE_Javelin_Locked";
sound[] = {PATHTOF(data\sounds\javelin_locked.ogg), db+0, 1.0};
titles[] = {};
};
};

View File

@ -8,5 +8,5 @@ Adds the Javelin AT launcher.
The people responsible for merging changes to this component or answering potential questions.
- [walterpearce](https://github.com/walterpearce)
- [jaynus](https://github.com/walterpearce)
- [NouberNou](https://github.com/NouberNou)

View File

@ -0,0 +1,459 @@
class RscOpticsValue;
class RscControlsGroup;
class RscPicture;
class RscMapControl;
class VScrollbar;
class HScrollbar;
class RscLine;
// Taken from AGM for optics management.
class RscInGameUI {
class RscOptics_titan {
idd = 300;
controls[] = {"ACE_javelin_elements_group"};
onLoad = QUOTE(_this call FUNC(onOpticLoad));
onUnload = "uiNameSpace setVariable ['ACE_RscOptics_javelin',nil];";
class CA_Distance: RscOpticsValue {
idc = 151;
sizeEx = "0";
colorText[] = {0,0,0,0};
x = 0;
y = 0;
w = 0;
h = 0;
};
class ACE_javelin_elements_group: RscControlsGroup
{
x = "SafezoneX";
y = "SafezoneY";
w = "SafezoneW";
h = "SafezoneH";
idc = 170;
class VScrollbar {
autoScrollSpeed = -1;
autoScrollDelay = 5;
autoScrollRewind = 0;
color[] = {1,1,1,0};
width = 0.001;
};
class HScrollbar {
color[] = {1,1,1,0};
height = 0.001;
};
class Controls {
class JavelinLocking : RscMapControl {
onDraw = QUOTE(_this call FUNC(onOpticDraw));
idc = -1;
w = 0;
h = 0;
};
class ACE_javelin_Day_mode_off: RscPicture {
idc = 1001;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (0.03/4)*3*SafezoneH - SafezoneX";
y = "SafezoneY+SafezoneH*0.031 - SafezoneY";
w = "0.1045752* (((SafezoneW*3)/4)/SafezoneW)/(1/SafezoneH)";
h = "SafezoneH*0.1045752";
colorText[] = {0.2941,0.2941,0.2941,1};
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\day_co.paa";
};
class ACE_javelin_Day_mode: ACE_javelin_Day_mode_off {
idc = 160;
colorText[] = {0.2941,0.8745,0.2157,1};
};
class ACE_javelin_WFOV_mode_off: ACE_javelin_Day_mode_off {
idc = 1004;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (0.307/4)*3*SafezoneH - SafezoneX";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\wfov_co.paa";
};
class ACE_javelin_WFOV_mode_group: RscControlsGroup {
x = "SafezoneX";
y = "SafezoneY";
w = "SafezoneW";
h = "SafezoneH";
idc = 163;
class VScrollbar {
autoScrollSpeed = -1;
autoScrollDelay = 5;
autoScrollRewind = 0;
color[] = {1,1,1,0};
width = 0.001;
};
class HScrollbar {
color[] = {1,1,1,0};
height = 0.001;
};
class Controls {
class ACE_javelin_WFOV_mode: ACE_javelin_WFOV_mode_off {
idc = -1;
y = "0.031*SafezoneH - SafezoneY";
x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.307/4)*3*SafezoneH - SafezoneX";
colorText[] = {0.2941,0.8745,0.2157,1};
};
class StadiaL: RscLine {
x = "0.4899*SafezoneW - SafezoneX";
y = "0.171*SafezoneH - SafezoneY";
w = 0;
h = "0.049*SafezoneH";
colorText[] = {0.2941,0.8745,0.2157,1};
};
class StadiaR: RscLine {
x = "0.5109*SafezoneW- SafezoneX";
y = "0.171*SafezoneH - SafezoneY";
w = 0;
h = "0.049*SafezoneH";
colorText[] = {0.2941,0.8745,0.2157,1};
};
class BracketL: RscLine {
x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.293/4)*3*SafezoneH - SafezoneX";
y = "0.4677*SafezoneH - SafezoneY";
w = 0;
h = "0.0646*SafezoneH";
colorText[] = {0.2941,0.8745,0.2157,1};
};
class BracketR: RscLine {
x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.70/4)*3*SafezoneH - SafezoneX";
y = "0.4677*SafezoneH - SafezoneY";
w = 0;
h = "0.0646*SafezoneH";
colorText[] = {0.2941,0.8745,0.2157,1};
};
class BracketT: RscLine {
x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.467/4)*3*SafezoneH - SafezoneX";
y = "0.3535*SafezoneH - SafezoneY";
w = "0.065* (((SafezoneW*3)/4)/SafezoneW)/(1/SafezoneH)";
h = 0;
colorText[] = {0.2941,0.8745,0.2157,1};
};
class BracketB: RscLine {
x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.467/4)*3*SafezoneH - SafezoneX";
y = "0.6465*SafezoneH - SafezoneY";
w = "0.065* (((SafezoneW*3)/4)/SafezoneW)/(1/SafezoneH)";
h = 0;
colorText[] = {0.2941,0.8745,0.2157,1};
};
};
};
class ACE_javelin_NFOV_mode_off: ACE_javelin_Day_mode_off {
idc = 1003;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (0.586/4)*3*SafezoneH - SafezoneX";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\nfov_co.paa";
};
class ACE_javelin_NFOV_mode_group: RscControlsGroup {
x = "SafezoneX";
y = "SafezoneY";
w = "SafezoneW-SafezoneX";
h = "SafezoneH-SafezoneY";
idc = 162;
class VScrollbar {
autoScrollSpeed = -1;
autoScrollDelay = 5;
autoScrollRewind = 0;
color[] = {1,1,1,0};
width = 0.001;
};
class HScrollbar {
color[] = {1,1,1,0};
height = 0.001;
};
class Controls {
class ACE_javelin_NFOV_mode: ACE_javelin_NFOV_mode_off {
idc = 699003;
x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.586/4)*3*SafezoneH - SafezoneX";
y = "0.031*SafezoneH - SafezoneY";
colorText[] = {0.2941,0.8745,0.2157,1};
};
class StadiaL: RscLine {
x = "0.4788*SafezoneW - SafezoneX";
y = "0.171*SafezoneH - SafezoneY";
w = 0;
h = "0.049*SafezoneH";
colorText[] = {0.2941,0.8745,0.2157,1};
};
class StadiaR: RscLine {
x = "0.5212*SafezoneW - SafezoneX";
y = "0.171*SafezoneH - SafezoneY";
w = 0;
h = "0.049*SafezoneH";
colorText[] = {0.2941,0.8745,0.2157,1};
};
class LineHL: RscLine {
x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.01/4)*3*SafezoneH - SafezoneX";
y = "SafezoneH*0.5 - SafezoneY";
w = "0.29* (((SafezoneW*3)/4)/SafezoneW)/(1/SafezoneH)";
h = "SafezoneH*0.0";
colorText[] = {0.2941,0.8745,0.2157,1};
};
class LineHR: RscLine {
x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.695/4)*3*SafezoneH - SafezoneX";
y = "SafezoneH*0.5 - SafezoneY";
w = "0.29* (((SafezoneW*3)/4)/SafezoneW)/(1/SafezoneH)";
h = "SafezoneH*0.0";
colorText[] = {0.2941,0.8745,0.2157,1};
};
class LineVT: RscLine {
x = "0.5*SafezoneW - SafezoneX";
y = "0.171*SafezoneH - SafezoneY";
w = 0;
h = "0.1825*SafezoneH";
colorText[] = {0.2941,0.8745,0.2157,1};
};
class LineVB: RscLine {
x = "0.5*SafezoneW - SafezoneX";
y = "0.6465*SafezoneH - SafezoneY";
w = 0;
h = "0.1895*SafezoneH";
colorText[] = {0.2941,0.8745,0.2157,1};
};
};
};
/*
class TargetingConstrains: RscControlsGroup {
idc = 699100;
x = "SafezoneX";
y = "SafezoneY";
w = "SafezoneW-SafezoneX";
h = "SafezoneH-SafezoneY";
class VScrollbar {
autoScrollSpeed = -1;
autoScrollDelay = 5;
autoScrollRewind = 0;
color[] = {1,1,1,0};
width = 0.001;
};
class HScrollbar {
color[] = {1,1,1,0};
height = 0.001;
};
class Controls {
class Top: RscPicture {
idc = 699101;
text = "#(argb,8,8,3)color(1,1,1,1)";
colorText[] = {0.2941,0.2941,0.2941,1};
x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX";
y = "0.15*SafezoneH-SafezoneY";
w = "(3/4)*SafezoneH";
h = "0.21*SafezoneH";
};
class Bottom: Top {
idc = 699102;
y = "0.64*SafezoneH-SafezoneY";
};
class Left: Top {
idc = 699103;
x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX";
y = "0.36*SafezoneH-SafezoneY";
w = "0.31*(3/4)*SafezoneH";
h = "0.28*SafezoneH";
};
class Right: Left {
idc = 699104;
x = "((SafezoneW -(3/4)*SafezoneH)/2)+ 0.69*(3/4)*SafezoneH - SafezoneX";
};
class OpticsBorders: RscPicture {
idc = 699105;
text = PATHTOF(data\javelin_ui_border_ca.paa);
colorText[] = {0,0,0,1};
x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX";
y = "0.15*SafezoneH-SafezoneY";
w = "(3/4)*SafezoneH";
h = "0.7*SafezoneH";
};
};
};
class TargetingGate: TargetingConstrains {
idc = 699200;
class Controls {
class TargetingGateTL: TargetingConstrains {
x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX";
y = "0.15*SafezoneH - SafezoneY";
idc = 699201;
class Controls {
class LineH: RscLine {
idc = 699210;
x = "0";
y = "0";
w = "0.025*(3/4)*SafezoneH";
h = "0";
colorText[] = {0.8745,0.8745,0.8745,1};
};
class LineV: LineH {
idc = 699211;
w = "0";
h = "0.025*SafezoneH";
};
};
};
class TargetingGateTR: TargetingGateTL {
x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX + 0.975*(3/4)*SafezoneH";
y = "0.15*SafezoneH - SafezoneY";
idc = 699202;
class Controls {
class LineH: RscLine {
idc = 699220;
x = "0";
y = "0";
w = "0.025*(3/4)*SafezoneH";
h = "0";
colorText[] = {0.8745,0.8745,0.8745,1};
};
class LineV: LineH {
idc = 699221;
x = "0.025*(3/4)*SafezoneH";
w = "0";
h = "0.025*SafezoneH";
};
};
};
class TargetingGateBL: TargetingGateTL {
x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX";
y = "0.825*SafezoneH - SafezoneY";
idc = 699203;
class Controls {
class LineH: RscLine {
x = "0";
y = "0.025*SafezoneH";
w = "0.025*(3/4)*SafezoneH";
h = "0";
colorText[] = {0.8745,0.8745,0.8745,1};
};
class LineV: LineH {
y = "0";
w = "0";
h = "0.025*SafezoneH";
};
};
};
class TargetingGateBR: TargetingGateBL {
x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX + 0.975*(3/4)*SafezoneH";
y = "0.825*SafezoneH - SafezoneY";
idc = 699204;
class Controls {
class LineH: RscLine {
x = "0";
y = "0.025*SafezoneH";
w = "0.025*(3/4)*SafezoneH";
h = "0";
colorText[] = {0.8745,0.8745,0.8745,1};
};
class LineV: LineH {
x = "0.025*(3/4)*SafezoneH";
y = "0";
w = "0";
h = "0.025*SafezoneH";
};
};
};
};
};
class TargetingLines: TargetingConstrains {
idc = 699300;
class Controls {
class LineH: RscLine {
idc = 699301;
x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX";
y = "0.5*SafezoneH - SafezoneY";
w = "(3/4)*SafezoneH";
h = "0";
colorText[] = {0.8745,0.8745,0.8745,1};
};
class LineV: RscLine {
idc = 699302;
x = "0.5*SafezoneW - SafezoneX";
y = "0.15*SafezoneH - SafezoneY";
w = "0";
h = "0.7*SafezoneH";
colorText[] = {0.8745,0.8745,0.8745,1};
};
};
};
*/
class ACE_javelin_SEEK_off: ACE_javelin_Day_mode_off {
idc = 699000;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (0.863/4)*3*SafezoneH - SafezoneX";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\seek_co.paa";
};
class ACE_javelin_SEEK: ACE_javelin_SEEK_off {
idc = 166;
colorText[] = {0.2941,0.8745,0.2157,0};
};
class ACE_javelin_Missle_off: ACE_javelin_Day_mode_off {
idc = 1032;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (-0.134/4)*3*SafezoneH - SafezoneX";
y = "(SafezoneY + 0.208*SafezoneH) - SafezoneY";
colorText[] = {0.2941,0.2941,0.2941,1};
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\missle_co.paa";
};
class ACE_javelin_Missle: ACE_javelin_Missle_off {
idc = 167;
colorText[] = {0.9255,0.5216,0.1216,0};
};
class ACE_javelin_CLU_off: ACE_javelin_Missle_off {
idc = 1027;
y = "(SafezoneY + 0.436*SafezoneH) - SafezoneY";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\clu_co.paa";
};
class ACE_javelin_HangFire_off: ACE_javelin_Missle_off {
idc = 1028;
y = "(SafezoneY + 0.669*SafezoneH) - SafezoneY";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\hangfire_co.paa";
};
class ACE_javelin_TOP_off: ACE_javelin_Day_mode_off {
idc = 699001;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (1.023/4)*3*SafezoneH - SafezoneX";
y = "(SafezoneY + 0.208*SafezoneH) - SafezoneY";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\top_co.paa";
colorText[] = {0.2941,0.8745,0.2157,1};
};
class ACE_javelin_DIR: ACE_javelin_Day_mode {
idc = 699002;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (1.023/4)*3*SafezoneH - SafezoneX";
y = "(SafezoneY + 0.436*SafezoneH) - SafezoneY";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\dir_co.paa";
colorText[] = {0.2941,0.2941,0.2941,1};
};
class ACE_javelin_FLTR_mode_off: ACE_javelin_Day_mode_off {
idc = 1002;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (1.023/4)*3*SafezoneH - SafezoneX";
y = "(SafezoneY + 0.669*SafezoneH) - SafezoneY";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\fltr_co.paa";
};
class ACE_javelin_FLTR_mode: ACE_javelin_FLTR_mode_off {
idc = 161;
colorText[] = {0.2941,0.8745,0.2157,1};
};
};
};
};
};
// on colorText[] = {0.2941, 0.8745, 0.2157, 1.0};
// off colorText[] = {0.2941, 0.2941, 0.2941, 1.0};
// orange colorText[] = {0.9255, 0.5216, 0.1216, 1.0};
/*
ACE_Titan_elements_group: 170
ACE_Titan_Day_mode_off: 1001
ACE_Titan_Day_mode: 160
ACE_Titan_WFOV_mode_off: 1004
ACE_Titan_WFOV_mode_group: 163
ACE_Titan_NFOV_mode_off: 1003
ACE_Titan_NFOV_mode_group: 162
ACE_Titan_SEEK_off: 1005 //1001
ACE_Titan_SEEK: 166
ACE_Titan_Missle_off: 1032
ACE_Titan_Missle: 167
ACE_Titan_CLU_off: 1027
ACE_Titan_HangFire_off: 1028
ACE_Titan_TOP_off: 1006
ACE_Titan_DIR: 1007
ACE_Titan_FLTR_mode_off: 1002
ACE_Titan_FLTR_mode: 161
*/

View File

@ -0,0 +1,3 @@
#include "script_component.hpp"
#include "initKeybinds.sqf"

View File

@ -1,3 +1,2 @@
#include "script_component.hpp"
NO_DEDICATED;

View File

@ -1,7 +1,15 @@
#include "script_component.hpp"
PREP(fired);
PREP(onGetLockedTarget);
PREP(translateToWeaponSpace);
PREP(translateToModelSpace);
PREP(lockKeyDown);
PREP(lockKeyUp);
PREP(cycleFireMode);
PREP(onOpticLoad);
PREP(onOpticDraw);
GVAR(isLockKeyDown) = false;

View File

@ -11,4 +11,5 @@ class CfgPatches {
};
#include "CfgEventhandlers.hpp"
#include "CfgOptics.hpp"
#include "RscInGameUI.hpp"
#include "CfgSounds.hpp"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,19 @@
#define DEBUG_MODE_FULL
#include "script_component.hpp"
TRACE_1("enter", _this);
private["_player", "_currentFireMode"];
_currentFireMode = ACE_player getVariable["ACE_FIRE_SELECTION", ACE_JAV_FIREMODE_TOP];
if(_currentFireMode == ACE_JAV_FIREMODE_DIR) then {
_currentFireMode = ACE_JAV_FIREMODE_TOP;
__JavelinIGUITop ctrlSetTextColor __ColorGreen;
__JavelinIGUIDir ctrlSetTextColor __ColorGray;
} else {
_currentFireMode = ACE_JAV_FIREMODE_DIR;
__JavelinIGUITop ctrlSetTextColor __ColorGray;
__JavelinIGUIDir ctrlSetTextColor __ColorGreen;
};
ACE_player setVariable["ACE_FIRE_SELECTION", _currentFireMode, false];

View File

@ -1,48 +1,39 @@
//#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);
TRACE_1("Launch", _this);
PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
FUNC(guidance_Javelin_LOBL_HI_PFH) = {
FUNC(guidance_Javelin_LOBL_DIR_PFH) = {
TRACE_1("enter", _this);
private["_pitch", "_yaw", "_wentTerminal", "_target", "_targetPos", "_curVelocity", "_missile" ];
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 _this) > 2) then {
_wentTerminal = _this select 2;
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 {
_this set[2, false];
_wentTerminal = false;
_wentTerminal = false;
_launchPos = getPosASL _shooter;
_target = ACE_player getVariable[QGVAR(currentTarget), objNull];
_targetStartPos = ACE_player getVariable[QGVAR(currentTargetPos), [0,0,0]];
};
if((count _this) > 3) then {
_targets = _this select 3;
_target = _targets select 0;
_targetPos = _targets select 1;
} else {
_this set[3, [GVAR(currentTarget),GVAR(currentTargetPos)] ];
_target = GVAR(currentTarget);
_targetPos = GVAR(currentTargetPos);
};
_curVelocity = velocity _missile;
if(!alive _missile || isNull _missile) exitWith {
if(!alive _missile || isNull _missile || isNull _target) exitWith {
[(_this select 1)] call cba_fnc_removePerFrameHandler;
};
_targetPos = getPosASL _target;
_curVelocity = velocity _missile;
_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];
};
TRACE_4("", _target, _targetPos, _launchPos, _targetStartPos);
_addHeight = [0,0,0];
if(!isNil "_target") then {
@ -58,39 +49,45 @@ FUNC(guidance_Javelin_LOBL_HI_PFH) = {
if((count _targetPos) > 0) then {
_distanceToTarget = [(_missilePos select 0), (_missilePos select 1), (_targetPos select 2)] vectorDistance _targetPos;
_defPitch = 0.25;
if( (_missilePos select 2) < (_targetPos select 2) + 60 && !_wentTerminal) then {
_addHeight = [0,0,(_targetPos select 2) + 120];
if( (_missilePos select 2) < (_targetPos select 2) + 160 && !_wentTerminal) then {
_addHeight = [0,0,(_targetPos select 2) + ( (_distanceToTarget * 2) + 160)];
TRACE_1("Climb phase", _addHeight);
_defPitch = 0.15;
_defYaw = 0.035;
TRACE_1("Climb phase", _addHeight);
} else {
_wentTerminal = true;
_this set[2, _wentTerminal];
TRACE_1("TERMINAL", "");
_defPitch = 0.15;
_defYaw = 0.035;
TRACE_1("TERMINAL", "");
};
_targetPos = _targetPos vectorAdd _addHeight;
_defYaw = 0.0035;
_targetVectorSeeker = [_missile, [_xVec, _yVec, _zVec], _targetPos] call FUNC(translateToWeaponSpace);
_yaw = 0.0;
TRACE_5("", _missile, _xVec, _yVec, _zVec, _targetPos);
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;
};
};
_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);
@ -105,11 +102,6 @@ FUNC(guidance_Javelin_LOBL_HI_PFH) = {
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
@ -127,25 +119,167 @@ FUNC(guidance_Javelin_LOBL_HI_PFH) = {
#endif
};
};
_saveArgs = [_target,_targetStartPos, _launchPos, _wentTerminal];
_args set[7, _saveArgs ];
_this set[0, _args];
};
FUNC(guidance_Javelin_LOBL_HI) = {
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_HI_PFH), 0, _this] call cba_fnc_addPerFrameHandler;
[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_FIRE_SELECTION", ACE_DEFAULT_FIRE_SELECTION];
_fireMode = _shooter getVariable ["ACE_FIRE_SELECTION", ACE_JAV_FIREMODE_TOP];
switch (_fireMode select 0) do {
// Default to FIREMODE_DIRECT_LOAL
// FIREMODE_DIRECT_LOAL
default {
LOG("Initiating Javelin FIREMODE_LOBL_HI");
_this call FUNC(guidance_Javelin_LOBL_HI);
};
};
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);
};
};
};

View File

@ -0,0 +1,3 @@
#define DEBUG_MODE_FULL
#include "script_component.hpp"
TRACE_1("enter", _this);

View File

@ -0,0 +1,3 @@
#define DEBUG_MODE_FULL
#include "script_component.hpp"
TRACE_1("enter", _this);

View File

@ -1,8 +0,0 @@
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
// Store the current cursor target for guidance
GVAR(currentTarget) = cursorTarget;
GVAR(currentTargetPos) = screenToWorld [0.5,0.5];
TRACE_2("Tracking optics target draw", GVAR(currentTarget), GVAR(currentTargetPos));

View File

@ -0,0 +1,132 @@
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
//TRACE_1("enter", _this);
#define __TRACKINTERVAL 0.1 // how frequent the check should be.
#define __LOCKONTIME 1.85 // Lock on won't occur sooner
#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
_args = uiNamespace getVariable[QGVAR(arguments), [] ];
if( (count _args) > 0) then {
_lastTick = _args select 0;
if(diag_tickTime - _lastTick > 1) then {
[] call FUNC(onOpticLoad);
};
};
// Pull the arguments
_currentTarget = _args select 1;
_runTime = _args select 2;
_lockTime = _args select 3;
_soundTime = _args select 4;
// Find a target within the optic range
_newTarget = objNull;
// Bail on fast movement
if ((velocity ACE_player) distance [0,0,0] > 0.5 && {cameraView == "GUNNER"} && {cameraOn == ACE_player}) exitWith { // keep it steady.
ACE_player switchCamera "INTERNAL";
};
// Only start locking on holding tab
if(!GVAR(isLockKeyDown)) exitWith { false };
_range = parseNumber (ctrlText __JavelinIGUIRangefinder);
if (_range > 50 && {_range < 2500}) then {
_pos = positionCameraToWorld [0,0,_range];
_targetArray = _pos nearEntities ["AllVehicles", _range/25];
if (count (_targetArray) > 0) then {
_newTarget = _targetArray select 0;
};
};
if (isNull _newTarget) then {
_newTarget = cursorTarget;
};
if (isNull _newTarget) then {
// No targets found
_currentTarget = objNull;
_lockTime = 0;
__JavelinIGUISeek ctrlSetTextColor __ColorGray;
__JavelinIGUINFOV ctrlSetTextColor __ColorGreen;
__JavelinIGUITargetingConstrains ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false;
ACE_player setVariable [QGVAR(currentTarget),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];};
} else {
if (_newTarget distance ACE_player < 2500
// && {(call CBA_fnc_getFoV) select 1 > 7}
// && { (currentVisionMode ACE_player == 2)}
) then {
// Lock on after 3 seconds
if(_currentTarget != _newTarget) then {
TRACE_1("New Target, reseting locking", _newTarget);
_lockTime = diag_tickTime;
_currentTarget = _newTarget;
playSound "ACE_Javelin_Locking";
} else {
if(diag_tickTime - _lockTime > 3) then {
TRACE_2("LOCKED!", _currentTarget, _lockTime);
__JavelinIGUISeek ctrlSetTextColor __ColorGreen;
__JavelinIGUINFOV ctrlSetTextColor __ColorNull;
__JavelinIGUITargetingConstrains ctrlShow true;
ACE_player setVariable[QGVAR(currentTarget), _currentTarget, false];
ACE_player setVariable[QGVAR(currentTargetPos), getPosASL _currentTarget, false];
if(diag_tickTime > _soundTime) then {
playSound "ACE_Javelin_Locked";
_soundTime = diag_tickTime + 0.25;
};
} else {
if(diag_tickTime > _soundTime) then {
playSound "ACE_Javelin_Locking";
_soundTime = diag_tickTime + 0.25;
};
};
};
} else {
// Something is wrong with our seek
_currentTarget = objNull;
__JavelinIGUISeek ctrlSetTextColor __ColorGray;
__JavelinIGUINFOV ctrlSetTextColor __ColorGray;
__JavelinIGUITargetingConstrains ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false;
ACE_player setVariable [QGVAR(currentTarget),nil, false];
};
};
//TRACE_2("", _newTarget, _currentTarget);
// Save arguments for next run
_args set[0, diag_tickTime];
_args set[1, _currentTarget];
_args set[2, _runTime];
_args set[3, _lockTime];
_args set[4, _soundTime];
uiNamespace setVariable[QGVAR(arguments), _args ];

View File

@ -0,0 +1,17 @@
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
TRACE_1("enter", _this);
if((count _this) > 0) then {
uiNameSpace setVariable ['ACE_RscOptics_javelin',_this select 0];
};
uiNameSpace setVariable [QGVAR(arguments),
[
0, // Last runtime
objNull, // currentTargetObject
0, // Run Time
0, // Lock Time
0 // Sound timer
]
];

View File

@ -1,3 +1,7 @@
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
TRACE_1("enter", _this);
_object = _this select 0;
_origin = getPosASL _object;
_matrix = _this select 1;

View File

@ -1,3 +1,6 @@
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
TRACE_1("enter", _this);
_object = _this select 0;
_origin = getPosASL _object;

View File

@ -0,0 +1,30 @@
// by commy2
["ACE3", QGVAR(lockTarget), localize "STR_ACE_WEP_JAVELIN_LockTarget",
{
if (GETGVAR(isLockKeyDown,false)) exitWith {false};
GVAR(isLockKeyDown) = true;
// Statement
[ACE_player] call FUNC(lockKeyDown);
// Return false so it doesn't block the rest weapon action
false
},
{
// prevent holding down
GVAR(isLockKeyDown) = false;
// Statement
[ACE_player] call FUNC(lockKeyUp);
false
},
[15, [false, false, false]], false] call cba_fnc_addKeybind; //Tab Key
["ACE3", QGVAR(cycleFireMode), localize "STR_ACE_WEP_JAVELIN_CycleFireMode",
{ false },
{
[ACE_player] call FUNC(cycleFireMode);
false
},
[15, [false, true, false]], false] call cba_fnc_addKeybind; //Shift+Tab Key

View File

@ -2,11 +2,52 @@
#include "\z\ace\Addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_WEP_JAVELIN
#define DEBUG_MODE_FULL
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_WEP_JAVELIN
#define DEBUG_SETTINGS DEBUG_SETTINGS_WEP_JAVELIN
#define DEBUG_SETTINGS DEBUG_SETTINGS_WEP_JAVELIN
#endif
#include "\z\ace\Addons\main\script_macros.hpp"
#define ACE_JAV_FIREMODE_DIR 1
#define ACE_JAV_FIREMODE_TOP 2
// Javelin IGUI defines
#define __JavelinIGUI (uinamespace getVariable "ACE_RscOptics_javelin")
// Custom controls
#define __JavelinIGUISeek (__JavelinIGUI displayCtrl 699000)
#define __JavelinIGUITop (__JavelinIGUI displayCtrl 699001)
#define __JavelinIGUIDir (__JavelinIGUI displayCtrl 699002)
#define __JavelinIGUINFOV (__JavelinIGUI displayCtrl 699003)
// Constrains
#define __JavelinIGUITargetingConstrains (__JavelinIGUI displayCtrl 699100)
#define __JavelinIGUITargetingConstrainTop (__JavelinIGUI displayCtrl 699101)
#define __JavelinIGUITargetingConstrainBottom (__JavelinIGUI displayCtrl 699102)
#define __JavelinIGUITargetingConstrainLeft (__JavelinIGUI displayCtrl 699103)
#define __JavelinIGUITargetingConstrainRight (__JavelinIGUI displayCtrl 699104)
// Targeting gate
#define __JavelinIGUITargetingGate (__JavelinIGUI displayCtrl 699200)
#define __JavelinIGUITargetingGateTL (__JavelinIGUI displayCtrl 699201)
#define __JavelinIGUITargetingGateTR (__JavelinIGUI displayCtrl 699202)
#define __JavelinIGUITargetingGateBL (__JavelinIGUI displayCtrl 699203)
#define __JavelinIGUITargetingGateBR (__JavelinIGUI displayCtrl 699204)
// Rangefinder
#define __JavelinIGUIRangefinder (__JavelinIGUI displayCtrl 151)
// Targeting lines
#define __JavelinIGUITargetingLines (__JavelinIGUI displayCtrl 699300)
#define __JavelinIGUITargetingLineH (__JavelinIGUI displayCtrl 699301)
#define __JavelinIGUITargetingLineV (__JavelinIGUI displayCtrl 699302)
// Colors for controls
#define __ColorOrange [0.9255,0.5216,0.1216,1]
#define __ColorGreen [0.2941,0.8745,0.2157,1]
#define __ColorGray [0.2941,0.2941,0.2941,1]
#define __ColorNull [0,0,0,0]

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2014-12-19 -->
<Project name="ACE">
<Package name="WEP_JAVELIN">
<Key ID="STR_ACE_WEP_JAVELIN_LockTarget">
<English>Lock Target (Hold)</English>
<German>Lock Target (Hold)</German>
<French>Lock Target (Hold)</French>
<Polish>Lock Target (Hold)</Polish>
<Czech>Lock Target (Hold)</Czech>
<Spanish>Lock Target (Hold)</Spanish>
<Russian>Lock Target (Hold)</Russian>
</Key>
<Key ID="STR_ACE_WEP_JAVELIN_CycleFireMode">
<English>Cycle Fire Mode</English>
<German>Cycle Fire Mode</German>
<French>Cycle Fire Mode</French>
<Polish>Cycle Fire Mode</Polish>
<Czech>Cycle Fire Mode</Czech>
<Spanish>Cycle Fire Mode</Spanish>
<Russian>Cycle Fire Mode</Russian>
</Key>
</Package>
</Project>