diff --git a/addons/aircraft/CfgVehicles.hpp b/addons/aircraft/CfgVehicles.hpp index e9fb90e61e..559b8dc2e1 100644 --- a/addons/aircraft/CfgVehicles.hpp +++ b/addons/aircraft/CfgVehicles.hpp @@ -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 { diff --git a/addons/aircraft/CfgWeapons.hpp b/addons/aircraft/CfgWeapons.hpp index c5f22fc3a2..917ba1c174 100644 --- a/addons/aircraft/CfgWeapons.hpp +++ b/addons/aircraft/CfgWeapons.hpp @@ -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 { diff --git a/addons/aircraft/Heli_Attack_01_base_F.hpp b/addons/aircraft/Heli_Attack_01_base_F.hpp new file mode 100644 index 0000000000..ee271f826a --- /dev/null +++ b/addons/aircraft/Heli_Attack_01_base_F.hpp @@ -0,0 +1,997 @@ +class Heli_Attack_01_base_F: Helicopter_Base_F { + lockDetectionSystem = 12; + incomingMissileDetectionSystem = 16; + driverCanEject = 1; + + class MFD + { + class AirplaneHUD + { + class Bones{}; + class Draw{}; + topLeft = "HUD_top_left"; + topRight = "HUD_top_right"; + bottomLeft = "HUD_bottom_left"; + borderLeft = 0; + borderRight = 0; + borderTop = 0; + borderBottom = 0; + color[] = {0.15,1,0.15,1}; + enableParallax = 0; + helmetMountedDisplay = 1; + helmetPosition[] = {0,0,0}; + helmetRight[] = {0,0,0}; + helmetDown[] = {0,0,0}; + }; + class ACE_HUD_1 + { + topLeft = "HUD_top_left"; + topRight = "HUD_top_right"; + bottomLeft = "HUD_bottom_left"; + borderLeft = 0; + borderRight = 0; + borderTop = 0; + borderBottom = 0; + color[] = {0.15,1,0.15,1}; + enableParallax = 0; + class Bones + { + class GunnerAim + { + type = "vector"; + source = "weapon"; + pos0[] = {0.5,"0.9 - 0.04 + 0.012"}; + pos10[] = {"0.5 + 0.0111","0.9 - 0.04 + 0.012 + 0.0133"}; + }; + class Target + { + source = "target"; + type = "vector"; + pos0[] = {0.5,0.5}; + pos10[] = {0.85,0.85}; + }; + class Velocity + { + type = "vector"; + source = "velocity"; + pos0[] = {0.5,0.5}; + pos10[] = {0.65,0.65}; + }; + class Velocity_slip + { + type = "vector"; + source = "velocity"; + pos0[] = {0.5,0.845}; + pos10[] = {0.53,0.845}; + }; + class VspeedBone + { + type = "linear"; + source = "vspeed"; + sourceScale = 1; + min = -10; + max = 10; + minPos[] = {0.93,0.2}; + maxPos[] = {0.93,0.8}; + }; + class RadarAltitudeBone + { + type = "linear"; + source = "altitudeAGL"; + sourceScale = 1; + min = 0; + max = 60; + minPos[] = {0.965,0.2}; + maxPos[] = {0.965,0.8}; + }; + class HorizonBankRot + { + type = "rotational"; + source = "horizonBank"; + center[] = {0.5,0.5}; + min = -3.1416; + max = 3.1416; + minAngle = -180; + maxAngle = 180; + aspectRatio = 1; + }; + class ForwardVec + { + type = "vector"; + source = "forward"; + pos0[] = {0,0}; + pos10[] = {0.25,0.25}; + }; + class WeaponAim + { + type = "vector"; + source = "weapon"; + pos0[] = {0.5,0.5}; + pos10[] = {0.75,0.75}; + }; + class Level0 + { + type = "horizon"; + pos0[] = {0.5,0.5}; + pos10[] = {0.78,0.78}; + angle = 0; + }; + class LevelP5: Level0 + { + angle = 5; + }; + class LevelM5: Level0 + { + angle = -5; + }; + class LevelP10: Level0 + { + angle = 10; + }; + class LevelM10: Level0 + { + angle = -10; + }; + class LevelP15: Level0 + { + angle = 15; + }; + class LevelM15: Level0 + { + angle = -15; + }; + class LevelP20: Level0 + { + angle = 20; + }; + class LevelM20: Level0 + { + angle = -20; + }; + class LevelP25: Level0 + { + angle = 25; + }; + class LevelM25: Level0 + { + angle = -25; + }; + class LevelP30: Level0 + { + angle = 30; + }; + class LevelM30: Level0 + { + angle = -30; + }; + class LevelP35: Level0 + { + angle = 35; + }; + class LevelM35: Level0 + { + angle = -35; + }; + class LevelP40: Level0 + { + angle = 40; + }; + class LevelM40: Level0 + { + angle = -40; + }; + class LevelP45: Level0 + { + angle = 45; + }; + class LevelM45: Level0 + { + angle = -45; + }; + class LevelP50: Level0 + { + angle = 50; + }; + class LevelM50: Level0 + { + angle = -50; + }; + }; + class Draw + { + color[] = {0.18,1,0.18}; + alpha = 1; + condition = "on"; + class Horizont + { + clipTL[] = {0.15,0.15}; + clipBR[] = {0.85,0.85}; + class Dimmed + { + class Level0 + { + type = "line"; + points[] = {{ "Level0",{ -0.42,0 },1 },{ "Level0",{ -0.38,0 },1 },{ },{ "Level0",{ -0.37,0 },1 },{ "Level0",{ -0.33,0 },1 },{ },{ "Level0",{ -0.32,0 },1 },{ "Level0",{ -0.28,0 },1 },{ },{ "Level0",{ -0.27,0 },1 },{ "Level0",{ -0.23,0 },1 },{ },{ "Level0",{ -0.22,0 },1 },{ "Level0",{ -0.18,0 },1 },{ },{ "Level0",{ -0.17,0 },1 },{ "Level0",{ -0.13,0 },1 },{ },{ "Level0",{ -0.12,0 },1 },{ "Level0",{ -0.08,0 },1 },{ },{ "Level0",{ 0.42,0 },1 },{ "Level0",{ 0.38,0 },1 },{ },{ "Level0",{ 0.37,0 },1 },{ "Level0",{ 0.33,0 },1 },{ },{ "Level0",{ 0.32,0 },1 },{ "Level0",{ 0.28,0 },1 },{ },{ "Level0",{ 0.27,0 },1 },{ "Level0",{ 0.23,0 },1 },{ },{ "Level0",{ 0.22,0 },1 },{ "Level0",{ 0.18,0 },1 },{ },{ "Level0",{ 0.17,0 },1 },{ "Level0",{ 0.13,0 },1 },{ },{ "Level0",{ 0.12,0 },1 },{ "Level0",{ 0.08,0 },1 }}; + }; + }; + }; + class HorizonBankRot + { + type = "line"; + width = 3; + points[] = {{ "HorizonBankRot",{ 0,0.25 },1 },{ "HorizonBankRot",{ -0.01,0.23 },1 },{ "HorizonBankRot",{ 0.01,0.23 },1 },{ "HorizonBankRot",{ 0,0.25 },1 }}; + }; + class Static_HAD_BOX + { + clipTL[] = {0,1}; + clipBR[] = {1,0}; + type = "line"; + width = 5; + points[] = {{ { "0.5-0.1","0.9-0.04" },1 },{ { "0.5-0.1","0.9+0.04" },1 },{ { "0.5+0.1","0.9+0.04" },1 },{ { "0.5+0.1","0.9-0.04" },1 },{ { "0.5-0.1","0.9-0.04" },1 },{ },{ { "0.5-0.1","0.9-0.04+0.012" },1 },{ { "0.5-0.092","0.9-0.04+0.012" },1 },{ },{ { "0.5+0.1","0.9-0.04+0.012" },1 },{ { "0.5+0.092","0.9-0.04+0.012" },1 },{ },{ { 0.5,"0.9-0.04" },1 },{ { 0.5,"0.9-0.032" },1 },{ },{ { 0.5,"0.9+0.04" },1 },{ { 0.5,"0.9+0.032" },1 },{ }}; + }; + class Gunner_HAD + { + type = "line"; + width = 6; + points[] = {{ "GunnerAim",{ -0.015,-0.008 },1 },{ "GunnerAim",{ -0.015,0.008 },1 },{ "GunnerAim",{ 0.015,0.008 },1 },{ "GunnerAim",{ 0.015,-0.008 },1 },{ "GunnerAim",{ -0.015,-0.008 },1 }}; + }; + class Slip_ball_group + { + class Slip_bars + { + type = "line"; + width = 4; + points[] = {{ { "0.5-0.018","0.9-0.04" },1 },{ { "0.5-0.018","0.9-0.075" },1 },{ },{ { "0.5+0.018","0.9-0.04" },1 },{ { "0.5+0.018","0.9-0.075" },1 }}; + }; + class Slip_ball + { + type = "line"; + width = 6; + points[] = {{ "Velocity_slip",1,{ "0 * 0.75","-0.02 * 0.75" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.75","-0.01732 * 0.75" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.75","-0.0099999998 * 0.75" },1 },{ "Velocity_slip",1,{ "0.02 * 0.75","0 * 0.75" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.75","0.0099999998 * 0.75" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.75","0.01732 * 0.75" },1 },{ "Velocity_slip",1,{ "0 * 0.75","0.02 * 0.75" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.75","0.01732 * 0.75" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.75","0.0099999998 * 0.75" },1 },{ "Velocity_slip",1,{ "-0.02 * 0.75","0 * 0.75" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.75","-0.0099999998 * 0.75" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.75","-0.01732 * 0.75" },1 },{ "Velocity_slip",1,{ "0 * 0.75","-0.02 * 0.75" },1 },{ },{ "Velocity_slip",1,{ "0 * 0.6","-0.02 * 0.6" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.6","-0.01732 * 0.6" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.6","-0.0099999998 * 0.6" },1 },{ "Velocity_slip",1,{ "0.02 * 0.6","0 * 0.6" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.6","0.0099999998 * 0.6" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.6","0.01732 * 0.6" },1 },{ "Velocity_slip",1,{ "0 * 0.6","0.02 * 0.6" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.6","0.01732 * 0.6" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.6","0.0099999998 * 0.6" },1 },{ "Velocity_slip",1,{ "-0.02 * 0.6","0 * 0.6" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.6","-0.0099999998 * 0.6" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.6","-0.01732 * 0.6" },1 },{ "Velocity_slip",1,{ "0 * 0.6","-0.02 * 0.6" },1 },{ },{ "Velocity_slip",1,{ "0 * 0.5","-0.02 * 0.5" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.5","-0.01732 * 0.5" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.5","-0.0099999998 * 0.5" },1 },{ "Velocity_slip",1,{ "0.02 * 0.5","0 * 0.5" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.5","0.0099999998 * 0.5" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.5","0.01732 * 0.5" },1 },{ "Velocity_slip",1,{ "0 * 0.5","0.02 * 0.5" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.5","0.01732 * 0.5" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.5","0.0099999998 * 0.5" },1 },{ "Velocity_slip",1,{ "-0.02 * 0.5","0 * 0.5" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.5","-0.0099999998 * 0.5" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.5","-0.01732 * 0.5" },1 },{ "Velocity_slip",1,{ "0 * 0.5","-0.02 * 0.5" },1 },{ },{ "Velocity_slip",1,{ "0 * 0.4","-0.02 * 0.4" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.4","-0.01732 * 0.4" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.4","-0.0099999998 * 0.4" },1 },{ "Velocity_slip",1,{ "0.02 * 0.4","0 * 0.4" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.4","0.0099999998 * 0.4" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.4","0.01732 * 0.4" },1 },{ "Velocity_slip",1,{ "0 * 0.4","0.02 * 0.4" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.4","0.01732 * 0.4" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.4","0.0099999998 * 0.4" },1 },{ "Velocity_slip",1,{ "-0.02 * 0.4","0 * 0.4" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.4","-0.0099999998 * 0.4" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.4","-0.01732 * 0.4" },1 },{ "Velocity_slip",1,{ "0 * 0.4","-0.02 * 0.4" },1 },{ },{ "Velocity_slip",1,{ "0 * 0.30","-0.02 * 0.30" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.30","-0.01732 * 0.30" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.30","-0.0099999998 * 0.30" },1 },{ "Velocity_slip",1,{ "0.02 * 0.30","0 * 0.30" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.30","0.0099999998 * 0.30" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.30","0.01732 * 0.30" },1 },{ "Velocity_slip",1,{ "0 * 0.30","0.02 * 0.30" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.30","0.01732 * 0.30" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.30","0.0099999998 * 0.30" },1 },{ "Velocity_slip",1,{ "-0.02 * 0.30","0 * 0.30" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.30","-0.0099999998 * 0.30" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.30","-0.01732 * 0.30" },1 },{ "Velocity_slip",1,{ "0 * 0.30","-0.02 * 0.30" },1 },{ },{ "Velocity_slip",1,{ "0 * 0.20","-0.02 * 0.20" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.20","-0.01732 * 0.20" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.20","-0.0099999998 * 0.20" },1 },{ "Velocity_slip",1,{ "0.02 * 0.20","0 * 0.20" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.20","0.0099999998 * 0.20" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.20","0.01732 * 0.20" },1 },{ "Velocity_slip",1,{ "0 * 0.20","0.02 * 0.20" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.20","0.01732 * 0.20" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.20","0.0099999998 * 0.20" },1 },{ "Velocity_slip",1,{ "-0.02 * 0.20","0 * 0.20" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.20","-0.0099999998 * 0.20" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.20","-0.01732 * 0.20" },1 },{ "Velocity_slip",1,{ "0 * 0.20","-0.02 * 0.20" },1 },{ },{ "Velocity_slip",1,{ "0 * 0.1","-0.02 * 0.1" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.1","-0.01732 * 0.1" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.1","-0.0099999998 * 0.1" },1 },{ "Velocity_slip",1,{ "0.02 * 0.1","0 * 0.1" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.1","0.0099999998 * 0.1" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.1","0.01732 * 0.1" },1 },{ "Velocity_slip",1,{ "0 * 0.1","0.02 * 0.1" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.1","0.01732 * 0.1" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.1","0.0099999998 * 0.1" },1 },{ "Velocity_slip",1,{ "-0.02 * 0.1","0 * 0.1" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.1","-0.0099999998 * 0.1" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.1","-0.01732 * 0.1" },1 },{ "Velocity_slip",1,{ "0 * 0.1","-0.02 * 0.1" },1 }}; + }; + }; + class Centerline + { + type = "line"; + width = 5; + points[] = {{ { 0.5,0.48 },1 },{ { 0.5,0.45 },1 },{ },{ { 0.5,0.52 },1 },{ { 0.5,0.55 },1 },{ },{ { 0.48,0.5 },1 },{ { 0.45,0.5 },1 },{ },{ { 0.52,0.5 },1 },{ { 0.55,0.5 },1 },{ }}; + }; + class WeaponName + { + type = "text"; + source = "weapon"; + sourceScale = 1; + align = "right"; + scale = 1; + pos[] = {{ 0.61,0.86 },1}; + right[] = {{ 0.65,0.86 },1}; + down[] = {{ 0.61,0.9 },1}; + }; + class Ammo_GUN + { + type = "group"; + condition = "mgun"; + class Ammo_count_GUN + { + type = "text"; + source = "ammo"; + sourceScale = 1; + align = "right"; + scale = 1; + pos[] = {{ 0.61,0.89 },1}; + right[] = {{ 0.65,0.89 },1}; + down[] = {{ 0.61,0.93 },1}; + }; + }; + class Ammo_RKT + { + type = "group"; + condition = "rocket"; + class Ammo_count_RKT + { + type = "text"; + source = "ammo"; + sourceScale = 1; + align = "right"; + scale = 1; + pos[] = {{ 0.61,0.89 },1}; + right[] = {{ 0.65,0.89 },1}; + down[] = {{ 0.61,0.93 },1}; + }; + }; + class Ammo_AGM + { + type = "group"; + condition = "AAmissile"; + class Ammo_count_AGM + { + type = "text"; + source = "ammo"; + sourceScale = 1; + align = "right"; + scale = 1; + pos[] = {{ 0.61,0.89 },1}; + right[] = {{ 0.65,0.89 },1}; + down[] = {{ 0.61,0.93 },1}; + }; + }; + class Ammo_AAM + { + type = "group"; + condition = "ATmissile"; + class Ammo_count_AAM + { + type = "text"; + source = "ammo"; + sourceScale = 1; + align = "right"; + scale = 1; + pos[] = {{ 0.61,0.89 },1}; + right[] = {{ 0.65,0.89 },1}; + down[] = {{ 0.61,0.93 },1}; + }; + }; + class Ammo_Bomb + { + type = "group"; + condition = "Bomb"; + class Ammo_count_Bomb + { + type = "text"; + source = "ammo"; + sourceScale = 1; + align = "right"; + scale = 1; + pos[] = {{ 0.61,0.89 },1}; + right[] = {{ 0.65,0.89 },1}; + down[] = {{ 0.61,0.93 },1}; + }; + }; + class LightsGroup + { + type = "group"; + condition = "lights"; + class LightsText + { + type = "text"; + source = "static"; + text = "LIGHTS"; + align = "right"; + scale = 1; + pos[] = {{ 0.03,"0.53 + 0.055" },1}; + right[] = {{ 0.07,"0.53 + 0.055" },1}; + down[] = {{ 0.03,"0.53 + 0.095" },1}; + }; + }; + class CollisionLightsGroup + { + type = "group"; + condition = "collisionlights"; + class CollisionLightsText + { + type = "text"; + source = "static"; + text = "A-COL"; + align = "right"; + scale = 1; + pos[] = {{ 0.03,"0.53 + 0.105" },1}; + right[] = {{ 0.07,"0.53 + 0.105" },1}; + down[] = {{ 0.03,"0.53 + 0.145" },1}; + }; + }; + class GearGroup + { + type = "group"; + condition = "ils"; + class GearText + { + type = "text"; + source = "static"; + text = "GEAR"; + align = "right"; + scale = 1; + pos[] = {{ 0.03,"0.53 + 0.155" },1}; + right[] = {{ 0.07,"0.53 + 0.155" },1}; + down[] = {{ 0.03,"0.53 + 0.195" },1}; + }; + }; + class ATMissileTOFGroup + { + condition = "ATmissile"; + type = "group"; + class TOFtext + { + type = "text"; + align = "right"; + source = "static"; + text = "TOF="; + scale = 1; + pos[] = {{ 0.61,0.92 },1}; + right[] = {{ 0.65,0.92 },1}; + down[] = {{ 0.61,0.96 },1}; + }; + class TOFnumber + { + type = "text"; + source = "targetDist"; + sourcescale = 0.0025; + align = "right"; + scale = 1; + pos[] = {{ 0.69,0.92 },1}; + right[] = {{ 0.73,0.92 },1}; + down[] = {{ 0.69,0.96 },1}; + }; + }; + class LaserTOFGroup + { + condition = "Bomb"; + type = "group"; + class TOFtext + { + type = "text"; + align = "right"; + source = "static"; + text = "TOF="; + scale = 1; + pos[] = {{ 0.61,0.92 },1}; + right[] = {{ 0.65,0.92 },1}; + down[] = {{ 0.61,0.96 },1}; + }; + class TOFnumber + { + type = "text"; + source = "targetDist"; + sourcescale = 0.0025; + align = "right"; + scale = 1; + pos[] = {{ 0.69,0.92 },1}; + right[] = {{ 0.73,0.92 },1}; + down[] = {{ 0.69,0.96 },1}; + }; + }; + class RocketTOFGroup + { + condition = "Rocket"; + type = "group"; + class TOFtext + { + type = "text"; + align = "right"; + source = "static"; + text = "TOF="; + scale = 1; + pos[] = {{ 0.61,0.92 },1}; + right[] = {{ 0.65,0.92 },1}; + down[] = {{ 0.61,0.96 },1}; + }; + class TOFnumber + { + type = "text"; + source = "targetDist"; + sourcescale = 0.0025; + align = "right"; + scale = 1; + pos[] = {{ 0.69,0.92 },1}; + right[] = {{ 0.73,0.92 },1}; + down[] = {{ 0.69,0.96 },1}; + }; + }; + class RangeNumber + { + type = "text"; + source = "targetDist"; + sourceScale = 1; + align = "left"; + scale = 1; + pos[] = {{ 0.39,0.89 },1}; + right[] = {{ 0.43,0.89 },1}; + down[] = {{ 0.39,0.93 },1}; + }; + class RangeText + { + type = "text"; + source = "static"; + text = "RNG"; + align = "left"; + scale = 1; + pos[] = {{ 0.39,0.86 },1}; + right[] = {{ 0.43,0.86 },1}; + down[] = {{ 0.39,0.9 },1}; + }; + class SpeedNumber + { + type = "text"; + align = "right"; + scale = 1; + source = "speed"; + sourceScale = 3.6; + pos[] = {{ 0.03,0.475 },1}; + right[] = {{ 0.08,0.475 },1}; + down[] = {{ 0.03,0.525 },1}; + }; + class TorqueNumber + { + condition = "simulRTD"; + class Torque_number + { + type = "text"; + align = "left"; + scale = 1; + source = "rtdRotorTorque"; + sourceScale = 290; + pos[] = {{ 0.065,0.175 },1}; + right[] = {{ 0.115,0.175 },1}; + down[] = {{ 0.065,0.225 },1}; + }; + class Torquetext + { + type = "text"; + source = "static"; + text = "%"; + align = "right"; + scale = 1; + pos[] = {{ 0.07,0.175 },1}; + right[] = {{ 0.12,0.175 },1}; + down[] = {{ 0.07,0.225 },1}; + }; + }; + class AltNumber: SpeedNumber + { + align = "right"; + source = "altitudeAGL"; + sourceScale = 1; + pos[] = {{ 0.83,0.475 },1}; + right[] = {{ 0.88,0.475 },1}; + down[] = {{ 0.83,0.525 },1}; + }; + class ASLNumber + { + type = "text"; + source = "altitudeASL"; + sourceScale = 1; + align = "right"; + scale = 1; + pos[] = {{ 0.835,0.18 },1}; + right[] = {{ 0.875,0.18 },1}; + down[] = {{ 0.835,0.22 },1}; + }; + class VspeedScalePosta + { + type = "line"; + width = 5; + points[] = {{ { 0.98,0.2 },1 },{ { 1,0.2 },1 },{ },{ { 0.93,0.2 },1 },{ { 0.95,0.2 },1 },{ },{ { 0.98,0.35 },1 },{ { 1,0.35 },1 },{ },{ { 0.93,0.35 },1 },{ { 0.95,0.35 },1 },{ },{ { 0.94,0.38 },1 },{ { 0.95,0.38 },1 },{ },{ { 0.94,0.41 },1 },{ { 0.95,0.41 },1 },{ },{ { 0.94,0.44 },1 },{ { 0.95,0.44 },1 },{ },{ { 0.94,0.47 },1 },{ { 0.95,0.47 },1 },{ },{ { 0.98,0.5 },1 },{ { 1,0.5 },1 },{ },{ { 0.93,0.5 },1 },{ { 0.95,0.5 },1 },{ },{ { 0.94,0.53 },1 },{ { 0.95,0.53 },1 },{ },{ { 0.94,0.56 },1 },{ { 0.95,0.56 },1 },{ },{ { 0.94,0.59 },1 },{ { 0.95,0.59 },1 },{ },{ { 0.94,0.62 },1 },{ { 0.95,0.62 },1 },{ },{ { 0.98,0.65 },1 },{ { 1,0.65 },1 },{ },{ { 0.93,0.65 },1 },{ { 0.95,0.65 },1 },{ },{ { 0.99,0.68 },1 },{ { 0.98,0.68 },1 },{ },{ { 0.99,0.71 },1 },{ { 0.98,0.71 },1 },{ },{ { 0.99,0.74 },1 },{ { 0.98,0.74 },1 },{ },{ { 0.99,0.77 },1 },{ { 0.98,0.77 },1 },{ },{ { 0.98,0.8 },1 },{ { 1,0.8 },1 },{ },{ { 0.93,0.8 },1 },{ { 0.95,0.8 },1 },{ }}; + }; + class RadarAltitudeBand + { + clipTL[] = {0,0.2}; + clipBR[] = {1,0.8}; + hideValue = 201; + class radarbanda + { + type = "line"; + width = 17; + points[] = {{ "RadarAltitudeBone",{ 0,0 },1 },{ "RadarAltitudeBone",{ 0,0.6 },1 }}; + }; + }; + class VspeedBand + { + type = "line"; + width = 3; + points[] = {{ "VspeedBone",{ -0.01,0 },1 },{ "VspeedBone",{ -0.025,-0.015 },1 },{ "VspeedBone",{ -0.025,0.015 },1 },{ "VspeedBone",{ -0.01,0 },1 },{ }}; + }; + class HeadingNumber: SpeedNumber + { + source = "heading"; + sourceScale = 1; + align = "center"; + pos[] = {{ 0.5,0.045 },1}; + right[] = {{ 0.56,0.045 },1}; + down[] = {{ 0.5,"0.045 + 0.06" },1}; + }; + class Center_box + { + type = "line"; + width = 1.5; + points[] = {{ { 0.45,"0.02 + 0.085 - 0.06" },1 },{ { "0.45 + 0.10","0.02 + 0.085 - 0.06" },1 },{ { "0.45 + 0.10","0.02 + 0.085" },1 },{ { 0.45,"0.02 + 0.085" },1 },{ { 0.45,"0.02 + 0.085 - 0.06" },1 }}; + }; + class HeadingArrow + { + type = "line"; + width = 7; + points[] = {{ { "0.5","0.128 + 0.03" },1 },{ { 0.5,0.128 },1 }}; + }; + class HeadingScale_LEFT + { + clipTL[] = {0,0}; + clipBR[] = {0.45,1}; + class Heading_group + { + type = "scale"; + horizontal = 1; + source = "heading"; + sourceScale = 1; + width = 5; + top = 0.12; + center = 0.5; + bottom = 0.88; + lineXleft = "0.03 + 0.085"; + lineYright = "0.02 + 0.085"; + lineXleftMajor = "0.04 + 0.085"; + lineYrightMajor = "0.02 + 0.085"; + majorLineEach = 3; + numberEach = 3; + step = 10; + stepSize = "0.05"; + align = "center"; + scale = 1; + pos[] = {0.12,"0.0 + 0.065"}; + right[] = {0.16,"0.0 + 0.065"}; + down[] = {0.12,"0.04 + 0.065"}; + }; + }; + class HeadingScale_RIGHT + { + clipTL[] = {0.55,0}; + clipBR[] = {1,1}; + class Heading_group + { + type = "scale"; + horizontal = 1; + source = "heading"; + sourceScale = 1; + width = 5; + top = 0.12; + center = 0.5; + bottom = 0.88; + lineXleft = "0.03 + 0.085"; + lineYright = "0.02 + 0.085"; + lineXleftMajor = "0.04 + 0.085"; + lineYrightMajor = "0.02 + 0.085"; + majorLineEach = 3; + numberEach = 3; + step = 10; + stepSize = "0.05"; + align = "center"; + scale = 1; + pos[] = {0.12,"0.0 + 0.065"}; + right[] = {0.16,"0.0 + 0.065"}; + down[] = {0.12,"0.04 + 0.065"}; + }; + }; + class HeadingScale_BOTTOM + { + clipTL[] = {0.45,"0.02 + 0.085"}; + clipBR[] = {"0.45 + 0.10",1}; + class Heading_group + { + type = "scale"; + horizontal = 1; + source = "heading"; + sourceScale = 1; + width = 5; + top = 0.12; + center = 0.5; + bottom = 0.88; + lineXleft = "0.03 + 0.085"; + lineYright = "0.02 + 0.085"; + lineXleftMajor = "0.04 + 0.085"; + lineYrightMajor = "0.02 + 0.085"; + majorLineEach = 3; + numberEach = 3; + step = 10; + stepSize = "0.05"; + align = "center"; + scale = 1; + pos[] = {0.12,"0.0 + 0.065"}; + right[] = {0.16,"0.0 + 0.065"}; + down[] = {0.12,"0.04 + 0.065"}; + }; + }; + class Fuel_Text + { + type = "text"; + source = "static"; + text = "Fuel"; + align = "right"; + scale = 1; + pos[] = {{ 0.03,0.9 },1}; + right[] = {{ 0.07,0.9 },1}; + down[] = {{ 0.03,0.94 },1}; + }; + class Fuel_Number + { + type = "text"; + source = "fuel"; + sourceScale = 100; + align = "right"; + scale = 1; + pos[] = {{ 0.1,0.9 },1}; + right[] = {{ 0.14,0.9 },1}; + down[] = {{ 0.1,0.94 },1}; + }; + }; + helmetMountedDisplay = 1; + helmetPosition[] = {-0.04,0.04,0.1}; + helmetRight[] = {0.08,0,0}; + helmetDown[] = {0,-0.08,0}; + }; + class ACE_HUD_2 + { + topLeft = "HUD_top_left"; + topRight = "HUD_top_right"; + bottomLeft = "HUD_bottom_left"; + borderLeft = 0; + borderRight = 0; + borderTop = 0; + borderBottom = 0; + color[] = {0.15,1,0.15,1}; + enableParallax = 0; + class Bones + { + class Velocity + { + type = "vector"; + source = "velocity"; + pos0[] = {0.5,0.5}; + pos10[] = {0.75,0.75}; + }; + class ForwardVec1 + { + type = "vector"; + source = "forward"; + pos0[] = {0,0}; + pos10[] = {0.25,0.25}; + }; + class ForwardVec + { + type = "vector"; + source = "forward"; + pos0[] = {0,0}; + pos10[] = {0.253,0.253}; + }; + class WeaponAim + { + type = "vector"; + source = "weapon"; + pos0[] = {0.5,0.5}; + pos10[] = {0.753,0.753}; + }; + class WeaponAim1 + { + type = "vector"; + source = "weapon"; + pos0[] = {0,0}; + pos10[] = {0.253,0.23}; + }; + class Target + { + type = "vector"; + source = "target"; + pos0[] = {0.5,0.5}; + pos10[] = {0.753,0.753}; + }; + class RadarContact + { + type = "fixed"; + pos[] = {0,0}; + }; + }; + class Draw + { + color[] = {0.18,1,0.18}; + alpha = 1; + condition = "on"; + class PlaneMovementCrosshair + { + type = "line"; + width = 7; + points[] = {{ "ForwardVec1",1,"Velocity",1,{ 0,-0.02 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0.01,-0.01732 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0.01732,-0.01 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0.02,0 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0.01732,0.01 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0.01,0.01732 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0,0.02 },1 },{ "ForwardVec1",1,"Velocity",1,{ -0.01,0.01732 },1 },{ "ForwardVec1",1,"Velocity",1,{ -0.01732,0.01 },1 },{ "ForwardVec1",1,"Velocity",1,{ -0.02,0 },1 },{ "ForwardVec1",1,"Velocity",1,{ -0.01732,-0.01 },1 },{ "ForwardVec1",1,"Velocity",1,{ -0.01,-0.01732 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0,-0.02 },1 },{ },{ "ForwardVec1",1,"Velocity",1,{ 0.04,0 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0.02,0 },1 },{ },{ "ForwardVec1",1,"Velocity",1,{ -0.04,0 },1 },{ "ForwardVec1",1,"Velocity",1,{ -0.02,0 },1 },{ },{ "ForwardVec1",1,"Velocity",1,{ 0,-0.04 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0,-0.02 },1 }}; + }; + class Gunner_AIM + { + type = "group"; + class Circle + { + type = "line"; + width = 6; + points[] = {{ "ForwardVec",1,"WeaponAim",1,{ 0,-0.015 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0,-0.03 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0,-0.0325 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0,-0.0475 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0,0.015 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0,0.03 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0,0.0325 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0,0.0475 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ -0.015,0 },1 },{ "ForwardVec",1,"WeaponAim",1,{ -0.03,0 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ -0.0325,0 },1 },{ "ForwardVec",1,"WeaponAim",1,{ -0.0475,0 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0.015,0 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0.03,0 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0.0325,0 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0.0475,0 },1 }}; + }; + }; + class GunCross + { + condition = "mgun"; + class Circle + { + type = "line"; + width = 9; + points[] = {{ "ForwardVec",1,"WeaponAim",1,{ 0,-0.05 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0,-0.015 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0,0.015 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0,0.05 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ -0.05,0 },1 },{ "ForwardVec",1,"WeaponAim",1,{ -0.015,0 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0.015,0 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0.05,0 },1 },{ }}; + }; + }; + class RocketCross + { + condition = "rocket"; + width = 6; + class Circle + { + type = "line"; + width = 6; + points[] = {{ "ForwardVec",1,"WeaponAim",1,{ -0.05,-0.08 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0.05,-0.08 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0,-0.08 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0,0.08 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ -0.05,0.08 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0.05,0.08 },1 },{ }}; + }; + }; + class AT_Aim + { + condition = "ATmissile"; + width = 2; + class Circle + { + type = "line"; + width = 2; + points[] = {{ "ForwardVec",1,"WeaponAim",1,{ -0.1,-0.1 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0.1,-0.1 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0.1,0.1 },1 },{ "ForwardVec",1,"WeaponAim",1,{ -0.1,0.1 },1 },{ "ForwardVec",1,"WeaponAim",1,{ -0.1,-0.1 },1 }}; + }; + }; + class AA_aim + { + condition = "AAmissile"; + class Circle + { + type = "line"; + width = 2.5; + points[] = {{ "ForwardVec",1,"WeaponAim",1,{ "0 / 4","-0.248559 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0434 / 4","-0.244781 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0855 / 4","-0.233571 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.125 / 4","-0.215252 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1607 / 4","-0.190396 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1915 / 4","-0.159774 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2165 / 4","-0.12428 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.234925 / 4","-0.0850072 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2462 / 4","-0.0431499 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.25 / 4","0 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2462 / 4","0.0431499 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.234925 / 4","0.0850072 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2165 / 4","0.12428 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1915 / 4","0.159774 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1607 / 4","0.190396 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.125 / 4","0.215252 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0855 / 4","0.233571 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0434 / 4","0.244781 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0 / 4","0.248559 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0434 / 4","0.244781 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0855 / 4","0.233571 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.125 / 4","0.215252 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1607 / 4","0.190396 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1915 / 4","0.159774 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2165 / 4","0.12428 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.234925 / 4","0.0850072 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2462 / 4","0.0431499 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.25 / 4","0 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2462 / 4","-0.0431499 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.234925 / 4","-0.0850072 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2165 / 4","-0.12428 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1915 / 4","-0.159774 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1607 / 4","-0.190396 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.125 / 4","-0.215252 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0855 / 4","-0.233571 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0434 / 4","-0.244781 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0 / 4","-0.248559 / 4" },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ "0 / 2","-0.248559 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0434 / 2","-0.244781 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0855 / 2","-0.233571 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.125 / 2","-0.215252 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1607 / 2","-0.190396 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1915 / 2","-0.159774 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2165 / 2","-0.12428 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.234925 / 2","-0.0850072 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2462 / 2","-0.0431499 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.25 / 2","0 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2462 / 2","0.0431499 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.234925 / 2","0.0850072 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2165 / 2","0.12428 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1915 / 2","0.159774 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1607 / 2","0.190396 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.125 / 2","0.215252 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0855 / 2","0.233571 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0434 / 2","0.244781 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0 / 2","0.248559 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0434 / 2","0.244781 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0855 / 2","0.233571 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.125 / 2","0.215252 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1607 / 2","0.190396 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1915 / 2","0.159774 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2165 / 2","0.12428 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.234925 / 2","0.0850072 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2462 / 2","0.0431499 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.25 / 2","0 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2462 / 2","-0.0431499 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.234925 / 2","-0.0850072 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2165 / 2","-0.12428 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1915 / 2","-0.159774 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1607 / 2","-0.190396 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.125 / 2","-0.215252 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0855 / 2","-0.233571 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0434 / 2","-0.244781 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0 / 2","-0.248559 / 2" },1 }}; + }; + }; + class TargetACQ + { + type = "line"; + width = 2; + points[] = {{ "ForwardVec",1,"target",{ 0,-0.06 },1 },{ "ForwardVec",1,"target",{ 0,-0.055 },1 },{ },{ "ForwardVec",1,"target",{ 0,-0.05 },1 },{ "ForwardVec",1,"target",{ 0,-0.045 },1 },{ },{ "ForwardVec",1,"target",{ 0,-0.04 },1 },{ "ForwardVec",1,"target",{ 0,-0.035 },1 },{ },{ "ForwardVec",1,"target",{ 0,-0.03 },1 },{ "ForwardVec",1,"target",{ 0,-0.025 },1 },{ },{ "ForwardVec",1,"target",{ 0,-0.02 },1 },{ "ForwardVec",1,"target",{ 0,-0.015 },1 },{ },{ "ForwardVec",1,"target",{ 0,-0.01 },1 },{ "ForwardVec",1,"target",{ 0,-0.005 },1 },{ },{ "ForwardVec",1,"target",{ 0,0 },1 },{ "ForwardVec",1,"target",{ 0,0 },1 },{ },{ "ForwardVec",1,"target",{ 0,0.06 },1 },{ "ForwardVec",1,"target",{ 0,0.055 },1 },{ },{ "ForwardVec",1,"target",{ 0,0.05 },1 },{ "ForwardVec",1,"target",{ 0,0.045 },1 },{ },{ "ForwardVec",1,"target",{ 0,0.04 },1 },{ "ForwardVec",1,"target",{ 0,0.035 },1 },{ },{ "ForwardVec",1,"target",{ 0,0.03 },1 },{ "ForwardVec",1,"target",{ 0,0.025 },1 },{ },{ "ForwardVec",1,"target",{ 0,0.02 },1 },{ "ForwardVec",1,"target",{ 0,0.015 },1 },{ },{ "ForwardVec",1,"target",{ 0,0.01 },1 },{ "ForwardVec",1,"target",{ 0,0.005 },1 },{ },{ "ForwardVec",1,"target",{ -0.06,0 },1 },{ "ForwardVec",1,"target",{ -0.055,0 },1 },{ },{ "ForwardVec",1,"target",{ -0.05,0 },1 },{ "ForwardVec",1,"target",{ -0.045,0 },1 },{ },{ "ForwardVec",1,"target",{ -0.04,0 },1 },{ "ForwardVec",1,"target",{ -0.035,0 },1 },{ },{ "ForwardVec",1,"target",{ -0.03,0 },1 },{ "ForwardVec",1,"target",{ -0.025,0 },1 },{ },{ "ForwardVec",1,"target",{ -0.02,0 },1 },{ "ForwardVec",1,"target",{ -0.015,0 },1 },{ },{ "ForwardVec",1,"target",{ -0.01,0 },1 },{ "ForwardVec",1,"target",{ -0.005,0 },1 },{ },{ "ForwardVec",1,"target",{ 0.06,0 },1 },{ "ForwardVec",1,"target",{ 0.055,0 },1 },{ },{ "ForwardVec",1,"target",{ 0.05,0 },1 },{ "ForwardVec",1,"target",{ 0.045,0 },1 },{ },{ "ForwardVec",1,"target",{ 0.04,0 },1 },{ "ForwardVec",1,"target",{ 0.035,0 },1 },{ },{ "ForwardVec",1,"target",{ 0.03,0 },1 },{ "ForwardVec",1,"target",{ 0.025,0 },1 },{ },{ "ForwardVec",1,"target",{ 0.02,0 },1 },{ "ForwardVec",1,"target",{ 0.015,0 },1 },{ },{ "ForwardVec",1,"target",{ 0.01,0 },1 },{ "ForwardVec",1,"target",{ 0.005,0 },1 },{ }}; + }; + class RadarTargets + { + type = "radar"; + pos0[] = {0.5,0.5}; + pos10[] = {0.753,0.753}; + width = 2.5; + points[] = {{ "ForwardVec",1,"RadarContact",{ -0.01,-0.01 },1 },{ "ForwardVec",1,"RadarContact",{ 0.01,-0.01 },1 },{ "ForwardVec",1,"RadarContact",{ 0.01,0.01 },1 },{ "ForwardVec",1,"RadarContact",{ -0.01,0.01 },1 },{ "ForwardVec",1,"RadarContact",{ -0.01,-0.01 },1 }}; + }; + }; + helmetMountedDisplay = 1; + helmetPosition[] = {-0.035,0.035,0.1}; + helmetRight[] = {0.07,0,0}; + helmetDown[] = {0,-0.07,0}; + }; + }; + + class Turrets: Turrets { + class MainTurret: MainTurret { + directionStabilized = 1; + horizontallyStabilized = 1; + + weapons[] = {"ACE_gatling_20mm_Comanche","missiles_DAGR","missiles_ASRAAM", "ACE_AIR_SAFETY"}; + magazines[] = {"ACE_500Rnd_20mm_shells_Comanche","4Rnd_AAA_missiles","24Rnd_PG_missiles"}; + + isCopilot = 1; + showHMD = 1; + CanEject = 1; + startEngine = 0; + minElev = -51; + maxElev = 9; + initElev = 6; + minTurn = -120; + maxTurn = 120; + initTurn = 0; + + class OpticsIn + { + class WideNGS + { + opticsDisplayName = "W"; + initAngleX = 0; + minAngleX = -35; + maxAngleX = 10; + initAngleY = 0; + minAngleY = -100; + maxAngleY = 100; + initFov = 0.466; + minFov = 0.466; + maxFov = 0.466; + visionMode[] = {"Normal","Ti"}; + thermalMode[] = {0,1}; + gunnerOpticsColor[] = {0.15,1,0.15,1}; + gunnerOpticsModel = "A3\Weapons_F\Reticle\Optics_Gunner_MBT_03_w_F.p3d"; + directionStabilized = 0; + opticsPPEffects[] = {"OpticsCHAbera2","OpticsBlur2"}; + }; + class Wide + { + opticsDisplayName = "W"; + initAngleX = 0; + minAngleX = -35; + maxAngleX = 10; + initAngleY = 0; + minAngleY = -100; + maxAngleY = 100; + initFov = 0.466; + minFov = 0.466; + maxFov = 0.466; + visionMode[] = {"Normal","Ti"}; + thermalMode[] = {0,1}; + gunnerOpticsColor[] = {0.15,1,0.15,1}; + gunnerOpticsModel = "A3\Weapons_F\Reticle\Optics_Gunner_MBT_02_w_F.p3d"; + directionStabilized = 1; + opticsPPEffects[] = {"OpticsCHAbera2","OpticsBlur2"}; + gunnerOpticsEffect[] = {"TankCommanderOptics1"}; + }; + class WideL: Wide + { + opticsDisplayName = "WL"; + initFov = 0.2; + minFov = 0.2; + maxFov = 0.2; + gunnerOpticsModel = "A3\Weapons_F\Reticle\Optics_Gunner_MBT_02_m_F.p3d"; + gunnerOpticsColor[] = {0,0,0,1}; + directionStabilized = 1; + opticsPPEffects[] = {"OpticsCHAbera2","OpticsBlur2"}; + }; + class Medium: Wide + { + opticsDisplayName = "M"; + initFov = 0.1; + minFov = 0.1; + maxFov = 0.1; + directionStabilized = 1; + gunnerOpticsColor[] = {0,0,0,1}; + gunnerOpticsModel = "A3\Weapons_F\Reticle\Optics_Gunner_MBT_02_m_F.p3d"; + }; + class Narrow: Wide + { + opticsDisplayName = "N"; + gunnerOpticsColor[] = {0,0,0,1}; + gunnerOpticsModel = "A3\Weapons_F\Reticle\Optics_Gunner_MBT_02_n_F.p3d"; + directionStabilized = 1; + initFov = 0.02; + minFov = 0.02; + maxFov = 0.02; + }; + class Narrower: Wide + { + opticsDisplayName = "N"; + gunnerOpticsColor[] = {0,0,0,1}; + gunnerOpticsModel = "A3\Weapons_F\Reticle\Optics_Gunner_MBT_02_n_F.p3d"; + directionStabilized = 1; + initFov = 0.01; + minFov = 0.01; + maxFov = 0.01; + }; + }; + class OpticsOut + { + class Monocular + { + initAngleX = 0; + minAngleX = -30; + maxAngleX = 30; + initAngleY = 0; + minAngleY = -100; + maxAngleY = 100; + initFov = 1.1; + minFov = 0.133; + maxFov = 1.1; + visionMode[] = {"Normal","NVG","Ti"}; + thermalMode[] = {2,3}; + gunnerOpticsModel = ""; + gunnerOpticsEffect[] = {}; + hideUnitInfo = 1; + }; + }; + }; + }; + + class AnimationSources: AnimationSources { + class Gatling { + weapon = "ACE_gatling_20mm_Comanche"; + }; + class Muzzle_flash { + weapon = "ACE_gatling_20mm_Comanche"; + }; + }; +}; \ No newline at end of file diff --git a/addons/aircraft/README.md b/addons/aircraft/README.md index b212d311b9..76c721bd0c 100644 --- a/addons/aircraft/README.md +++ b/addons/aircraft/README.md @@ -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) \ No newline at end of file diff --git a/addons/aircraft/RscInGameUI.hpp b/addons/aircraft/RscInGameUI.hpp new file mode 100644 index 0000000000..8255de35a6 --- /dev/null +++ b/addons/aircraft/RscInGameUI.hpp @@ -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)"; + }; + }; + }; + }; +}; \ No newline at end of file diff --git a/addons/aircraft/config.cpp b/addons/aircraft/config.cpp index 86135c4bc9..2ce2d0dc10 100644 --- a/addons/aircraft/config.cpp +++ b/addons/aircraft/config.cpp @@ -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" \ No newline at end of file diff --git a/addons/aircraft/data/Helo_LaserON.paa b/addons/aircraft/data/Helo_LaserON.paa new file mode 100644 index 0000000000..3a3459e699 Binary files /dev/null and b/addons/aircraft/data/Helo_LaserON.paa differ diff --git a/addons/attach/functions/fnc_attach.sqf b/addons/attach/functions/fnc_attach.sqf index a8b73052dc..3703514fb6 100644 --- a/addons/attach/functions/fnc_attach.sqf +++ b/addons/attach/functions/fnc_attach.sqf @@ -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; diff --git a/addons/attach/functions/fnc_canAttach.sqf b/addons/attach/functions/fnc_canAttach.sqf index 966794b32f..d0930dc069 100644 --- a/addons/attach/functions/fnc_canAttach.sqf +++ b/addons/attach/functions/fnc_canAttach.sqf @@ -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) + [""])}; diff --git a/addons/attach/functions/fnc_placeApprove.sqf b/addons/attach/functions/fnc_placeApprove.sqf index 576721cf59..60c5e3a9bf 100644 --- a/addons/attach/functions/fnc_placeApprove.sqf +++ b/addons/attach/functions/fnc_placeApprove.sqf @@ -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; { diff --git a/addons/backpacks/functions/fnc_backpackOpened.sqf b/addons/backpacks/functions/fnc_backpackOpened.sqf index 186202027f..1894d68f23 100644 --- a/addons/backpacks/functions/fnc_backpackOpened.sqf +++ b/addons/backpacks/functions/fnc_backpackOpened.sqf @@ -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 [ diff --git a/addons/ballistics/CfgAmmo.hpp b/addons/ballistics/CfgAmmo.hpp new file mode 100644 index 0000000000..79f99c33a4 --- /dev/null +++ b/addons/ballistics/CfgAmmo.hpp @@ -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; + }; +}; \ No newline at end of file diff --git a/addons/ballistics/config.cpp b/addons/ballistics/config.cpp index c526b0f7d4..4b9944364c 100644 --- a/addons/ballistics/config.cpp +++ b/addons/ballistics/config.cpp @@ -14,3 +14,4 @@ class CfgPatches { #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" +#include "CfgAmmo.hpp" \ No newline at end of file diff --git a/addons/captives/functions/fnc_handleOnUnconscious.sqf b/addons/captives/functions/fnc_handleOnUnconscious.sqf index 1924b6bb47..9aa4856204 100644 --- a/addons/captives/functions/fnc_handleOnUnconscious.sqf +++ b/addons/captives/functions/fnc_handleOnUnconscious.sqf @@ -18,9 +18,6 @@ EXPLODE_2_PVT(_this,_unit,_isUnconc); -diag_log "handleOnUnconscious"; -diag_log _this; -diag_log _unit; if (!local _unit) exitWith {}; if (_isUnconc) then { diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 345bc7873c..fe9c8a4c77 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -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); diff --git a/addons/common/functions/fnc_addToInventory.sqf b/addons/common/functions/fnc_addToInventory.sqf index 4e088525fc..b28d864df8 100644 --- a/addons/common/functions/fnc_addToInventory.sqf +++ b/addons/common/functions/fnc_addToInventory.sqf @@ -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; diff --git a/addons/common/functions/fnc_canGetInPosition.sqf b/addons/common/functions/fnc_canGetInPosition.sqf index 5ac4c527fd..f4337b6171 100644 --- a/addons/common/functions/fnc_canGetInPosition.sqf +++ b/addons/common/functions/fnc_canGetInPosition.sqf @@ -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 diff --git a/addons/common/functions/fnc_getTurretDirection.sqf b/addons/common/functions/fnc_getTurretDirection.sqf new file mode 100644 index 0000000000..fb265bf545 --- /dev/null +++ b/addons/common/functions/fnc_getTurretDirection.sqf @@ -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] \ No newline at end of file diff --git a/addons/common/functions/fnc_inWater.sqf b/addons/common/functions/fnc_inWater.sqf index ea511d388d..2fdede1737 100644 --- a/addons/common/functions/fnc_inWater.sqf +++ b/addons/common/functions/fnc_inWater.sqf @@ -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; }; diff --git a/addons/dragging/functions/fnc_carryObject.sqf b/addons/dragging/functions/fnc_carryObject.sqf index 2037dfc3f0..ee72dc9aa7 100644 --- a/addons/dragging/functions/fnc_carryObject.sqf +++ b/addons/dragging/functions/fnc_carryObject.sqf @@ -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]; diff --git a/addons/dragging/functions/fnc_dragObject.sqf b/addons/dragging/functions/fnc_dragObject.sqf index f614af9548..35f8687ed0 100644 --- a/addons/dragging/functions/fnc_dragObject.sqf +++ b/addons/dragging/functions/fnc_dragObject.sqf @@ -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]; diff --git a/addons/dragging/functions/fnc_handleScrollWheel.sqf b/addons/dragging/functions/fnc_handleScrollWheel.sqf index 0782e64db7..96f46413bc 100644 --- a/addons/dragging/functions/fnc_handleScrollWheel.sqf +++ b/addons/dragging/functions/fnc_handleScrollWheel.sqf @@ -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]; diff --git a/addons/explosives/functions/fnc_dialingPhone.sqf b/addons/explosives/functions/fnc_dialingPhone.sqf index d3c429c9fc..fa992a9cac 100644 --- a/addons/explosives/functions/fnc_dialingPhone.sqf +++ b/addons/explosives/functions/fnc_dialingPhone.sqf @@ -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)]]; diff --git a/addons/explosives/functions/fnc_placeExplosive.sqf b/addons/explosives/functions/fnc_placeExplosive.sqf index 1e1ac44bdf..ce43698309 100644 --- a/addons/explosives/functions/fnc_placeExplosive.sqf +++ b/addons/explosives/functions/fnc_placeExplosive.sqf @@ -15,7 +15,7 @@ * Placed explosive * * 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 diff --git a/addons/fcs/XEH_clientInit.sqf b/addons/fcs/XEH_clientInit.sqf index 17faa70f17..094a49faeb 100644 --- a/addons/fcs/XEH_clientInit.sqf +++ b/addons/fcs/XEH_clientInit.sqf @@ -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; \ No newline at end of file diff --git a/addons/fcs/XEH_preInit.sqf b/addons/fcs/XEH_preInit.sqf index 78a2fd091c..8fdc43df11 100644 --- a/addons/fcs/XEH_preInit.sqf +++ b/addons/fcs/XEH_preInit.sqf @@ -10,6 +10,7 @@ PREP(firedEH); PREP(getAngle); PREP(getRange); PREP(handleAirBurstAmmunitionPFH); +PREP(onForceUpdate); PREP(keyDown); PREP(keyUp); PREP(reset); diff --git a/addons/fcs/functions/fnc_keyUp.sqf b/addons/fcs/functions/fnc_keyUp.sqf index d33bd08893..f0b1f1b137 100644 --- a/addons/fcs/functions/fnc_keyUp.sqf +++ b/addons/fcs/functions/fnc_keyUp.sqf @@ -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); +}; \ No newline at end of file diff --git a/addons/fcs/functions/fnc_onForceUpdate.sqf b/addons/fcs/functions/fnc_onForceUpdate.sqf new file mode 100644 index 0000000000..c911fc38de --- /dev/null +++ b/addons/fcs/functions/fnc_onForceUpdate.sqf @@ -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); \ No newline at end of file diff --git a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf index 077a9239f0..9a20962a8f 100644 --- a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf @@ -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 { diff --git a/addons/laser/CfgEventhandlers.hpp b/addons/laser/CfgEventhandlers.hpp index 1fcfc0244f..bad89fd048 100644 --- a/addons/laser/CfgEventhandlers.hpp +++ b/addons/laser/CfgEventhandlers.hpp @@ -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)); + }; }; diff --git a/addons/laser/CfgVehicles.hpp b/addons/laser/CfgVehicles.hpp index 1c5887bd38..07b8055f0e 100644 --- a/addons/laser/CfgVehicles.hpp +++ b/addons/laser/CfgVehicles.hpp @@ -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)); + }; + }; }; \ No newline at end of file diff --git a/addons/laser/XEH_pre_init.sqf b/addons/laser/XEH_pre_init.sqf index 8a4b3166b8..8b39c429b6 100644 --- a/addons/laser/XEH_pre_init.sqf +++ b/addons/laser/XEH_pre_init.sqf @@ -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); diff --git a/addons/laser/config.cpp b/addons/laser/config.cpp index 711bd743b6..4b209b866e 100644 --- a/addons/laser/config.cpp +++ b/addons/laser/config.cpp @@ -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" diff --git a/addons/laser/functions/fnc_checkLos.sqf b/addons/laser/functions/fnc_checkLos.sqf index f0df153887..9888642a80 100644 --- a/addons/laser/functions/fnc_checkLos.sqf +++ b/addons/laser/functions/fnc_checkLos.sqf @@ -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; \ No newline at end of file diff --git a/addons/laser/functions/fnc_findLaserDesignator.sqf b/addons/laser/functions/fnc_findLaserDesignator.sqf index 8a2e4caf29..d10e221501 100644 --- a/addons/laser/functions/fnc_findLaserDesignator.sqf +++ b/addons/laser/functions/fnc_findLaserDesignator.sqf @@ -1,70 +1,70 @@ #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}; _vector = if (count _this > 3) then {_this select 3} else {vectorDir _missile}; _offset = if (count _this > 4) then {_this select 4} else {[0,0,0]}; -_headingPitch = _vector call CBA_fnc_vect2polar; +_headingPitch = _vector call CBA_fnc_vect2polar; _currentTarget = nil; _found = false; LOG("Searching lasers"); if(!(isNil "ACE_LASERS")) then { - _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); - - 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; - }; - - 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]; - }; - }; - }; - - } forEach ACE_LASERS; - - 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; + _potentialTargets = []; + TRACE_1("", ACE_LASERS); + + { + 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); + + 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); + + 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; + + 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; }; [_found, _currentTarget] \ No newline at end of file diff --git a/addons/laser/functions/fnc_findStrongestRay.sqf b/addons/laser/functions/fnc_findStrongestRay.sqf index db85ce8b3d..e4238361cb 100644 --- a/addons/laser/functions/fnc_findStrongestRay.sqf +++ b/addons/laser/functions/fnc_findStrongestRay.sqf @@ -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))); \ No newline at end of file diff --git a/addons/laser/functions/fnc_laserTargetPFH.sqf b/addons/laser/functions/fnc_laserTargetPFH.sqf index bf526f464e..bdab413685 100644 --- a/addons/laser/functions/fnc_laserTargetPFH.sqf +++ b/addons/laser/functions/fnc_laserTargetPFH.sqf @@ -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 diff --git a/addons/laser/functions/fnc_laser_init.sqf b/addons/laser/functions/fnc_laser_init.sqf index 4c6b0b5f2a..9fcb439032 100644 --- a/addons/laser/functions/fnc_laser_init.sqf +++ b/addons/laser/functions/fnc_laser_init.sqf @@ -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]; - - [FUNC(laserTargetPFH), 0, [_laserTarget, player]] call cba_fnc_addPerFrameHandler; + _laserTarget setVariable ["ACE_LASERTARGET_SHOOTER", player, true]; + + [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]; }; diff --git a/addons/laser/functions/fnc_shootCone.sqf b/addons/laser/functions/fnc_shootCone.sqf index 8d2d7fef66..e33edd10bc 100644 --- a/addons/laser/functions/fnc_shootCone.sqf +++ b/addons/laser/functions/fnc_shootCone.sqf @@ -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]; \ No newline at end of file diff --git a/addons/laser/functions/fnc_shootRay.sqf b/addons/laser/functions/fnc_shootRay.sqf index 768194e351..62847d16b6 100644 --- a/addons/laser/functions/fnc_shootRay.sqf +++ b/addons/laser/functions/fnc_shootRay.sqf @@ -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) - ]; - - if(lineIntersects [_lastPos, _nextPos] || terrainIntersectASL [_lastPos, _nextPos]) then { - _resultPos = _lastPos; - breakTo "mainSearch"; - } else { - _distance = _distance + _x; - _lastPos = _nextPos; - }; - }; + 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; + }; + }; } forEach _fidelity; [_resultPos, _distance]; \ No newline at end of file diff --git a/addons/laser/functions/fnc_translateToWeaponSpace.sqf b/addons/laser/functions/fnc_translateToWeaponSpace.sqf index 406d81b145..2c7dc5e6da 100644 --- a/addons/laser/functions/fnc_translateToWeaponSpace.sqf +++ b/addons/laser/functions/fnc_translateToWeaponSpace.sqf @@ -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; \ No newline at end of file diff --git a/addons/laser/script_component.hpp b/addons/laser/script_component.hpp index afca689204..2be1e9e14b 100644 --- a/addons/laser/script_component.hpp +++ b/addons/laser/script_component.hpp @@ -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" diff --git a/addons/laser_selfdesignate/CfgEventhandlers.hpp b/addons/laser_selfdesignate/CfgEventhandlers.hpp index ea33d05bcb..4cef7be4a3 100644 --- a/addons/laser_selfdesignate/CfgEventhandlers.hpp +++ b/addons/laser_selfdesignate/CfgEventhandlers.hpp @@ -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)); + init = QUOTE(_this call DFUNC(initDesignatorActions)); }; }; -}; - -class Extended_GetOut_EventHandlers { - class B_Heli_Attack_01_F { - class ADDON { - getOut = QUOTE(call FUNC(onGetout)); - }; - }; -}; +}; \ No newline at end of file diff --git a/addons/laser_selfdesignate/CfgVehicles.hpp b/addons/laser_selfdesignate/CfgVehicles.hpp index 5b2fdd7d28..1c30e3d1e7 100644 --- a/addons/laser_selfdesignate/CfgVehicles.hpp +++ b/addons/laser_selfdesignate/CfgVehicles.hpp @@ -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 }; }; }; diff --git a/addons/laser_selfdesignate/XEH_pre_init.sqf b/addons/laser_selfdesignate/XEH_pre_init.sqf index 4e98fce7ec..a8d4b1779d 100644 --- a/addons/laser_selfdesignate/XEH_pre_init.sqf +++ b/addons/laser_selfdesignate/XEH_pre_init.sqf @@ -1,12 +1,11 @@ #include "script_component.hpp" -PREP(onGetIn); -PREP(onGetOut); - +PREP(initDesignatorActions); PREP(laserHudDesignateOn); PREP(laserHudDesignateOff); +PREP(unitTurretHasDesignator); GVAR(laser) = nil; -GVAR(laserActive) = false; +GVAR(laserActive) = false; -FUNC(getPosASL) = {visiblePositionASL (_this select 0)}; \ No newline at end of file +FUNC(getPosASL) = {visiblePositionASL (_this select 0)}; diff --git a/addons/laser_selfdesignate/config.cpp b/addons/laser_selfdesignate/config.cpp index e19e438da0..ff9c269989 100644 --- a/addons/laser_selfdesignate/config.cpp +++ b/addons/laser_selfdesignate/config.cpp @@ -5,7 +5,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_main", "ace_laser"}; + requiredAddons[] = {"ace_interaction", "ace_laser"}; version = VERSION; }; }; diff --git a/addons/laser_selfdesignate/functions/fnc_initDesignatorActions.sqf b/addons/laser_selfdesignate/functions/fnc_initDesignatorActions.sqf new file mode 100644 index 0000000000..cd45c45d32 --- /dev/null +++ b/addons/laser_selfdesignate/functions/fnc_initDesignatorActions.sqf @@ -0,0 +1,56 @@ +/* + * Author: esteldunedain + * Initializes the actions for turning on/off the laser for vehicles that have them + * + * Argument: + * 0: Vehicle + * + * 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; diff --git a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf index 088f3d9303..2f4c437d28 100644 --- a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf +++ b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf @@ -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)); diff --git a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf index bac440c853..f44fb2e2b9 100644 --- a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf +++ b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf @@ -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; - - _vehicle = vehicle _shooter; - _weapon = currentWeapon _vehicle; - - if(!alive _shooter || isNull _vehicle || isNull _laserTarget || !GVAR(laserActive) ) exitWith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; - }; - - // Retrieve the gunner and turret memory point information - _gunnerInfo = [_vehicle, _weapon] call CBA_fnc_getFirer; - - _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); + 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; + + if( (count _args) < 3) then { + _args set[2, diag_tickTime + FCS_UPDATE_DELAY]; + }; + _forceUpdateTime = _args select 2; + + _vehicle = vehicle _shooter; + _weapon = currentWeapon _vehicle; + + TRACE_1("", _args); + + if(!alive _shooter || isNull _vehicle || isNull _laserTarget || !GVAR(laserActive) ) exitWith { + [] call FUNC(laserHudDesignateOff); + }; + if(!([ACE_player] call FUNC(unitTurretHasDesignator)) ) exitWith { + [] call FUNC(laserHudDesignateOff); + }; + + // 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; + + + + _result = [_povPos, _povDir] call EFUNC(laser,shootCone); + if((count _result) > 0) then { + _resultPositions = _result select 2; - // 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; - }; - - TRACE_4("", _povDir, _povPos, _gunBeginPos, _gunEndPos); - - _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 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((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. + 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; - - _handle = [FUNC(laserHudDesignatePFH), 0, [_laserTarget, player]] call cba_fnc_addPerFrameHandler; - _laserTarget setVariable ["ACE_PFH_HANDLE", _handle, false]; - - GVAR(laser) = _laserTarget; + + _laserTarget = "LaserTargetW" createVehicle (getpos player); + + GVAR(laserActive) = true; + + _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); }; diff --git a/addons/laser_selfdesignate/functions/fnc_onGetin.sqf b/addons/laser_selfdesignate/functions/fnc_onGetin.sqf deleted file mode 100644 index d6f555c02f..0000000000 --- a/addons/laser_selfdesignate/functions/fnc_onGetin.sqf +++ /dev/null @@ -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]; \ No newline at end of file diff --git a/addons/laser_selfdesignate/functions/fnc_onGetout.sqf b/addons/laser_selfdesignate/functions/fnc_onGetout.sqf deleted file mode 100644 index 2a32403c19..0000000000 --- a/addons/laser_selfdesignate/functions/fnc_onGetout.sqf +++ /dev/null @@ -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]; \ No newline at end of file diff --git a/addons/laser_selfdesignate/functions/fnc_unitTurretHasDesignator.sqf b/addons/laser_selfdesignate/functions/fnc_unitTurretHasDesignator.sqf new file mode 100644 index 0000000000..291deb5015 --- /dev/null +++ b/addons/laser_selfdesignate/functions/fnc_unitTurretHasDesignator.sqf @@ -0,0 +1,21 @@ +/* + * Author: esteldunedain + * Checks if the turret occupied by the given unit has a laser designator + * + * Argument: + * 0: Unit + * + * Return value: + * Has designator? + */ +#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 diff --git a/addons/laser_selfdesignate/script_component.hpp b/addons/laser_selfdesignate/script_component.hpp index c9742423df..46e9c48d2f 100644 --- a/addons/laser_selfdesignate/script_component.hpp +++ b/addons/laser_selfdesignate/script_component.hpp @@ -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" diff --git a/addons/laser_selfdesignate/stringtable.xml b/addons/laser_selfdesignate/stringtable.xml new file mode 100644 index 0000000000..70f8912cfe --- /dev/null +++ b/addons/laser_selfdesignate/stringtable.xml @@ -0,0 +1,12 @@ + + + + + + Laser<br/>Designator On + + + Laser<br/>Designator Off + + + \ No newline at end of file diff --git a/addons/laserpointer/functions/fnc_drawLaserpoint.sqf b/addons/laserpointer/functions/fnc_drawLaserpoint.sqf index 969607f987..31be95099a 100644 --- a/addons/laserpointer/functions/fnc_drawLaserpoint.sqf +++ b/addons/laserpointer/functions/fnc_drawLaserpoint.sqf @@ -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; diff --git a/addons/medical/ACE_Medical_Treatments.hpp b/addons/medical/ACE_Medical_Treatments.hpp index 855653718a..bb52693e91 100644 --- a/addons/medical/ACE_Medical_Treatments.hpp +++ b/addons/medical/ACE_Medical_Treatments.hpp @@ -265,7 +265,7 @@ class ACE_Medical_Actions { condition = "((_this select 1) getvariable ['ACE_medical_inCardiacArrest', false])"; callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_CPR)); callbackFailure = ""; - callbackProgress = "((_this select 1) getvariable ['ACE_medical_inCardiacArrest', false])"; + callbackProgress = "(((_this select 0) select 1) getvariable ['ACE_medical_inCardiacArrest', false])"; animationPatient = ""; animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback"; animationCaller = "AinvPknlMstpSlayWnonDnon_medic"; diff --git a/addons/medical/ACE_Settings.hpp b/addons/medical/ACE_Settings.hpp index 51ad3533f6..915beafd6c 100644 --- a/addons/medical/ACE_Settings.hpp +++ b/addons/medical/ACE_Settings.hpp @@ -16,13 +16,12 @@ class ACE_Settings { }; class GVAR(enableOverdosing) { typeName = "BOOL"; - value = true; + value = 1; }; class GVAR(bleedingCoefficient) { typeName = "SCALAR"; value = 1; }; - class GVAR(enableAirway) { typeName = "BOOL"; value = false; @@ -37,11 +36,11 @@ class ACE_Settings { }; class GVAR(enableVehicleCrashes) { typeName = "BOOL"; - value = true; + value = 1; }; class GVAR(enableScreams) { typeName = "BOOL"; - value = true; + value = 1; }; class GVAR(playerDamageThreshold) { typeName = "SCALAR"; @@ -58,7 +57,7 @@ class ACE_Settings { }; class GVAR(preventInstaDeath) { typeName = "BOOL"; - value = false; + value = 0; }; class GVAR(maxReviveTime) { typeName = "SCALAR"; @@ -70,7 +69,7 @@ class ACE_Settings { }; class GVAR(allowDeadBodyMovement) { typeName = "BOOL"; - value = false; + value = 0; }; class GVAR(allowLitterCreation) { typeName = "BOOL"; @@ -83,17 +82,25 @@ class ACE_Settings { class GVAR(medicSetting_PAK) { typeName = "SCALAR"; value = 1; + values[] = {"Anyone", "Medics only", "Doctors only"}; }; class GVAR(medicSetting_SurgicalKit) { typeName = "SCALAR"; value = 1; + values[] = {"Anyone", "Medics only", "Doctors only"}; }; class GVAR(consumeItem_PAK) { typeName = "SCALAR"; value = 0; + values[] = {"No", "Yes"}; }; class GVAR(consumeItem_SurgicalKit) { typeName = "SCALAR"; value = 0; + values[] = {"No", "Yes"}; + }; + class GVAR(keepLocalSettingsSynced) { + typeName = "BOOL"; + value = 1; }; }; diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index 0c05532073..a1110019ae 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -128,6 +128,12 @@ class CfgVehicles { typeName = "NUMBER"; defaultValue = 1; }; + class keepLocalSettingsSynced { + displayName = "Sync status"; + description = "Keep unit status synced. Recommended on."; + typeName = "BOOL"; + defaultValue = 1; + }; }; class ModuleDescription { description = "Provides a medical system for both players and AI."; @@ -135,7 +141,7 @@ class CfgVehicles { }; }; - class ACE_moduleTreatmentConfiguration: ACE_Module { + class ACE_moduleTreatmentSettings: ACE_Module { scope = 2; displayName = "Treatment Settings [ACE]"; icon = QUOTE(PATHTOF(UI\Icon_Module_Medical_ca.paa)); diff --git a/addons/medical/CfgWeapons.hpp b/addons/medical/CfgWeapons.hpp index 670cfcb34c..6545464ea9 100644 --- a/addons/medical/CfgWeapons.hpp +++ b/addons/medical/CfgWeapons.hpp @@ -10,14 +10,12 @@ class CfgWeapons { type = 0; class ItemInfo: InventoryFirstAidKitItem_Base_F { mass = 4; - type = 201; }; }; class Medikit: ItemCore { type = 0; class ItemInfo: MedikitItem { mass = 60; - type = 201; }; }; @@ -31,11 +29,10 @@ class CfgWeapons { descriptionShort = $STR_ACE_MEDICAL_BANDAGE_BASIC_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_BANDAGE_BASIC_DESC_USE; class ItemInfo: InventoryItem_Base_F { - mass=1; - type=201; + mass = 1; }; }; - class ACE_packingBandage: ItemCore { + class ACE_packingBandage: ACE_ItemCore { scope = 2; value = 1; count = 1; @@ -46,11 +43,10 @@ class CfgWeapons { descriptionShort = $STR_ACE_MEDICAL_PACKING_BANDAGE_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_PACKING_BANDAGE_DESC_USE; class ItemInfo: InventoryItem_Base_F { - mass=1; - type=201; + mass = 1; }; }; - class ACE_elasticBandage: ItemCore { + class ACE_elasticBandage: ACE_ItemCore { scope = 2; value = 1; count = 1; @@ -61,11 +57,10 @@ class CfgWeapons { descriptionShort = $STR_ACE_MEDICAL_BANDAGE_ELASTIC_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_BANDAGE_ELASTIC_DESC_USE; class ItemInfo: InventoryItem_Base_F { - mass=1; - type=201; + mass = 1; }; }; - class ACE_tourniquet: ItemCore { + class ACE_tourniquet: ACE_ItemCore { scope = 2; value = 1; count = 1; @@ -76,11 +71,10 @@ class CfgWeapons { descriptionShort = $STR_ACE_MEDICAL_TOURNIQUET_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_TOURNIQUET_DESC_USE; class ItemInfo: InventoryItem_Base_F { - mass=1; - type=201; + mass = 1; }; }; - class ACE_morphine: ItemCore { + class ACE_morphine: ACE_ItemCore { scope = 2; value = 1; count = 1; @@ -91,11 +85,10 @@ class CfgWeapons { descriptionShort = $STR_ACE_MEDICAL_MORPHINE_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_MORPHINE_DESC_USE; class ItemInfo: InventoryItem_Base_F { - mass=1; - type=201; + mass = 1; }; }; - class ACE_atropine: ItemCore { + class ACE_atropine: ACE_ItemCore { scope = 2; value = 1; count = 1; @@ -106,11 +99,11 @@ class CfgWeapons { descriptionShort = $STR_ACE_MEDICAL_ATROPINE_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_ATROPINE_DESC_USE; class ItemInfo: InventoryItem_Base_F { - mass=1; - type=201; + mass = 1; + }; }; - class ACE_epinephrine: ItemCore { + class ACE_epinephrine: ACE_ItemCore { scope = 2; value = 1; count = 1; @@ -121,11 +114,10 @@ class CfgWeapons { descriptionShort = $STR_ACE_MEDICAL_EPINEPHRINE_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_EPINEPHRINE_DESC_USE; class ItemInfo: InventoryItem_Base_F { - mass=1; - type=201; + mass = 1; }; }; - class ACE_plasmaIV: ItemCore { + class ACE_plasmaIV: ACE_ItemCore { scope = 2; value = 1; count = 1; @@ -135,24 +127,21 @@ class CfgWeapons { descriptionUse = $STR_ACE_MEDICAL_PLASMA_IV_DESC_USE; class ItemInfo: InventoryItem_Base_F { mass = 10; - type = 201; }; }; class ACE_plasmaIV_500: ACE_plasmaIV { displayName = $STR_ACE_MEDICAL_PLASMA_IV_500; class ItemInfo: InventoryItem_Base_F { mass = 5; - type = 201; }; }; class ACE_plasmaIV_250: ACE_plasmaIV { displayName = $STR_ACE_MEDICAL_PLASMA_IV_250; class ItemInfo: InventoryItem_Base_F { mass = 2.5; - type = 201; }; }; - class ACE_bloodIV: ItemCore { + class ACE_bloodIV: ACE_ItemCore { scope = 2; value = 1; count = 1; @@ -163,24 +152,21 @@ class CfgWeapons { descriptionUse = $STR_ACE_MEDICAL_BLOOD_IV_DESC_USE; class ItemInfo: InventoryItem_Base_F { mass = 10; - type = 201; }; }; class ACE_bloodIV_500: ACE_bloodIV { displayName = $STR_ACE_MEDICAL_BLOOD_IV_500; class ItemInfo: InventoryItem_Base_F { mass = 5; - type = 201; }; }; class ACE_bloodIV_250: ACE_bloodIV { displayName = $STR_ACE_MEDICAL_BLOOD_IV_250; class ItemInfo: InventoryItem_Base_F { mass = 2.5; - type = 201; }; }; - class ACE_salineIV: ItemCore { + class ACE_salineIV: ACE_ItemCore { scope = 2; value = 1; count = 1; @@ -190,24 +176,21 @@ class CfgWeapons { descriptionUse = $STR_ACE_MEDICAL_SALINE_IV_DESC_USE; class ItemInfo: InventoryItem_Base_F { mass = 10; - type = 201; }; }; class ACE_salineIV_500: ACE_salineIV { displayName = $STR_ACE_MEDICAL_SALINE_IV_500; class ItemInfo: InventoryItem_Base_F { mass = 2.5; - type = 201; }; }; class ACE_salineIV_250: ACE_salineIV { displayName = $STR_ACE_MEDICAL_SALINE_IV_250; class ItemInfo: InventoryItem_Base_F { mass = 2.5; - type = 201; }; }; - class ACE_quikclot: ItemCore { + class ACE_quikclot: ACE_ItemCore { scope = 2; value = 1; count = 1; @@ -218,25 +201,22 @@ class CfgWeapons { descriptionUse = $STR_ACE_MEDICAL_QUIKCLOT_DESC_USE; class ItemInfo: InventoryItem_Base_F { mass = 1; - type = 201; }; }; - class ACE_personalAidKit: ItemCore { + class ACE_personalAidKit: ACE_ItemCore { scope = 2; value = 1; count = 1; type = 16; displayName = $STR_ACE_MEDICAL_AID_KIT_DISPLAY; picture = QUOTE(PATHTOF(ui\items\personal_aid_kit.paa)); - //model = QUOTE(PATHTOF(equipment\Personal-aidkits\MTP.p3d)); descriptionShort = $STR_ACE_MEDICAL_AID_KIT_DESC_SHORT; descriptionUse = $STR_ACE_MEDICAL_AID_KIT_DESC_USE; class ItemInfo: InventoryItem_Base_F { mass = 2; - type = 201; }; }; - class ACE_surgicalKit: ItemCore { + class ACE_surgicalKit: ACE_ItemCore { scope=2; displayName= $STR_ACE_MEDICAL_SURGICALKIT_DISPLAY; model = QUOTE(PATHTOF(data\surgical_kit.p3d)); @@ -245,10 +225,9 @@ class CfgWeapons { descriptionUse = $STR_ACE_MEDICAL_SURGICALKIT_DESC_USE; class ItemInfo: InventoryItem_Base_F { mass = 5; - type = 201; }; }; - class ACE_bodyBag: ItemCore { + class ACE_bodyBag: ACE_ItemCore { scope=2; displayName= $STR_ACE_MEDICAL_BODYBAG_DISPLAY; model = QUOTE(PATHTOF(data\bodybagItem.p3d)); @@ -257,7 +236,6 @@ class CfgWeapons { descriptionUse = $STR_ACE_MEDICAL_BODYBAG_DESC_USE; class ItemInfo: InventoryItem_Base_F { mass = 15; - type = 201; }; }; }; diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index c51fecc608..fc9d68fc68 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -45,6 +45,7 @@ PREP(handleDamage_wounds); PREP(handleUnitVitals); PREP(handleKilled); PREP(handleLocal); +PREP(handleBandageOpening); PREP(hasItem); PREP(hasItems); PREP(hasMedicalEnabled); diff --git a/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf b/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf index 9cd3bf1bed..d657dbe152 100644 --- a/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf +++ b/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf @@ -22,18 +22,18 @@ if !([_caller, "ACE_itemBodyBag"] call EFUNC(common,hasItem)) exitwith {}; [_caller, "ACE_itemBodyBag"] call EFUNC(common,useItem); -_nameOfUnit = [_unit] call EFUNC(common,getName); -if (alive _unit) then { +_nameOfUnit = [_target] call EFUNC(common,getName); +if (alive _target) then { // force kill the unit. - [_unit, true] call FUNC(setDead); + [_target, true] call FUNC(setDead); }; -_onPosition = getPos _unit; -deleteVehicle _unit; +_onPosition = getPos _target; +deleteVehicle _target; _bodyBagCreated = createVehicle ["ACE_bodyBag", _onPosition, [], 0, "NONE"]; // reset the position to ensure it is on the correct one. _bodyBagCreated setPos _onPosition; // TODO Does this need to be something with QUOTE(DEFUNC)? -[[_bodyBagCreated], QEFUNC(common,revealObject), true] call call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ +[[_bodyBagCreated], QUOTE(DEFUNC(common,revealObject)), true] call call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ _bodyBagCreated; diff --git a/addons/medical/functions/fnc_createLitter.sqf b/addons/medical/functions/fnc_createLitter.sqf index 8df56ad1fb..570c6d63d3 100644 --- a/addons/medical/functions/fnc_createLitter.sqf +++ b/addons/medical/functions/fnc_createLitter.sqf @@ -24,6 +24,7 @@ _className = _this select 3; _usersOfItems = _this select 5; if !(GVAR(allowLitterCreation)) exitwith {}; +if (vehicle _caller != _caller || vehicle _target != _target) exitwith {}; _config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className); if (GVAR(level) >= 2) then { diff --git a/addons/medical/functions/fnc_displayPatientInformation.sqf b/addons/medical/functions/fnc_displayPatientInformation.sqf index b155a7b1ef..b5eecbeb8d 100644 --- a/addons/medical/functions/fnc_displayPatientInformation.sqf +++ b/addons/medical/functions/fnc_displayPatientInformation.sqf @@ -61,6 +61,18 @@ if (_show) then { _genericMessages pushback [localize "STR_ACE_MEDICAL_STATUS_PAIN", [1, 1, 1, 1]]; }; + _totalIvVolume = 0; + { + private "_value"; + _value = _target getvariable _x; + if !(isnil "_value") then { + _totalIvVolume = _totalIvVolume + (_target getvariable [_x, 0]); + }; + }foreach GVAR(IVBags); + if (_totalIvVolume >= 1) then { + _genericMessages pushback [format[localize "STR_ACE_MEDICAL_receivingIvVolume", floor _totalIvVolume], [1, 1, 1, 1]]; + }; + _selectionBloodLoss = [0,0,0,0,0,0]; if (GVAR(level) >= 2) then { _openWounds = _target getvariable [QGVAR(openWounds), []]; @@ -74,24 +86,45 @@ if (_show) then { if (_amountOf > 0) then { if (_amountOf >= 1) then { // TODO localization - _allInjuryTexts pushback format["%2x %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf]; + _allInjuryTexts pushback [format["%2x %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf], [1,1,1,1]]; } else { // TODO localization - _allInjuryTexts pushback format["Partial %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6]; + _allInjuryTexts pushback [format["Partial %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6], [1,1,1,1]]; }; }; }; }foreach _openWounds; + + _bandagedwounds = _target getvariable [QGVAR(bandagedWounds), []]; + { + _amountOf = _x select 3; + // Find how much this bodypart is bleeding + //if (_selectionBloodLoss select (_x select 2) == 0) then { + // _selectionBloodLoss set [(_x select 2), (_selectionBloodLoss select (_x select 2)) + (15 * ((_x select 4) * _amountOf))]; + //}; + if (GVAR(currentSelectedSelectionN) == (_x select 2)) then { + // Collect the text to be displayed for this injury [ Select injury class type definition - select the classname DisplayName (6th), amount of injuries for this] + if (_amountOf > 0) then { + if (_amountOf >= 1) then { + // TODO localization + _allInjuryTexts pushback [format["[B] %2x %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf], [1,0.5,0.5,1]]; + } else { + // TODO localization + _allInjuryTexts pushback [format["[B] Partial %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6], [1,0.5,0.5,1]]; + }; + }; + }; + }foreach _bandagedwounds; } else { { _selectionBloodLoss set [_forEachIndex, _target getHitPointDamage _x]; if (_target getHitPointDamage _x > 0.1) then { // @todo localize - _allInjuryTexts pushBack format ["%1 %2", + _allInjuryTexts pushBack [format ["%1 %2", ["Lightly wounded", "Heavily wounded"] select (_target getHitPointDamage _x > 0.5), ["head", "torso", "left arm", "right arm", "left leg", "right leg"] select _forEachIndex - ]; + ], [1,1,1,1]]; }; } forEach ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; }; @@ -125,7 +158,8 @@ if (_show) then { _lbCtrl lbSetColor [_foreachIndex, _x select 1]; }foreach _genericMessages; { - _lbCtrl lbAdd _x; + _lbCtrl lbAdd (_x select 0); + _lbCtrl lbSetColor [_foreachIndex, _x select 1]; }foreach _allInjuryTexts; if (count _allInjuryTexts == 0) then { _lbCtrl lbAdd "No injuries on this bodypart.."; diff --git a/addons/medical/functions/fnc_displayTriageCard.sqf b/addons/medical/functions/fnc_displayTriageCard.sqf index 95e6713d9a..c6e59fead2 100644 --- a/addons/medical/functions/fnc_displayTriageCard.sqf +++ b/addons/medical/functions/fnc_displayTriageCard.sqf @@ -43,28 +43,27 @@ if (_show) then { _lbCtrl = (_display displayCtrl 200); lbClear _lbCtrl; - _log = _target getvariable ["myVariableTESTKOEAKJR", []]; + _log = _target getvariable [QGVAR(triageCard), []]; { - // [_message,_moment,_type, _arguments] - _message = _x select 0; - _moment = _x select 1; - _arguments = _x select 3; - if (isLocalized _message) then { - _message = localize _message; - }; - - { - if (typeName _x == "STRING" && {isLocalized _x}) then { - _arguments set [_foreachIndex, localize _x]; + _item = _x select 0; + _amount = _x select 1; + _message = _item; + if (isClass(configFile >> "CfgWeapons" >> _item)) then { + _message = getText(configFile >> "CfgWeapons" >> _item >> "DisplayName"); + } else { + if (isLocalized _message) then { + _message = localize _message; }; - }foreach _arguments; - _message = format([_message] + _arguments); - _lbCtrl lbAdd format["%1 %2", _moment, _message]; + }; + _triageCardTexts pushback format["%1x - %2", _amount, _message]; }foreach _log; if (count _triageCardTexts == 0) then { _lbCtrl lbAdd "No entries on this triage card.."; }; + { + _lbCtrl lbAdd _x; + }foreach _triageCardTexts; _triageStatus = [_target] call FUNC(getTriageStatus); (_display displayCtrl 2000) ctrlSetText (_triageStatus select 0); diff --git a/addons/medical/functions/fnc_getBloodLoss.sqf b/addons/medical/functions/fnc_getBloodLoss.sqf index 4f070e2546..6418d425e8 100644 --- a/addons/medical/functions/fnc_getBloodLoss.sqf +++ b/addons/medical/functions/fnc_getBloodLoss.sqf @@ -13,6 +13,8 @@ #include "script_component.hpp" +#define BLOODLOSSRATE_BASIC 0.4 + private ["_totalBloodLoss","_tourniquets","_openWounds", "_value", "_cardiacOutput", "_internalWounds"]; // TODO Only use this calculation if medium or higher, otherwise use vanilla calculations (for basic medical). _totalBloodLoss = 0; @@ -40,6 +42,6 @@ if (GVAR(level) >= 2) then { // cap the blood loss to be no greater as the current cardiac output //(_totalBloodLoss min _cardiacOutput); } else { - // TODO basic medical + _totalBloodLoss = BLOODLOSSRATE_BASIC * (damage _this); }; _totalBloodLoss * (GVAR(bleedingCoefficient) max 0); diff --git a/addons/medical/functions/fnc_getBloodVolumeChange.sqf b/addons/medical/functions/fnc_getBloodVolumeChange.sqf index b031ae4585..f94c5d5b7b 100644 --- a/addons/medical/functions/fnc_getBloodVolumeChange.sqf +++ b/addons/medical/functions/fnc_getBloodVolumeChange.sqf @@ -44,6 +44,12 @@ if (_bloodVolume < 100.0) then { _unit setvariable [_x,_ivVolume]; }; }foreach GVAR(IVBags); +} else { + { + if ((_unit getvariable [_x, 0]) > 0) then { + _unit setvariable [_x, 0]; // lets get rid of exessive IV volume + }; + }foreach GVAR(IVBags); }; _bloodVolumeChange; diff --git a/addons/medical/functions/fnc_handleBandageOpening.sqf b/addons/medical/functions/fnc_handleBandageOpening.sqf new file mode 100644 index 0000000000..eb35b3e8c5 --- /dev/null +++ b/addons/medical/functions/fnc_handleBandageOpening.sqf @@ -0,0 +1,118 @@ +/* + * Author: Glowbal + * Handles the bandage of a patient. + * + * Arguments: + * 0: The target + * 1: The impact + * 2: Selection part number + * 3: Injury index + * 4: Injury + * 5: Used Bandage type + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_target", "_impact", "_part", "_injuryIndex", "_injury", "_bandage", "_classID", "_className", "_reopeningChance", "_reopeningMinDelay", "_reopeningMaxDelay", "_config", "_woundTreatmentConfig", "_bandagedWounds", "_exist", "_injuryId", "_existingInjury", "_delay", "_openWounds", "_selectedInjury"]; +_target = _this select 0; +_impact = _this select 1; +_part = _this select 2; +_injuryIndex = _this select 3; +_injury = _this select 4; +_bandage = _this select 5; + +_classID = _injury select 1; +_className = GVAR(woundClassNames) select _classID; + +// default, just in case.. +_reopeningChance = 0.1; +_reopeningMinDelay = 120; +_reopeningMaxDelay = 200; + +// Get the default values for the used bandage +_config = (ConfigFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Bandaging"); +if (isClass (_config >> _bandage)) then { + _config = (_config >> _bandage); + _reopeningChance = getNumber (_config >> "reopeningChance"); + _reopeningMinDelay = getNumber (_config >> "reopeningMinDelay"); + _reopeningMaxDelay = getNumber (_config >> "reopeningMaxDelay") max _reopeningMinDelay; +}; + +if (isClass (_config >> _className)) then { + _woundTreatmentConfig = (_config >> _className); + if (isNumber (_woundTreatmentConfig >> "reopeningChance")) then { + _reopeningChance = getNumber (_woundTreatmentConfig >> "reopeningChance"); + }; + if (isNumber (_woundTreatmentConfig >> "reopeningMinDelay")) then { + _reopeningMinDelay = getNumber (_woundTreatmentConfig >> "reopeningMinDelay"); + }; + if (isNumber (_woundTreatmentConfig >> "reopeningMaxDelay")) then { + _reopeningMaxDelay = getNumber (_woundTreatmentConfig >> "reopeningMaxDelay") max _reopeningMinDelay; + }; +}; + +_bandagedWounds = _target getvariable [QGVAR(bandagedWounds), []]; +_exist = false; +_injuryId = _injury select 0; +{ + if ((_x select 0) == _injuryId) exitwith { + _exist = true; + _existingInjury = _x; + _existingInjury set [3, (_existingInjury select 3) + _impact]; + _bandagedWounds set [_foreachIndex, _existingInjury]; + }; +}foreach _bandagedWounds; + +if !(_exist) then { + // [ID, classID, bodypart, percentage treated, bloodloss rate] + _bandagedWounds pushback [_injuryId, _injury select 1, _injury select 2, _impact, _injury select 4]; +}; +_target setvariable [QGVAR(bandagedWounds), _bandagedWounds, true]; + +// Check if we are ever going to reopen this +if (random(1) <= _reopeningChance) then { + _delay = _reopeningMinDelay + random(_reopeningMaxDelay - _reopeningMinDelay); + [{ + private ["_target", "_impact", "_part", "_injuryIndex", "_bandage", "_injury", "_openWounds", "_selectedInjury","_bandagedWounds","_exist"]; + _target = _this select 0; + _impact = _this select 1; + _part = _this select 2; + _injuryIndex = _this select 3; + _injury = _this select 4; + + if (alive _target) then { + _openWounds = _target getvariable [QGVAR(openWounds), []]; + if ((count _openWounds)-1 < _injuryIndex) exitwith {}; + _selectedInjury = _openWounds select _injuryIndex; + if (_selectedInjury select 0 == _injury select 0) then { // matching the IDs + _selectedInjury set [3, (_selectedInjury select 3) + _impact]; + _openWounds set [_injuryIndex, _selectedInjury]; + _target setvariable [QGVAR(openWounds), _openWounds, !USE_WOUND_EVENT_SYNC]; + if (USE_WOUND_EVENT_SYNC) then { + ["medical_propagateWound", [_target, _selectedInjury]] call EFUNC(common,globalEvent); + }; + _bandagedWounds = _target getvariable [QGVAR(bandagedWounds), []]; + _exist = false; + _injuryId = _injury select 0; + { + if ((_x select 0) == _injuryId) exitwith { + _exist = true; + _existingInjury = _x; + _existingInjury set [3, ((_existingInjury select 3) - _impact) max 0]; + _bandagedWounds set [_foreachIndex, _existingInjury]; + }; + }foreach _bandagedWounds; + + if (_exist) then { + _target setvariable [QGVAR(bandagedWounds), _bandagedWounds, true]; + }; + }; + // Otherwise something went wrong, we we don't reopen them.. + }; + }, [_target, _impact, _part, _injuryIndex, _injury], _delay, 0] call EFUNC(common,waitAndExecute); +}; diff --git a/addons/medical/functions/fnc_handleUnitVitals.sqf b/addons/medical/functions/fnc_handleUnitVitals.sqf index 992ccdc3f2..fc13e19d29 100644 --- a/addons/medical/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical/functions/fnc_handleUnitVitals.sqf @@ -22,7 +22,7 @@ _unit setVariable [QGVAR(lastMomentVitalsHandled), time]; if (_interval == 0) exitWith {}; _lastTimeValuesSynced = _unit getvariable [QGVAR(lastMomentValuesSynced), 0]; -_syncValues = time - _lastTimeValuesSynced >= (10 + floor(random(10))); +_syncValues = (time - _lastTimeValuesSynced >= (10 + floor(random(10))) && GVAR(keepLocalSettingsSynced)); if (_syncValues) then { _unit setvariable [QGVAR(lastMomentValuesSynced), time]; }; @@ -167,4 +167,15 @@ if (GVAR(level) >= 2) then { [_unit] call FUNC(setCardiacArrest); }; }; + + // syncing any remaining values + if (_syncValues) then { + { + private "_value"; + _value = _unit getvariable _x; + if !(isnil "_value") then { + _unit setvariable [_x,(_unit getvariable [_x, 0]), true]; + }; + }foreach GVAR(IVBags); + }; }; diff --git a/addons/medical/functions/fnc_init.sqf b/addons/medical/functions/fnc_init.sqf index fc74711a30..ed8301b6b2 100644 --- a/addons/medical/functions/fnc_init.sqf +++ b/addons/medical/functions/fnc_init.sqf @@ -26,6 +26,7 @@ _unit setvariable [QGVAR(tourniquets), [0,0,0,0,0,0], true]; // wounds and injuries _unit setvariable [QGVAR(openWounds), [], true]; +_unit setvariable [QGVAR(bandagedWounds), [], true]; _unit setVariable [QGVAR(internalWounds), [], true]; // vitals diff --git a/addons/medical/functions/fnc_isInMedicalFacility.sqf b/addons/medical/functions/fnc_isInMedicalFacility.sqf index b1521b288b..bed660a46a 100644 --- a/addons/medical/functions/fnc_isInMedicalFacility.sqf +++ b/addons/medical/functions/fnc_isInMedicalFacility.sqf @@ -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; diff --git a/addons/medical/functions/fnc_moduleMedicalSettings.sqf b/addons/medical/functions/fnc_moduleMedicalSettings.sqf index 4fa90ae267..34dd063a4d 100644 --- a/addons/medical/functions/fnc_moduleMedicalSettings.sqf +++ b/addons/medical/functions/fnc_moduleMedicalSettings.sqf @@ -34,3 +34,4 @@ if !(_activated) exitWith {}; [_logic, QGVAR(enableUnsconsiousnessAI), "enableUnsconsiousnessAI"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(preventInstaDeath), "preventInstaDeath"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(bleedingCoefficient), "bleedingCoefficient"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(keepLocalSettingsSynced), "keepLocalSettingsSynced"] call EFUNC(common,readSettingFromModule); diff --git a/addons/medical/functions/fnc_setCardiacArrest.sqf b/addons/medical/functions/fnc_setCardiacArrest.sqf index 6ae9fe1079..cebf968898 100644 --- a/addons/medical/functions/fnc_setCardiacArrest.sqf +++ b/addons/medical/functions/fnc_setCardiacArrest.sqf @@ -26,7 +26,6 @@ _unit setvariable [QGVAR(heartRate), 0]; [_unit, true] call FUNC(setUnconscious); _timeInCardiacArrest = 120 + round(random(600)); -systemChat format["Unit went cardiac arrest; hr: %1", _unit getvariable [QGVAR(heartRate), -1]]; [{ private ["_args","_unit","_startTime","_timeInCardiacArrest","_heartRate"]; _args = _this select 0; @@ -36,7 +35,6 @@ systemChat format["Unit went cardiac arrest; hr: %1", _unit getvariable [QGVAR(h _heartRate = _unit getvariable [QGVAR(heartRate), 0]; if (_heartRate > 0 || !alive _unit) exitwith { - systemChat format["Unit no longer cardiac arrest; hr: %1", _unit getvariable [QGVAR(heartRate), -1]]; [(_this select 1)] call cba_fnc_removePerFrameHandler; _unit setvariable [QGVAR(inCardiacArrest), nil,true]; }; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf index c003f48ead..0eaa8b4fa8 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf @@ -10,7 +10,7 @@ * Return Value: * Succesful treatment started * - * Public: Yes + * Public: No */ #include "script_component.hpp" @@ -82,18 +82,17 @@ if (_effectivenessFound == -1) exitwith {}; // Seems everything is patched up on // TODO refactor this part // Find the impact this bandage has and reduce the amount this injury is present _impact = if ((_mostEffectiveInjury select 3) >= _effectivenessFound) then {_effectivenessFound} else { (_mostEffectiveInjury select 3) }; -_mostEffectiveInjury set [ 3, ((_mostEffectiveInjury select 3) - _effectivenessFound) max 0]; +_mostEffectiveInjury set [ 3, ((_mostEffectiveInjury select 3) - _impact) max 0]; _openWounds set [_mostEffectiveSpot, _mostEffectiveInjury]; _target setvariable [QGVAR(openWounds), _openWounds, !USE_WOUND_EVENT_SYNC]; if (USE_WOUND_EVENT_SYNC) then { - ["medical_propagateWound", [_unit, _mostEffectiveInjury]] call EFUNC(common,globalEvent); + ["medical_propagateWound", [_target, _mostEffectiveInjury]] call EFUNC(common,globalEvent); }; // Handle the reopening of bandaged wounds -if (_impact > 0) then { - // TODO handle reopening of bandaged wounds - // [_target, _impact, _part,_highestSpot, _removeItem] call FUNC(handleBandageOpening); +if (_impact > 0 && {GVAR(enableAdvancedWounds)}) then { + [_target, _impact, _part, _mostEffectiveSpot, _mostEffectiveInjury, _bandage] call FUNC(handleBandageOpening); }; // If all wounds have been bandaged, we will reset all damage to 0, so the unit is not showing any blood on the model anymore. diff --git a/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf index e8669ecbec..77f6d7f44c 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf @@ -25,6 +25,7 @@ if (alive _target) exitwith { // wounds and injuries _target setvariable [QGVAR(openWounds), [], true]; + _target setvariable [QGVAR(bandagedWounds), [], true]; _target setVariable [QGVAR(internalWounds), [], true]; // vitals diff --git a/addons/medical/functions/fnc_treatmentIVLocal.sqf b/addons/medical/functions/fnc_treatmentIVLocal.sqf index aa7b5dbf17..b0b5ce6a7f 100644 --- a/addons/medical/functions/fnc_treatmentIVLocal.sqf +++ b/addons/medical/functions/fnc_treatmentIVLocal.sqf @@ -19,6 +19,9 @@ private ["_target", "_ivItem", "_config", "_volumeAdded", "_typeOf", "_varName"] _target = _this select 0; _ivItem = _this select 1; +_bloodVolume = _target getvariable [QGVAR(bloodVolume), 100]; +if (_bloodVolume >= 100) exitwith {}; + // Find the proper attributes for the used IV _config = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "IV"); _volumeAdded = getNumber (_config >> "volume"); @@ -31,7 +34,7 @@ if (isClass (_config >> _className)) then { }; _varName = format["ACE_Medical_IVVolume_%1",_typeOf]; -_target setvariable [_varName, (_target getvariable [_varName, 0]) + _volumeAdded]; +_target setvariable [_varName, (_target getvariable [_varName, 0]) + _volumeAdded, true]; if !(_varName in GVAR(IVBags)) then { GVAR(IVBags) pushback _varName; diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index a23c37c658..0243ab5222 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -336,6 +336,9 @@ Garot [CAT] Opaska uciskowa [CAT] + + Receiving IV [%1ml] + diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index 1fdd580724..df876ae2ae 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -1,10 +1,10 @@ class CfgAmmo { - class MissileBase; - - class M_PG_AT : MissileBase { - irLock = 0; - laserLock = 0; - airLock = 0; - manualControl = 0; - }; + class MissileBase; + + class M_PG_AT : MissileBase { + irLock = 0; + laserLock = 0; + airLock = 0; + manualControl = 0; + }; }; \ No newline at end of file diff --git a/addons/missileguidance/CfgEventhandlers.hpp b/addons/missileguidance/CfgEventhandlers.hpp index faa5edef0b..2775490d11 100644 --- a/addons/missileguidance/CfgEventhandlers.hpp +++ b/addons/missileguidance/CfgEventhandlers.hpp @@ -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)); + }; }; \ No newline at end of file diff --git a/addons/missileguidance/CfgWeapons.hpp b/addons/missileguidance/CfgWeapons.hpp index d2961604b6..739ef3c5e0 100644 --- a/addons/missileguidance/CfgWeapons.hpp +++ b/addons/missileguidance/CfgWeapons.hpp @@ -1,34 +1,34 @@ class Mode_SemiAuto; class CfgWeapons { - 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 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 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 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; + };*/ }; \ No newline at end of file diff --git a/addons/missileguidance/config.cpp b/addons/missileguidance/config.cpp index 6720559ccc..9c5842a065 100644 --- a/addons/missileguidance/config.cpp +++ b/addons/missileguidance/config.cpp @@ -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" diff --git a/addons/missileguidance/functions/fnc_fired.sqf b/addons/missileguidance/functions/fnc_fired.sqf index 3b4f4b3635..dbe6abfec7 100644 --- a/addons/missileguidance/functions/fnc_fired.sqf +++ b/addons/missileguidance/functions/fnc_fired.sqf @@ -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); diff --git a/addons/missileguidance/functions/fnc_guidance_DAGR.sqf b/addons/missileguidance/functions/fnc_guidance_DAGR.sqf index 4461c1223f..9055b00a7f 100644 --- a/addons/missileguidance/functions/fnc_guidance_DAGR.sqf +++ b/addons/missileguidance/functions/fnc_guidance_DAGR.sqf @@ -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; - - 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); - - 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,"","",""]; - - - _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; - - _addHeight = [0,0,(_dagrPos distance _targetPos)*0.02]; - #ifdef DEBUG_MODE_FULL - drawLine3D [(ASLtoATL _targetPos) vectorAdd _addHeight, ASLtoATL _targetPos, [0,1,0,1]]; - #endif - - _targetPos = _targetPos vectorAdd _addHeight; + //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; + }; + + _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; + + // 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); + + _dagrPos = getPosASL _dagr; + // player sideChat "G!"; + _targetPos = getPosASL _target; + _shooterPos = getPosASL _shooter; + + if((count _targetPos) > 0) then { + _distanceToTarget = _dagrPos vectorDistance _targetPos; + _distanceToShooter = _dagrPos vectorDistance _shooterPos; + + _addHeight = [0,0,(_dagrPos distance _targetPos)*0.02]; + #ifdef DEBUG_MODE_FULL + drawLine3D [(ASLtoATL _targetPos) vectorAdd _addHeight, ASLtoATL _targetPos, [0,1,0,1]]; + #endif + + _targetPos = _targetPos vectorAdd _addHeight; - _def = 0.0050; - - _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; - }; - }; - - _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]]; - - _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"; + _def = 0.0040; + if(_distanceToShooter > 100) then { + _def = 0.0025; + }; + + _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; + }; + }; + + _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]]; + + _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"; - MARKERCOUNT = MARKERCOUNT + 1; - #endif - - 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; - - // hintSilent format["v: %1", _vectorTo]; - - // _dagr setVectorDir _vectorTo; - _dagr setVectorDirAndUp [_vectorTo, vectorUp _dagr]; - }; - - #ifdef DEBUG_MODE_FULL - hintSilent format["d: %1", _distanceToTarget]; - #endif - }; - }; + MARKERCOUNT = MARKERCOUNT + 1; + #endif + + 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; + + // hintSilent format["v: %1", _vectorTo]; + + // _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); - - GVAR(lastTime) = time; - [FUNC(guidance_DIRECT_LOAL_PFH), 0, _this] call cba_fnc_addPerFrameHandler; + PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); + + 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); + }; }; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_guidance_HellfireII.sqf b/addons/missileguidance/functions/fnc_guidance_HellfireII.sqf index e6551ad4f4..72b8da8c67 100644 --- a/addons/missileguidance/functions/fnc_guidance_HellfireII.sqf +++ b/addons/missileguidance/functions/fnc_guidance_HellfireII.sqf @@ -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; - - 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]; - }; - - _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); - - _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; - - 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; - - - _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]]; - - _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]]; - - _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"; + //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; + }; + + _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); + + _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; + + _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; + + _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; + }; + }; + + _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]; + + 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 - - 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]; - }; - - #ifdef DEBUG_MODE_FULL - hintSilent format["d: %1", _distanceToTarget]; - #endif - }; - }; + MARKERCOUNT = MARKERCOUNT + 1; + #endif + + 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]; + }; + + #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; - - 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]; - }; - - _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); - - _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; - - _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; - }; - }; - - _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]; - - 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"; + //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; + }; + + _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); + + _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; + + 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; + + _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]]; + + _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]]; + + _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 - - 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]; - }; - - #ifdef DEBUG_MODE_FULL - hintSilent format["d: %1", _distanceToTarget]; - #endif - }; - }; + MARKERCOUNT = MARKERCOUNT + 1; + #endif + + 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]; + }; + + #ifdef DEBUG_MODE_FULL + hintSilent format["d: %1", _distanceToTarget]; + #endif + }; + }; }; FUNC(guidance_Hellfire_LOAL_HI) = { - PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); - - GVAR(lastTime) = time; - [FUNC(guidance_Hellfire_LOAL_HI_PFH), 0, _this] call cba_fnc_addPerFrameHandler; + PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); + + 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); - - GVAR(lastTime) = time; - [FUNC(guidance_Hellfire_LOAL_DIR_PFH), 0, _this] call cba_fnc_addPerFrameHandler; + PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); + + 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); + }; }; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_guidance_LGB.sqf b/addons/missileguidance/functions/fnc_guidance_LGB.sqf index e9e8754f19..47efa46768 100644 --- a/addons/missileguidance/functions/fnc_guidance_LGB.sqf +++ b/addons/missileguidance/functions/fnc_guidance_LGB.sqf @@ -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; - - 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); - - 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,"","",""]; - - - _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; - - - - _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; - }; - }; - - _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"; + //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; + }; + + _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; + + // 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); + + _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; + + _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]]; + + _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 - - 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; - - // hintSilent format["v: %1", _vectorTo]; - - // _lgb setVectorDir _vectorTo; - _lgb setVectorDirAndUp [_vectorTo, vectorUp _lgb]; - }; - - #ifdef DEBUG_MODE_FULL - hintSilent format["d: %1", _lgbPos vectorDistance _targetPos]; - #endif - }; - }; + MARKERCOUNT = MARKERCOUNT + 1; + #endif + + 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]; + + // _lgb setVectorDir _vectorTo; + _lgb setVectorDirAndUp [_vectorTo, vectorUp _lgb]; + }; + + #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); - - [FUNC(guidance_LGB_LOAL_PFH), 0, _this] call cba_fnc_addPerFrameHandler; + PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); + + [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); + }; }; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_translateToWeaponSpace.sqf b/addons/missileguidance/functions/fnc_translateToWeaponSpace.sqf index 406d81b145..2c7dc5e6da 100644 --- a/addons/missileguidance/functions/fnc_translateToWeaponSpace.sqf +++ b/addons/missileguidance/functions/fnc_translateToWeaponSpace.sqf @@ -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; \ No newline at end of file diff --git a/addons/missileguidance/script_component.hpp b/addons/missileguidance/script_component.hpp index 886764be2b..377469cdee 100644 --- a/addons/missileguidance/script_component.hpp +++ b/addons/missileguidance/script_component.hpp @@ -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" diff --git a/addons/movement/functions/fnc_handleClimb.sqf b/addons/movement/functions/fnc_handleClimb.sqf index da0f8e0224..39ca9b1e92 100644 --- a/addons/movement/functions/fnc_handleClimb.sqf +++ b/addons/movement/functions/fnc_handleClimb.sqf @@ -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"); diff --git a/addons/resting/functions/fnc_getIntersection.sqf b/addons/resting/functions/fnc_getIntersection.sqf index 395b83f0a4..0527a7c514 100644 --- a/addons/resting/functions/fnc_getIntersection.sqf +++ b/addons/resting/functions/fnc_getIntersection.sqf @@ -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]; diff --git a/addons/safemode/functions/fnc_playChangeFiremodeSound.sqf b/addons/safemode/functions/fnc_playChangeFiremodeSound.sqf index c0b58604b9..6c2c797706 100644 --- a/addons/safemode/functions/fnc_playChangeFiremodeSound.sqf +++ b/addons/safemode/functions/fnc_playChangeFiremodeSound.sqf @@ -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]; diff --git a/addons/weaponselect/functions/fnc_playChangeFiremodeSound.sqf b/addons/weaponselect/functions/fnc_playChangeFiremodeSound.sqf index 82901a1b52..ea671a530d 100644 --- a/addons/weaponselect/functions/fnc_playChangeFiremodeSound.sqf +++ b/addons/weaponselect/functions/fnc_playChangeFiremodeSound.sqf @@ -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]; diff --git a/addons/wep_javelin/CfgEventhandlers.hpp b/addons/wep_javelin/CfgEventhandlers.hpp index 70e16353cd..a61ea9c746 100644 --- a/addons/wep_javelin/CfgEventhandlers.hpp +++ b/addons/wep_javelin/CfgEventhandlers.hpp @@ -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)); + }; }; \ No newline at end of file diff --git a/addons/wep_javelin/CfgOptics.hpp b/addons/wep_javelin/CfgOptics.hpp deleted file mode 100644 index 53f36710fb..0000000000 --- a/addons/wep_javelin/CfgOptics.hpp +++ /dev/null @@ -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 -*/ \ No newline at end of file diff --git a/addons/wep_javelin/CfgSounds.hpp b/addons/wep_javelin/CfgSounds.hpp new file mode 100644 index 0000000000..0af40b9485 --- /dev/null +++ b/addons/wep_javelin/CfgSounds.hpp @@ -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[] = {}; + }; +}; diff --git a/addons/wep_javelin/README.md b/addons/wep_javelin/README.md index 18bd8c6b3f..df3ad9b29d 100644 --- a/addons/wep_javelin/README.md +++ b/addons/wep_javelin/README.md @@ -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) diff --git a/addons/wep_javelin/RscInGameUI.hpp b/addons/wep_javelin/RscInGameUI.hpp new file mode 100644 index 0000000000..e94e4c58fd --- /dev/null +++ b/addons/wep_javelin/RscInGameUI.hpp @@ -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 +*/ \ No newline at end of file diff --git a/addons/wep_javelin/XEH_clientInit.sqf b/addons/wep_javelin/XEH_clientInit.sqf new file mode 100644 index 0000000000..1d3b546e39 --- /dev/null +++ b/addons/wep_javelin/XEH_clientInit.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "initKeybinds.sqf" \ No newline at end of file diff --git a/addons/wep_javelin/XEH_post_init.sqf b/addons/wep_javelin/XEH_post_init.sqf index 6904ee6c47..dc30361926 100644 --- a/addons/wep_javelin/XEH_post_init.sqf +++ b/addons/wep_javelin/XEH_post_init.sqf @@ -1,3 +1,2 @@ #include "script_component.hpp" -NO_DEDICATED; diff --git a/addons/wep_javelin/XEH_pre_init.sqf b/addons/wep_javelin/XEH_pre_init.sqf index f826c6cf93..1b6682f0fc 100644 --- a/addons/wep_javelin/XEH_pre_init.sqf +++ b/addons/wep_javelin/XEH_pre_init.sqf @@ -1,7 +1,15 @@ #include "script_component.hpp" PREP(fired); -PREP(onGetLockedTarget); PREP(translateToWeaponSpace); -PREP(translateToModelSpace); \ No newline at end of file +PREP(translateToModelSpace); + +PREP(lockKeyDown); +PREP(lockKeyUp); +PREP(cycleFireMode); + +PREP(onOpticLoad); +PREP(onOpticDraw); + +GVAR(isLockKeyDown) = false; \ No newline at end of file diff --git a/addons/wep_javelin/config.cpp b/addons/wep_javelin/config.cpp index 0c8fae6154..fa062944fc 100644 --- a/addons/wep_javelin/config.cpp +++ b/addons/wep_javelin/config.cpp @@ -11,4 +11,5 @@ class CfgPatches { }; #include "CfgEventhandlers.hpp" -#include "CfgOptics.hpp" \ No newline at end of file +#include "RscInGameUI.hpp" +#include "CfgSounds.hpp" \ No newline at end of file diff --git a/addons/wep_javelin/data/jav_disp.paa b/addons/wep_javelin/data/jav_disp.paa new file mode 100644 index 0000000000..fc60af24d5 Binary files /dev/null and b/addons/wep_javelin/data/jav_disp.paa differ diff --git a/addons/wep_javelin/data/jav_ring.paa b/addons/wep_javelin/data/jav_ring.paa new file mode 100644 index 0000000000..04d23c3910 Binary files /dev/null and b/addons/wep_javelin/data/jav_ring.paa differ diff --git a/addons/wep_javelin/data/javelin_ui_border_ca.paa b/addons/wep_javelin/data/javelin_ui_border_ca.paa new file mode 100644 index 0000000000..29e9ad6f4b Binary files /dev/null and b/addons/wep_javelin/data/javelin_ui_border_ca.paa differ diff --git a/addons/wep_javelin/data/sounds/javelin_locked.ogg b/addons/wep_javelin/data/sounds/javelin_locked.ogg new file mode 100644 index 0000000000..5002405b1a Binary files /dev/null and b/addons/wep_javelin/data/sounds/javelin_locked.ogg differ diff --git a/addons/wep_javelin/data/sounds/javelin_locking.ogg b/addons/wep_javelin/data/sounds/javelin_locking.ogg new file mode 100644 index 0000000000..dca0ca73b2 Binary files /dev/null and b/addons/wep_javelin/data/sounds/javelin_locking.ogg differ diff --git a/addons/wep_javelin/functions/fnc_cycleFireMode.sqf b/addons/wep_javelin/functions/fnc_cycleFireMode.sqf new file mode 100644 index 0000000000..7902c6d265 --- /dev/null +++ b/addons/wep_javelin/functions/fnc_cycleFireMode.sqf @@ -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]; diff --git a/addons/wep_javelin/functions/fnc_fired.sqf b/addons/wep_javelin/functions/fnc_fired.sqf index d576975c96..4e94989677 100644 --- a/addons/wep_javelin/functions/fnc_fired.sqf +++ b/addons/wep_javelin/functions/fnc_fired.sqf @@ -1,49 +1,40 @@ //#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 { @@ -57,40 +48,46 @@ FUNC(guidance_Javelin_LOBL_HI_PFH) = { 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; - - _defPitch = 0.25; - - if( (_missilePos select 2) < (_targetPos select 2) + 160 && !_wentTerminal) then { - _addHeight = [0,0,(_targetPos select 2) + ( (_distanceToTarget * 2) + 160)]; - TRACE_1("Climb phase", _addHeight); + + if( (_missilePos select 2) < (_targetPos select 2) + 60 && !_wentTerminal) then { + _addHeight = [0,0,(_targetPos select 2) + 120]; + + _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); @@ -104,11 +101,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); + }; + }; }; \ No newline at end of file diff --git a/addons/wep_javelin/functions/fnc_lockKeyDown.sqf b/addons/wep_javelin/functions/fnc_lockKeyDown.sqf new file mode 100644 index 0000000000..bc3198915b --- /dev/null +++ b/addons/wep_javelin/functions/fnc_lockKeyDown.sqf @@ -0,0 +1,3 @@ +#define DEBUG_MODE_FULL +#include "script_component.hpp" +TRACE_1("enter", _this); \ No newline at end of file diff --git a/addons/wep_javelin/functions/fnc_lockKeyUp.sqf b/addons/wep_javelin/functions/fnc_lockKeyUp.sqf new file mode 100644 index 0000000000..bc3198915b --- /dev/null +++ b/addons/wep_javelin/functions/fnc_lockKeyUp.sqf @@ -0,0 +1,3 @@ +#define DEBUG_MODE_FULL +#include "script_component.hpp" +TRACE_1("enter", _this); \ No newline at end of file diff --git a/addons/wep_javelin/functions/fnc_onGetLockedTarget.sqf b/addons/wep_javelin/functions/fnc_onGetLockedTarget.sqf deleted file mode 100644 index 3cc5d685c2..0000000000 --- a/addons/wep_javelin/functions/fnc_onGetLockedTarget.sqf +++ /dev/null @@ -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)); \ No newline at end of file diff --git a/addons/wep_javelin/functions/fnc_onOpticDraw.sqf b/addons/wep_javelin/functions/fnc_onOpticDraw.sqf new file mode 100644 index 0000000000..1bc848cb04 --- /dev/null +++ b/addons/wep_javelin/functions/fnc_onOpticDraw.sqf @@ -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 ]; \ No newline at end of file diff --git a/addons/wep_javelin/functions/fnc_onOpticLoad.sqf b/addons/wep_javelin/functions/fnc_onOpticLoad.sqf new file mode 100644 index 0000000000..c4a7069630 --- /dev/null +++ b/addons/wep_javelin/functions/fnc_onOpticLoad.sqf @@ -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 + ] +]; \ No newline at end of file diff --git a/addons/wep_javelin/functions/fnc_translateToModelSpace.sqf b/addons/wep_javelin/functions/fnc_translateToModelSpace.sqf index 1e2e930ac7..12f828769a 100644 --- a/addons/wep_javelin/functions/fnc_translateToModelSpace.sqf +++ b/addons/wep_javelin/functions/fnc_translateToModelSpace.sqf @@ -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; diff --git a/addons/wep_javelin/functions/fnc_translateToWeaponSpace.sqf b/addons/wep_javelin/functions/fnc_translateToWeaponSpace.sqf index d74fa17fa1..afe2436e5d 100644 --- a/addons/wep_javelin/functions/fnc_translateToWeaponSpace.sqf +++ b/addons/wep_javelin/functions/fnc_translateToWeaponSpace.sqf @@ -1,3 +1,6 @@ +//#define DEBUG_MODE_FULL +#include "script_component.hpp" +TRACE_1("enter", _this); _object = _this select 0; _origin = getPosASL _object; diff --git a/addons/wep_javelin/initKeybinds.sqf b/addons/wep_javelin/initKeybinds.sqf new file mode 100644 index 0000000000..126b1395a3 --- /dev/null +++ b/addons/wep_javelin/initKeybinds.sqf @@ -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 \ No newline at end of file diff --git a/addons/wep_javelin/script_component.hpp b/addons/wep_javelin/script_component.hpp index 3c21d429f2..3df1273422 100644 --- a/addons/wep_javelin/script_component.hpp +++ b/addons/wep_javelin/script_component.hpp @@ -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] \ No newline at end of file diff --git a/addons/wep_javelin/stringtable.xml b/addons/wep_javelin/stringtable.xml new file mode 100644 index 0000000000..4068d6f0a6 --- /dev/null +++ b/addons/wep_javelin/stringtable.xml @@ -0,0 +1,24 @@ + + + + + + Lock Target (Hold) + Lock Target (Hold) + Lock Target (Hold) + Lock Target (Hold) + Lock Target (Hold) + Lock Target (Hold) + Lock Target (Hold) + + + Cycle Fire Mode + Cycle Fire Mode + Cycle Fire Mode + Cycle Fire Mode + Cycle Fire Mode + Cycle Fire Mode + Cycle Fire Mode + + + diff --git a/extensions/CMakeLists.txt b/extensions/CMakeLists.txt new file mode 100644 index 0000000000..f0e21e9207 --- /dev/null +++ b/extensions/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required (VERSION 3.0) +project (ACE) + +if (NOT CMAKE_BUILD_TYPE AND CMAKE_COMPILER_IS_GNUCXX) + message(STATUS "No build type selected, default to Debug") + set(CMAKE_BUILD_TYPE "Debug") +endif() + +option(USE_64BIT_BUILD "USE_64BIT_BUILD" OFF) +option(USE_STATIC_LINKING "USE_STATIC_LINKING" ON) + + +if(CMAKE_COMPILER_IS_GNUCXX) + SET(CMAKE_CXX_FLAGS "-std=c++11 -march=i686 -m32 -O2 -s -fPIC -fpermissive") + set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + set(CMAKE_SHARED_LINKER_FLAGS "-static-libgcc -static-libstdc++") +else() + set(CMAKE_CXX_FLAGS_DEBUG "/D _DEBUG /MTd /Zi /Ob0 /Od /RTC1") + set(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O1 /Ob1 /D NDEBUG") + set(CMAKE_CXX_FLAGS_RELEASE "/MT /O2 /Ob2 /D NDEBUG") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MT /Zi /O2 /Ob1 /D NDEBUG") +endif() + +file(GLOB ACE_COMMON_SOURCES common/*.h common/*.hpp common/*.c common/*.cpp) +add_library(ace_common STATIC ${ACE_COMMON_SOURCES}) +include_directories(AFTER "common") + +# Add extensions to build here +add_subdirectory(fcs) + +message("Build Type: ${CMAKE_BUILD_TYPE}") \ No newline at end of file diff --git a/extensions/build/.gitignore b/extensions/build/.gitignore new file mode 100644 index 0000000000..44c5ea8fa7 --- /dev/null +++ b/extensions/build/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore \ No newline at end of file diff --git a/extensions/common/ace_common.cpp b/extensions/common/ace_common.cpp new file mode 100644 index 0000000000..6ccd690c3a --- /dev/null +++ b/extensions/common/ace_common.cpp @@ -0,0 +1,4 @@ + +int test(int var) { + return var; +} \ No newline at end of file diff --git a/extensions/common/ace_common.h b/extensions/common/ace_common.h new file mode 100644 index 0000000000..4a8847b209 --- /dev/null +++ b/extensions/common/ace_common.h @@ -0,0 +1,4 @@ +#pragma once + +#include "targetver.h" + diff --git a/extensions/common/targetver.h b/extensions/common/targetver.h new file mode 100644 index 0000000000..781012c18f --- /dev/null +++ b/extensions/common/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +#ifdef _WIN32 + #define WIN32_LEAN_AND_MEAN + #include +#else + +#endif \ No newline at end of file diff --git a/extensions/fcs/CMakeLists.txt b/extensions/fcs/CMakeLists.txt new file mode 100644 index 0000000000..2b24542566 --- /dev/null +++ b/extensions/fcs/CMakeLists.txt @@ -0,0 +1,11 @@ +set(ACE_EXTENSION_NAME "ace_fcs") + +file(GLOB SOURCES *.h *.hpp *.c *.cpp) +add_library( ${ACE_EXTENSION_NAME} SHARED ${SOURCES}) +add_dependencies(${ACE_EXTENSION_NAME} ace_common) +SET_TARGET_PROPERTIES(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "") + +if(CMAKE_COMPILER_IS_GNUCXX) + set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_START_STATIC 1) + set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_END_STATIC 1) +endif() \ No newline at end of file diff --git a/extensions/ace_fcs.cpp b/extensions/fcs/ace_fcs.cpp similarity index 99% rename from extensions/ace_fcs.cpp rename to extensions/fcs/ace_fcs.cpp index 81c515e0aa..bf3b8e1290 100644 --- a/extensions/ace_fcs.cpp +++ b/extensions/fcs/ace_fcs.cpp @@ -11,8 +11,8 @@ * Correction to angle */ -#include "stdafx.h" - +#include "ace_common.h" + #define _USE_MATH_DEFINES #include diff --git a/extensions/stdafx.cpp b/extensions/stdafx.cpp deleted file mode 100644 index e1e622b65d..0000000000 --- a/extensions/stdafx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// ace_fcs.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/extensions/stdafx.h b/extensions/stdafx.h deleted file mode 100644 index f3a07375c7..0000000000 --- a/extensions/stdafx.h +++ /dev/null @@ -1,16 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - -#include "targetver.h" - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -// Windows Header Files: -#include - - - -// TODO: reference additional headers your program requires here