Javelin overhaul (#4580)

* Javelin overhaul

* header spelling fix
This commit is contained in:
PabstMirror 2016-11-15 12:15:25 -06:00 committed by GitHub
parent f0279726ce
commit b4315b6a65
22 changed files with 495 additions and 518 deletions

View File

@ -38,13 +38,13 @@ _bounds params ["_boundsMin", "_boundsMax"];
_boundsMin params ["_boundsMinX", "_boundsMinY", "_boundsMinZ"];
_boundsMax params ["_boundsMaxX", "_boundsMaxY", "_boundsMaxZ"];
_boundsMinX = _boundsMinX - _marginsX + _offsetsX;
_boundsMinY = _boundsMinY - _marginsY + _offsetsY;
_boundsMinZ = _boundsMinZ - _marginsZ + _offsetsZ;
_boundsMinX = ((_boundsMinX - _marginsX) min 0) + _offsetsX;
_boundsMinY = ((_boundsMinY - _marginsY) min 0) + _offsetsY;
_boundsMinZ = ((_boundsMinZ - _marginsZ) min 0) + _offsetsZ;
_boundsMaxX = _boundsMaxX + _marginsX + _offsetsX;
_boundsMaxY = _boundsMaxY + _marginsY + _offsetsY;
_boundsMaxZ = _boundsMaxZ + _marginsZ + _offsetsZ;
_boundsMaxX = ((_boundsMaxX + _marginsX) max 0) + _offsetsX;
_boundsMaxY = ((_boundsMaxY + _marginsY) max 0) + _offsetsY;
_boundsMaxZ = ((_boundsMaxZ + _marginsZ) max 0) + _offsetsZ;
private _boundsCorners = [
[_boundsMinX, _boundsMinY, _boundsMinZ],

View File

@ -6,20 +6,13 @@ class Extended_PreStart_EventHandlers {
};
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_pre_init));
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_post_init));
class ADDON {
clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit));
};
};
class Extended_FiredBIS_EventHandlers {
class All {
ADDON = QUOTE(_this call FUNC(onFired));
};
};

View File

@ -1,19 +1,19 @@
class CfgVehicles {
class LandVehicle;
class StaticWeapon : LandVehicle {
class StaticWeapon: LandVehicle {
class Turrets;
};
class StaticMGWeapon : StaticWeapon {
class Turrets : Turrets {
class StaticMGWeapon: StaticWeapon {
class Turrets: Turrets {
class MainTurret;
};
};
class AT_01_base_F: StaticMGWeapon {};
class B_static_AT_F: AT_01_base_F {
class Turrets : Turrets {
class MainTurret : MainTurret {
class Turrets: Turrets {
class MainTurret: MainTurret {
weapons[] = { QGVAR(Titan_Static) };
magazines[] = {"1Rnd_GAT_missiles","1Rnd_GAT_missiles","1Rnd_GAT_missiles","1Rnd_GAT_missiles"};
@ -30,8 +30,8 @@ class CfgVehicles {
};
};
class O_static_AT_F: AT_01_base_F {
class Turrets : Turrets {
class MainTurret : MainTurret {
class Turrets: Turrets {
class MainTurret: MainTurret {
weapons[] = { QGVAR(Titan_Static) };
magazines[] = {"1Rnd_GAT_missiles","1Rnd_GAT_missiles","1Rnd_GAT_missiles","1Rnd_GAT_missiles"};
@ -48,8 +48,8 @@ class CfgVehicles {
};
};
class I_static_AT_F: AT_01_base_F {
class Turrets : Turrets {
class MainTurret : MainTurret {
class Turrets: Turrets {
class MainTurret: MainTurret {
weapons[] = { QGVAR(Titan_Static) };
magazines[] = {"1Rnd_GAT_missiles","1Rnd_GAT_missiles","1Rnd_GAT_missiles","1Rnd_GAT_missiles"};

View File

@ -2,17 +2,17 @@ class CfgWeapons {
class Launcher;
class MissileLauncher;
class Launcher_Base_F : Launcher {
class Launcher_Base_F: Launcher {
class WeaponSlotsInfo;
};
// @TODO: AA by default, motherfuckers
class missiles_titan : MissileLauncher {
class missiles_titan: MissileLauncher {
};
class missiles_titan_at : missiles_titan { };
class GVAR(Titan_Static) : missiles_titan_at {
class missiles_titan_at: missiles_titan { };
class GVAR(Titan_Static): missiles_titan_at {
GVAR(enabled) = 1;
weaponInfoType = "ACE_RscOptics_javelin";
modelOptics = QPATHTOF(data\reticle_titan.p3d);
@ -24,9 +24,9 @@ class CfgWeapons {
};
// @TODO: AA by default, motherfuckers
class launch_Titan_base : Launcher_Base_F {};
class launch_Titan_base: Launcher_Base_F {};
class launch_Titan_short_base : launch_Titan_base { };
class launch_Titan_short_base: launch_Titan_base { };
class launch_B_Titan_short_F: launch_Titan_short_base {
GVAR(enabled) = 1;
@ -58,7 +58,6 @@ class CfgWeapons {
canLock = 0;
lockingTargetSound[] = {"",0,1};
lockedTargetSound[] = {"",0,1};
};

View File

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

View File

@ -1,26 +1,33 @@
class RscOpticsValue;
class RscControlsGroupNoScrollbars;
class RscPicture;
class RscMapControl;
class RscLine;
class RscMapControl;
// Taken from AGM for optics management.
class RscInGameUI {
class ACE_RscOptics_javelin {
idd = 300;
controls[] = { QGVAR(elements_group), "ACE_Targeting" }; //, "ACE_TargetingConstrains", "ACE_TargetingGate", "ACE_TargetingLines"};
onLoad = QUOTE(_this call FUNC(onOpticLoad));
onUnload = QUOTE(_this call FUNC(onOpticUnload));
controls[] = { QGVAR(elements_group), "ACE_Targeting", QGVAR(mapHelper) };
onLoad = QUOTE(with uiNamespace do {ACE_RscOptics_javelin = _this select 0;};);
class GVAR(mapHelper): RscMapControl {
onDraw = QUOTE(_this call FUNC(mapHelperDraw););
x = -10;
y = -10;
w = 0;
h = 0;
};
class GVAR(elements_group): RscControlsGroupNoScrollbars {
x = "SafezoneX";
y = "SafezoneY";
w = "SafezoneW";
h = "SafezoneH";
x = "safeZoneX";
y = "safeZoneY";
w = "safeZoneW";
h = "safeZoneH";
idc = 170;
class Controls {
class Controls {
class CA_Distance: RscOpticsValue {
idc = 151;
sizeEx = "0";
@ -30,13 +37,12 @@ class RscInGameUI {
w = 0;
h = 0;
};
class GVAR(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";
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";
};
@ -44,126 +50,135 @@ class RscInGameUI {
idc = 160;
colorText[] = {0.2941,0.8745,0.2157,1};
};
class CA_Javelin_WFOV_mode_off : GVAR(Day_mode_off) {
class GVAR(WFOV_mode_off): GVAR(Day_mode_off) {
idc = 1004;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (0.307/4)*3*SafezoneH - SafezoneX";
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 GVAR(WFOV_mode_group): RscControlsGroupNoScrollbars {
x = "SafezoneX";
y = "SafezoneY";
w = "SafezoneW";
h = "SafezoneH";
x = "safeZoneX";
y = "safeZoneY";
w = "safeZoneW";
h = "safeZoneH";
idc = 163;
class Controls {
class GVAR(WFOV_mode_on): GVAR(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";
x = "0.4899*safeZoneW - safeZoneX";
y = "0.171*safeZoneH - safeZoneY";
w = 0;
h = "0.049*SafezoneH";
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";
x = "0.5109*safeZoneW- safeZoneX";
y = "0.171*safeZoneH - safeZoneY";
w = 0;
h = "0.049*SafezoneH";
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";
x = "((safeZoneW -safeZoneH*3/4)/2)+ (0.293/4)*3*safeZoneH - safeZoneX";
y = "0.4677*safeZoneH - safeZoneY";
w = 0;
h = "0.0646*SafezoneH";
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";
x = "((safeZoneW -safeZoneH*3/4)/2)+ (0.70/4)*3*safeZoneH - safeZoneX";
y = "0.4677*safeZoneH - safeZoneY";
w = 0;
h = "0.0646*SafezoneH";
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)";
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)";
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 CA_Javelin_NFOV_mode_off: GVAR(Day_mode_off) {
class GVAR(NFOV_mode_off): GVAR(Day_mode_off) {
idc = 1003;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (0.586/4)*3*SafezoneH - SafezoneX";
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 GVAR(NFOV_mode_group): RscControlsGroupNoScrollbars {
x = "SafezoneX";
y = "SafezoneY";
w = "SafezoneW-SafezoneX";
h = "SafezoneH-SafezoneY";
x = "safeZoneX";
y = "safeZoneY";
w = "safeZoneW-safeZoneX";
h = "safeZoneH-safeZoneY";
idc = 162;
class Controls {
class GVAR(NFOV_mode_on): GVAR(NFOV_mode_off) {
idc = -1;
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";
x = "0.4788*safeZoneW - safeZoneX";
y = "0.171*safeZoneH - safeZoneY";
w = 0;
h = "0.049*SafezoneH";
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";
x = "0.5212*safeZoneW - safeZoneX";
y = "0.171*safeZoneH - safeZoneY";
w = 0;
h = "0.049*SafezoneH";
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";
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";
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";
x = "0.5*safeZoneW - safeZoneX";
y = "0.171*safeZoneH - safeZoneY";
w = 0;
h = "0.1825*SafezoneH";
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";
x = "0.5*safeZoneW - safeZoneX";
y = "0.6465*safeZoneH - safeZoneY";
w = 0;
h = "0.1895*SafezoneH";
h = "0.1895*safeZoneH";
colorText[] = {0.2941,0.8745,0.2157,1};
};
};
};
class GVAR(SEEK_off): GVAR(Day_mode_off) {
idc = 699000;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (0.863/4)*3*SafezoneH - SafezoneX";
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 GVAR(SEEK): GVAR(SEEK_off) {
@ -172,8 +187,8 @@ class RscInGameUI {
};
class GVAR(Missle_off): GVAR(Day_mode_off) {
idc = 1032;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (-0.134/4)*3*SafezoneH - SafezoneX";
y = "(SafezoneY + 0.208*SafezoneH) - SafezoneY";
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";
};
@ -183,32 +198,32 @@ class RscInGameUI {
};
class GVAR(CLU_off): GVAR(Missle_off) {
idc = 1027;
y = "(SafezoneY + 0.436*SafezoneH) - SafezoneY";
y = "(safeZoneY + 0.436*safeZoneH) - safeZoneY";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\clu_co.paa";
};
class GVAR(HangFire_off): GVAR(Missle_off) {
idc = 1028;
y = "(SafezoneY + 0.669*SafezoneH) - SafezoneY";
y = "(safeZoneY + 0.669*safeZoneH) - safeZoneY";
text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\hangfire_co.paa";
};
class GVAR(TOP_off): GVAR(Day_mode_off) {
idc = 699001;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (1.023/4)*3*SafezoneH - SafezoneX";
y = "(SafezoneY + 0.208*SafezoneH) - SafezoneY";
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 GVAR(DIR): GVAR(Day_mode) {
idc = 699002;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (1.023/4)*3*SafezoneH - SafezoneX";
y = "(SafezoneY + 0.436*SafezoneH) - SafezoneY";
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 GVAR(FLTR_mode_off): GVAR(Day_mode_off) {
idc = 1002;
x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (1.023/4)*3*SafezoneH - SafezoneX";
y = "(SafezoneY + 0.669*SafezoneH) - SafezoneY";
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 GVAR(FLTR_mode): GVAR(FLTR_mode_off) {
@ -219,139 +234,137 @@ class RscInGameUI {
};
class ACE_Targeting: RscControlsGroupNoScrollbars {
idc = 6999;
x = "SafezoneX";
y = "SafezoneY";
w = "SafezoneW";
h = "SafezoneH";
enabled = 0;
x = "safeZoneX";
y = "safeZoneY";
w = "safeZoneW";
h = "safeZoneH";
enabled = 0;
show = 0;
class Controls {
class ACE_TargetingConstrains: RscControlsGroupNoScrollbars {
x = "SafezoneX";
y = "SafezoneY";
w = "SafezoneW-SafezoneX";
h = "SafezoneH-SafezoneY";
x = "safeZoneX";
y = "safeZoneY";
w = "safeZoneW-safeZoneX";
h = "safeZoneH-safeZoneY";
enabled = 0;
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";
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";
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";
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";
x = "((safeZoneW -(3/4)*safeZoneH)/2)+ 0.69*(3/4)*safeZoneH - safeZoneX";
};
class OpticsBorders: RscPicture {
idc = 699105;
text = QPATHTOF(data\javelin_ui_border_ca.paa);
colorText[] = {0,0,0,1};
x = "((SafezoneW -(3.1/4)*SafezoneH)/2) - SafezoneX";
y = "0.15*SafezoneH-SafezoneY";
w = "(3.1/4)*SafezoneH";
h = "0.7*SafezoneH";
x = "((safeZoneW -(3.1/4)*safeZoneH)/2) - safeZoneX";
y = "0.15*safeZoneH-safeZoneY";
w = "(3.1/4)*safeZoneH";
h = "0.7*safeZoneH";
};
};
};
class ACE_TargetingGate : ACE_TargetingConstrains {
class ACE_TargetingGate: ACE_TargetingConstrains {
idc = 699200;
class Controls {
class TargetingGateTL: ACE_TargetingConstrains {
x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX";
y = "0.15*SafezoneH - SafezoneY";
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";
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";
h = "0.025*safeZoneH";
};
};
};
class TargetingGateTR: TargetingGateTL {
x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX + 0.975*(3/4)*SafezoneH";
y = "0.15*SafezoneH - SafezoneY";
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";
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";
x = "0.025*(3/4)*safeZoneH";
w = "0";
h = "0.025*SafezoneH";
h = "0.025*safeZoneH";
};
};
};
class TargetingGateBL: TargetingGateTL {
x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX";
y = "0.825*SafezoneH - SafezoneY";
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";
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";
h = "0.025*safeZoneH";
};
};
};
class TargetingGateBR: TargetingGateBL {
x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX + 0.975*(3/4)*SafezoneH";
y = "0.825*SafezoneH - SafezoneY";
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";
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";
x = "0.025*(3/4)*safeZoneH";
y = "0";
w = "0";
h = "0.025*SafezoneH";
h = "0.025*safeZoneH";
};
};
};
@ -364,18 +377,18 @@ class RscInGameUI {
class Controls {
class LineH: RscLine {
idc = 699301;
x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX";
y = "0.5*SafezoneH - SafezoneY";
w = "(3/4)*SafezoneH";
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";
x = "0.5*safeZoneW - safeZoneX";
y = "0.15*safeZoneH - safeZoneY";
w = "0";
h = "0.7*SafezoneH";
h = "0.7*safeZoneH";
colorText[] = {0.8745,0.8745,0.8745,1};
};
};
@ -407,4 +420,4 @@ ACE_Titan_TOP_off: 1006
ACE_Titan_DIR: 1007
ACE_Titan_FLTR_mode_off: 1002
ACE_Titan_FLTR_mode: 161
*/
*/

View File

@ -1,11 +1,6 @@
PREP(lockKeyDown);
PREP(lockKeyUp);
PREP(cycleFireMode);
PREP(showFireMode);
PREP(onFired);
PREP(onOpticLoad);
PREP(getTarget);
PREP(mapHelperDraw);
PREP(onOpticDraw);
PREP(onOpticUnload);
PREP(showFireMode);

View File

@ -1,5 +1,6 @@
// #define DEBUG_MODE_FULL
#include "script_component.hpp"
if (!hasInterface) exitWith {};
#include "initKeybinds.sqf"
#include "initKeybinds.sqf"

View File

@ -1,2 +0,0 @@
#include "script_component.hpp"

View File

@ -10,13 +10,13 @@ GVAR(pfehID) = -1;
DFUNC(disableFire) = {
params ["_firedEH"];
if(_firedEH < 0 && {difficulty > 0}) then {
if (_firedEH < 0 && {difficulty > 0}) then {
_firedEH = [ACE_player, "DefaultAction", {true}, {
_canFire = (_this select 1) getVariable["ace_missileguidance_target", nil];
if(!isNil "_canFire") exitWith { false };
private _canFire = (_this select 1) getVariable ["ace_missileguidance_target", nil];
if (!isNil "_canFire") exitWith { false };
true
}] call EFUNC(common,addActionEventHandler);
TRACE_1("added",_firedEH);
TRACE_1("Locking Fire Button",_firedEH);
};
_firedEH
@ -24,8 +24,8 @@ DFUNC(disableFire) = {
DFUNC(enableFire) = {
params ["_firedEH"];
if(_firedEH >= 0 && {difficulty > 0}) then {
TRACE_1("removing",_firedEH);
if (_firedEH >= 0 && {difficulty > 0}) then {
TRACE_1("Unlocking Fire Button",_firedEH);
[ACE_player, "DefaultAction", _firedEH] call EFUNC(common,removeActionEventHandler);
};
-1

View File

@ -1,13 +1,30 @@
//#define DEBUG_MODE_FULL
/*
* Author: jaynus
* Cycles fire mode (top/dir)
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ace_javelin_fnc_cycleFireMode
*
* Public: No
*/
// #define DEBUG_MODE_FULL
#include "script_component.hpp"
TRACE_1("enter", _this);
TRACE_1("cycle fire mode", _this);
private _currentShooter = if (ACE_player call CBA_fnc_canUseWeapon) then {ACE_player} else {vehicle ACE_player};
private _currentFireMode = _currentShooter getVariable["ace_missileguidance_attackProfile", "JAV_TOP"];
private _currentFireMode = _currentShooter getVariable ["ace_missileguidance_attackProfile", "JAV_TOP"];
if(_currentFireMode == "JAV_DIR") then {
if (_currentFireMode == "JAV_DIR") then {
_currentFireMode = "JAV_TOP";
} else {
_currentFireMode = "JAV_DIR";
};
_currentShooter setVariable["ace_missileguidance_attackProfile", _currentFireMode, false];
_currentShooter setVariable ["ace_missileguidance_attackProfile", _currentFireMode, false];
TRACE_2("set",_currentFireMode,_currentShooter);

View File

@ -0,0 +1,81 @@
/*
* Author: PabstMirror
* Find a target within the optic range
*
* Arguments:
* 0: Last Target (seeds the scan) <OBJECT>
* 1: Max Range (meters) <NUMBER)
*
* Return Value:
* Target <OBJECT>
*
* Example:
* [] call ace_javelin_fnc_getTarget
*
* Public: No
*/
// #define DEBUG_MODE_FULL
#include "script_component.hpp"
params ["_lastTarget", "_maxRange"];
scopeName "main";
private _viewASL = AGLtoASL positionCameraToWorld [0,0,0];
private _viewDir = _viewASL vectorFromTo (AGLtoASL positionCameraToWorld [0,0,1]);
// Attempt to lock onto current target if it is still valid
if (!isNull _lastTarget) then {
private _aimASL = aimPos _lastTarget;
if ((_viewASL vectorDistance _aimASL) > _maxRange) exitWith {};
if ((acos ((_viewASL vectorFromTo _aimASL) vectorDotProduct _viewDir)) > 0.6) exitWith {};
private _relAngle = (_lastTarget getRelDir _viewASL);
for "_xOffset" from -2.5 to 2.5 step 0.5 do {
for "_yOffset" from -2 to 1 step 0.5 do {
// Find test points in the model based on the angle that we are viewing it from (not true 3d projection, but not bad)
private _testPosASL = AGLtoASL (_lastTarget modelToWorld [_xOffset * - cos _relAngle, _xOffset * sin _relAngle, _yOffset]);
private _intersectionsToCursorTarget = lineIntersectsSurfaces [_viewASL, _testPosASL, ace_player, vehicle ace_player, true, 1];
// drawIcon3D ["\A3\ui_f\data\map\markers\military\dot_CA.paa", [[0,1,1,1], [1,0,1,1]] select (count _intersectionsToCursorTarget), (ASLtoAGL _testPosASL), 0.25, 0.25, 0, "", 0.5, 0.025, "TahomaB"];
if (!(_intersectionsToCursorTarget isEqualTo [])) then {
(_intersectionsToCursorTarget select 0) params ["", "", "_intersectedObject"];
if (_intersectedObject isKindOf "AllVehicles") then {
_intersectedObject breakOut "main";
};
};
};
};
};
// Try cursorObject/Target as they are very fast
if ((cursorObject isKindOf "AllVehicles") && {(cursorObject distance ace_player) < _maxRange}) then {
private _intersectionsToCursorTarget = lineIntersectsSurfaces [_viewASL, aimPos cursorObject, ace_player, cursorObject, true, 1];
if (_intersectionsToCursorTarget isEqualTo []) then {
cursorObject breakOut "main";
};
};
if ((cursorTarget isKindOf "AllVehicles") && {(cursorObject distance ace_player) < _maxRange}) then {
private _intersectionsToCursorTarget = lineIntersectsSurfaces [_viewASL, aimPos cursorTarget, ace_player, cursorTarget, true, 1];
if (_intersectionsToCursorTarget isEqualTo []) then {
cursorTarget breakOut "main";
};
};
// Attempt to scan using multiple rayscasts - This is expensive (n^2) and care should be given to balance accuracy vs speed
for "_xOffset" from -14 to 14 step 2 do {
for "_yOffset" from -12 to 12 step 4 do {
private _testPosASL = AGLtoASL (positionCameraToWorld [_xOffset, _yOffset, _maxRange]);
private _intersectionsToCursorTarget = lineIntersectsSurfaces [_viewASL, _testPosASL, ace_player, vehicle ace_player, true, 1];
// drawIcon3D ["\A3\ui_f\data\map\markers\military\dot_CA.paa", [[0,1,0,1], [1,0,0,1]] select (count _intersectionsToCursorTarget), (ASLtoAGL _testPosASL), 0.25, 0.25, 0, "", 0.5, 0.025, "TahomaB"];
if (!(_intersectionsToCursorTarget isEqualTo [])) then {
(_intersectionsToCursorTarget select 0) params ["", "", "_intersectedObject"];
if (_intersectedObject isKindOf "AllVehicles") then {
_intersectedObject breakOut "main";
};
};
};
};
objNull

View File

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

View File

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

View File

@ -0,0 +1,52 @@
/*
* Author: PabstMirror
* Handles the map helper's draw event
* Resets arguments if not run recently
* And starts a watchdog to detect when weapon display unloaded
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ace_javelin_fnc_mapHelperDraw
*
* Public: No
*/
// #define DEBUG_MODE_FULL
#include "script_component.hpp"
if (isNil QGVAR(arguments)) then {
TRACE_1("Starting optic draw", _this);
// reset shooter var:
private _currentShooter = if (ACE_player call CBA_fnc_canUseWeapon) then {ACE_player} else {vehicle ACE_player};
_currentShooter setVariable ["ace_missileguidance_target", nil, false];
GVAR(arguments) = [
diag_frameno, // Last run frame
objNull, // currentTargetObject
0, // Lock Start Time
0, // Next Sound timer
-1, // _fireDisabledEH
0 // _nextTargetScan
];
// Start up a watchdog for when the display is no longer shown (but might not be unloaded or null)
[{
if (isNull (uiNamespace getVariable ["ACE_RscOptics_javelin", displayNull])) exitWith {true};
GVAR(arguments) params ["_lastRunFrame"];
(diag_frameno < _lastRunFrame) || {diag_frameno > (_lastRunFrame + 1)}
}, {
TRACE_1("old/null display - ending optic draw",_this);
private _fireDisabledEH = GVAR(arguments) param [4, -1];
[_fireDisabledEH] call FUNC(enableFire);
GVAR(arguments) = nil;
}, []] call CBA_fnc_waitUntilAndExecute;
};
BEGIN_COUNTER(onOpticDraw);
GVAR(arguments) call FUNC(onOpticDraw);
END_COUNTER(onOpticDraw);

View File

@ -1,15 +0,0 @@
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
PARAMS_2(_shooter,_weapon);
// Bail on not missile or javelin PFEH not running
if ((_shooter != ACE_player) || {(GVAR(pfehID) == -1)}) exitWith { false };
private _configs = configProperties [configFile >> "CfgWeapons" >> _weapon, QUOTE(configName _x == QUOTE(QGVAR(enabled))), false];
if (((count _configs) < 1) || {(getNumber (_configs select 0)) != 1}) exitWith {};
__JavelinIGUITargeting ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false;
__JavelinIGUITargetingConstraints ctrlShow false;

View File

@ -1,69 +1,67 @@
//#define DEBUG_MODE_FULL
/*
* Author: jaynus, PabstMirror
* Main loop, handles scaning for targets and drawing the javelin optic
*
* Arguments:
* 0: Last run frame <NUMBER>
* 0: Current target (what we locked last run) <OBJECT>
* 0: Lock start time (cba mission time) <NUMBER>
* 0: Next sound play time (ticktime) <NUMBER>
* 0: Next target scan (ticktime) <NUMBER>
*
* Return Value:
* None
*
* Example:
* [] call ace_javelin_fnc_mapHelperDraw
*
* Public: No
*/
// #define DEBUG_MODE_FULL
#include "script_component.hpp"
TRACE_1("enter", _this);
#define __TRACKINTERVAL 0 // how frequent the check should be.
#define __LOCKONTIME 3 // Lock on won't occur sooner
// TRACE_1("onOpticDraw",diag_frameno);
private ["_apos", "_aposX", "_aposY", "_args", "_boundsInput", "_bpos", "_canFire", "_constraintBottom"];
private ["_constraintLeft", "_constraintRight", "_constraintTop", "_currentTarget", "_fireDisabledEH"];
private ["_firedEH", "_fov", "_lastTick", "_lockTime", "_maxX", "_maxY", "_minX", "_minY", "_newTarget"];
private ["_offsetX", "_offsetY", "_pos", "_randomLockInterval", "_randomPosWithinBounds", "_range"];
private ["_runTime", "_soundTime", "_targetArray", "_zamerny", "_currentShooter"];
_currentShooter = if (ACE_player call CBA_fnc_canUseWeapon) then {ACE_player} else {vehicle ACE_player};
#define __OffsetX ((ctrlPosition __JavelinIGUITargetingLineV) select 0) - 0.5
#define __OffsetY ((ctrlPosition __JavelinIGUITargetingLineH) select 1) - 0.5
// 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);
};
};
TRACE_1("Running", "Running");
#define __TRACKINTERVAL 0 // how frequent the ui update should be.
#define __SCANNTERVAL 0.05 // how frequent the target scan check should be.
#define __LOCKONTIME 3 // Lock on won't occur sooner
// Pull the arguments
_currentTarget = _args select 1;
_runTime = _args select 2;
_lockTime = _args select 3;
_soundTime = _args select 4;
_randomLockInterval = _args select 5;
_fireDisabledEH = _args select 6;
params ["_lastRunFrame", "_currentTarget", "_lockStartTime", "_soundNextPlayTime", "_fireDisabledEH", "_nextTargetScan"];
private ["_ammo", "_magazineConfig", "_weaponConfig"];
_weaponConfig = configProperties [configFile >> "CfgWeapons" >> (currentWeapon _currentShooter), QUOTE(configName _x == QUOTE(QGVAR(enabled))), false];
_magazineConfig = if ((currentMagazine _currentShooter) != "") then {
_ammo = getText (configFile >> "CfgMagazines" >> (currentMagazine _currentShooter) >> "ammo");
configProperties [(configFile >> "CfgAmmo" >> _ammo), "(configName _x) == 'ace_missileguidance'", false];
// Get shooter info
private _currentShooter = if (ACE_player call CBA_fnc_canUseWeapon) then {ACE_player} else {vehicle ACE_player};
private _currentWeapon = currentWeapon _currentShooter;
private _currentMagazine = currentMagazine _currentShooter;
// Get weapon / ammo configs
private _ammoCount = _currentShooter ammo _currentWeapon;
private _weaponConfig = configProperties [configFile >> "CfgWeapons" >> _currentWeapon, QUOTE(configName _x == QUOTE(QGVAR(enabled))), false];
private _ammoConfig = if (_currentMagazine != "") then {
private _ammoType = getText (configFile >> "CfgMagazines" >> _currentMagazine >> "ammo");
configProperties [(configFile >> "CfgAmmo" >> _ammoType), "(configName _x) == 'ace_missileguidance'", false];
} else {
[]
};
//If weapon does not have "javelin enabled", then exit PFEH
if (((count _weaponConfig) < 1) || {(getNumber (_weaponConfig select 0)) != 1}) exitWith {
// Check if loaded and javelin enabled for wepaon and missile guidance enabled for loaded ammo
if ((_ammoCount == 0) || // No ammo loaded
{(count _weaponConfig) < 1} || {(getNumber (_weaponConfig select 0)) != 1} || // Not enabled for weapon
{(count _ammoConfig) < 1} || {(getNumber ((_ammoConfig select 0) >> "enabled")) != 1} // Not enabled for ammo
) exitWith {
__JavelinIGUITargeting ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false;
__JavelinIGUITargetingConstraints ctrlShow false;
__JavelinIGUISeek ctrlSetTextColor __ColorGray;
if(!isNil "_fireDisabledEH") then {
_fireDisabledEH = [_fireDisabledEH] call FUNC(enableFire);
};
[(_this select 1)] call CBA_fnc_removePerFrameHandler;
GVAR(pfehID) = -1;
_fireDisabledEH = [_fireDisabledEH] call FUNC(enableFire);
_this set [0, diag_frameno];
_this set [4, _fireDisabledEH];
};
// 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.
// Bail on fast movement (keep it steady)
if ((velocity ACE_player) distance [0,0,0] > 0.75 && {cameraView == "GUNNER"} && {cameraOn == ACE_player}) exitWith {
TRACE_1("exiting gunner because movement",velocity ACE_player);
ACE_player switchCamera "INTERNAL";
if (player != ACE_player) then {
TRACE_2("Zeus, manually reseting RC after switchCamera",player,ACE_player);
@ -71,222 +69,122 @@ if ((velocity ACE_player) distance [0,0,0] > 0.5 && {cameraView == "GUNNER"} &&
};
};
// Refresh the firemode
// Refresh the firemode (top/dir)
[] call FUNC(showFireMode);
_ammo = _currentShooter ammo (currentWeapon _currentShooter);
// not loaded or not "javelin enabled" for magazine, hide targeting and enable firing
if ((_ammo == 0) || {(count _magazineConfig) < 1} || {(getNumber ((_magazineConfig select 0) >> "enabled")) != 1}) exitWith {
// Get UI constants
private _offsetX = 0.5 * safeZoneW - safeZoneX - 0.5;
private _offsetY = 0.5 * safeZoneH - safeZoneY - 0.5;
private _newTarget = objNull;
if (GVAR(isLockKeyDown) && {cameraView == "GUNNER"} && {(currentVisionMode ACE_player) == 2}) then {
// Attempting to lock; getTarget can be expensive so it's rate is limited
if (diag_tickTime > _nextTargetScan) then {
BEGIN_COUNTER(getTarget);
_newTarget = [_currentTarget, 2500, 0.6] call FUNC(getTarget);
END_COUNTER(getTarget);
_nextTargetScan = diag_tickTime + __SCANNTERVAL;
} else {
_newTarget = _currentTarget;
};
// Show gate box
private _boundsInput = if (_currentTarget isKindOf "CAManBase") then {
[_currentTarget,[-0.5,-0.5,-0.25],[0,0,0]];
} else {
[_currentTarget,[-1,-1,-1],_currentTarget selectionPosition "zamerny"];
};
private _bpos = _boundsInput call EFUNC(common,worldToScreenBounds);
private _lockTime = if (isNull _currentTarget) then {0} else {CBA_missionTime - _lockStartTime};
private _minX = ((linearConversion [1, (__LOCKONTIME - 0.5), _lockTime, 0.5 - 0.075*safeZoneW, (_bpos select 0), true]) + _offsetX) max __ConstraintLeft;
private _minY = ((linearConversion [1, (__LOCKONTIME - 0.5), _lockTime, 0.5 - 0.075*safeZoneH, (_bpos select 1), true]) + _offsetY) max __ConstraintTop;
private _maxX = (((linearConversion [1, (__LOCKONTIME - 0.5), _lockTime, 0.5 + 0.075*safeZoneW, (_bpos select 2), true]) + _offsetX) min __ConstraintRight) - (0.025 * (3 / 4) * safeZoneH);
private _maxY = (((linearConversion [1, (__LOCKONTIME - 0.5), _lockTime, 0.5 + 0.075*safeZoneH, (_bpos select 3), true]) + _offsetY) min __ConstraintBottom) - (0.025 * safeZoneH);
// TRACE_3("",_boundsInput,_bpos,_lockTime);
// TRACE_4("",_minX,_maxX,_minY,_maxY);
__JavelinIGUITargetingGateTL ctrlSetPosition [_minX, _minY];
__JavelinIGUITargetingGateTR ctrlSetPosition [_maxX, _minY];
__JavelinIGUITargetingGateBL ctrlSetPosition [_minX, _maxY];
__JavelinIGUITargetingGateBR ctrlSetPosition [_maxX, _maxY];
{_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingGateTL, __JavelinIGUITargetingGateTR, __JavelinIGUITargetingGateBL, __JavelinIGUITargetingGateBR];
__JavelinIGUITargeting ctrlShow true;
__JavelinIGUITargetingGate ctrlShow true;
} else {
// Not trying to lock
__JavelinIGUITargeting ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false;
__JavelinIGUITargetingConstraints ctrlShow false;
if(!isNil "_fireDisabledEH") then {
_fireDisabledEH = [_fireDisabledEH] call FUNC(enableFire);
};
};
_range = parseNumber (ctrlText __JavelinIGUIRangefinder);
TRACE_1("Viewing range", _range);
if (_range > 50 && {_range < 2500}) then {
_pos = positionCameraToWorld [0,0,_range];
_targetArray = _pos nearEntities ["AllVehicles", _range/100];
TRACE_1("Searching at range", _targetArray);
if (count (_targetArray) > 0) then {
_newTarget = _targetArray select 0;
};
};
if ((isNull _newTarget) && {cursorObject isKindOf "AllVehicles"}) then {
private _intersectionsToCursorTarget = lineIntersectsSurfaces [(AGLtoASL positionCameraToWorld [0,0,0]), aimPos cursorObject, ace_player, cursorObject, true, 1];
if (_intersectionsToCursorTarget isEqualTo []) then {
_newTarget = cursorObject;
};
};
if ((isNull _newTarget) && {cursorTarget isKindOf "AllVehicles"}) then {
private _intersectionsToCursorTarget = lineIntersectsSurfaces [(AGLtoASL positionCameraToWorld [0,0,0]), aimPos cursorTarget, ace_player, cursorTarget, true, 1];
if (_intersectionsToCursorTarget isEqualTo []) then {
_newTarget = cursorTarget;
};
};
// Create constants
_constraintTop = __ConstraintTop;
_constraintLeft = __ConstraintLeft;
_constraintBottom = __ConstraintBottom;
_constraintRight = __ConstraintRight;
_offsetX = __OffsetX;
_offsetY = __OffsetY;
__JavelinIGUITargeting ctrlShow true;
__JavelinIGUITargetingConstrains ctrlShow true;
_zamerny = _currentTarget selectionPosition (["zamerny", "body"] select (_currentTarget isKindOf "CAManBase"));
_randomPosWithinBounds = [(_zamerny select 0) + 1 - (random 2.0),(_zamerny select 1) + 1 - (random 2.0),(_zamerny select 2) + 0.5 - (random 1.0)];
_apos = worldToScreen (_currentTarget modelToWorld _randomPosWithinBounds);
_aposX = 0;
_aposY = 0;
if (count _apos < 2) then {
_aposX = 1;
_aposY = 0;
} else {
_aposX = (_apos select 0) + _offsetX;
_aposY = (_apos select 1) + _offsetY;
};
if((call CBA_fnc_getFoV) select 1 > 9) then {
__JavelinIGUINFOV ctrlSetTextColor __ColorGreen;
__JavelinIGUIWFOV ctrlSetTextColor __ColorGray;
} else {
__JavelinIGUINFOV ctrlSetTextColor __ColorGray;
__JavelinIGUIWFOV ctrlSetTextColor __ColorGreen;
};
if (isNull _newTarget) then {
// No targets found
// No target found
_currentTarget = objNull;
_lockTime = 0;
_lockStartTime = 0;
__JavelinIGUISeek ctrlSetTextColor __ColorGray;
__JavelinIGUITargeting ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false;
_currentShooter setVariable ["ace_missileguidance_target", nil, false];
__JavelinIGUITargetingLines ctrlShow false;
__JavelinIGUITargetingConstraints ctrlShow false;
_currentShooter setVariable ["ace_missileguidance_target",nil, false];
// Disallow fire
_fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire);
} else {
_fov = [] call CBA_fnc_getFoV;
TRACE_1("FOV", _fov);
if (_newTarget distance ACE_player < 2500
&& {(call CBA_fnc_getFoV) select 1 > 9}
&& { (currentVisionMode ACE_player == 2)}
&& GVAR(isLockKeyDown)
) then {
// Lock on after 3 seconds
if(_currentTarget != _newTarget) then {
TRACE_1("New Target, reseting locking", _newTarget);
_lockTime = diag_tickTime;
_currentTarget = _newTarget;
if ((!isNull _newTarget) && {_currentTarget != _newTarget}) then {
TRACE_1("New Target, reseting locking", _newTarget);
_lockStartTime = CBA_missionTime;
_currentTarget = _newTarget;
};
playSound "ACE_Javelin_Locking";
} else {
if(diag_tickTime - _lockTime > __LOCKONTIME + _randomLockInterval) then {
TRACE_2("LOCKED!", _currentTarget, _lockTime);
if ((CBA_missionTime - _lockStartTime) > __LOCKONTIME) then { // Lock on after 3 seconds
TRACE_2("LOCKED!", _currentTarget, _lockStartTime);
__JavelinIGUISeek ctrlSetTextColor __ColorGreen;
__JavelinIGUITargetingLines ctrlShow true;
__JavelinIGUISeek ctrlSetTextColor __ColorGreen;
// Move target marker (the crosshair) to aimpoint on the target
private _aimPointOnTarget = _currentTarget selectionPosition (["zamerny", "body"] select (_currentTarget isKindOf "CAManBase"));
(worldToScreen (_currentTarget modelToWorld _aimPointOnTarget)) params [["_aposX", 0.5], ["_aposY", 0.5]];
private _ctrlPos = ctrlPosition __JavelinIGUITargetingLineV;
_ctrlPos set [0, _aposX + _offsetX];
__JavelinIGUITargetingLineV ctrlSetPosition _ctrlPos;
__JavelinIGUITargetingLineV ctrlCommit __TRACKINTERVAL;
_ctrlPos = ctrlPosition __JavelinIGUITargetingLineH;
_ctrlPos set [1, _aposY + _offsetY];
__JavelinIGUITargetingLineH ctrlSetPosition _ctrlPos;
__JavelinIGUITargetingLineH ctrlCommit __TRACKINTERVAL;
__JavelinIGUITargeting ctrlShow true;
__JavelinIGUITargetingConstrains ctrlShow false;
__JavelinIGUITargetingGate ctrlShow true;
__JavelinIGUITargetingLines ctrlShow true;
_currentShooter setVariable ["ace_missileguidance_target", _currentTarget, false];
// Move target marker to coords.
//__JavelinIGUITargetingLineV ctrlSetPosition [_aposX,ctrlPosition __JavelinIGUITargetingLineV select 1];
//__JavelinIGUITargetingLineH ctrlSetPosition [ctrlPosition __JavelinIGUITargetingLineH select 0,_aposY];
//{_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingLineH,__JavelinIGUITargetingLineV];
// Allow fire
_fireDisabledEH = [_fireDisabledEH] call FUNC(enableFire);
_boundsInput = if (_currentTarget isKindOf "CAManBase") then {
[_currentTarget,[-1,-1,-2],_currentTarget selectionPosition "body"];
} else {
[_currentTarget,[-1,-1,-2],_currentTarget selectionPosition "zamerny"];
};
_bpos = _boundsInput call EFUNC(common,worldToScreenBounds);
_minX = ((_bpos select 0) + _offsetX) max _constraintLeft;
_minY = ((_bpos select 1) + _offsetY) max _constraintTop;
_maxX = ((_bpos select 2) + _offsetX) min (_constraintRight - 0.025 * (3 / 4) * SafezoneH);
_maxY = ((_bpos select 3) + _offsetY) min (_constraintBottom - 0.025 * SafezoneH);
TRACE_4("", _boundsInput, _bpos, _minX, _minY);
__JavelinIGUITargetingGateTL ctrlSetPosition [_minX, _minY];
__JavelinIGUITargetingGateTR ctrlSetPosition [_maxX, _minY];
__JavelinIGUITargetingGateBL ctrlSetPosition [_minX, _maxY];
__JavelinIGUITargetingGateBR ctrlSetPosition [_maxX, _maxY];
{_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingGateTL, __JavelinIGUITargetingGateTR, __JavelinIGUITargetingGateBL, __JavelinIGUITargetingGateBR];
_currentShooter setVariable["ace_missileguidance_target", _currentTarget, false];
// Allow fire
_fireDisabledEH = [_fireDisabledEH] call FUNC(enableFire);
if(diag_tickTime > _soundTime) then {
playSound "ACE_Javelin_Locked";
_soundTime = diag_tickTime + 0.25;
};
} else {
__JavelinIGUITargeting ctrlShow true;
__JavelinIGUITargetingGate ctrlShow true;
__JavelinIGUITargetingConstrains ctrlShow true;
__JavelinIGUITargetingLines ctrlShow false;
_currentShooter setVariable["ace_missileguidance_target", nil, false];
_boundsInput = if (_currentTarget isKindOf "CAManBase") then {
[_newTarget,[-1,-1,-2],_currentTarget selectionPosition "body"];
} else {
[_newTarget,[-1,-1,-1],_currentTarget selectionPosition "zamerny"];
};
_bpos = _boundsInput call EFUNC(common,worldToScreenBounds);
_minX = ((_bpos select 0) + _offsetX) max _constraintLeft;
_minY = ((_bpos select 1) + _offsetY) max _constraintTop;
_maxX = ((_bpos select 2) + _offsetX) min (_constraintRight - 0.025 * (3 / 4) * SafezoneH);
_maxY = ((_bpos select 3) + _offsetY) min (_constraintBottom - 0.025 * SafezoneH);
TRACE_4("", _boundsInput, _bpos, _minX, _minY);
__JavelinIGUITargetingGateTL ctrlSetPosition [_minX,_minY];
__JavelinIGUITargetingGateTR ctrlSetPosition [_maxX,_minY];
__JavelinIGUITargetingGateBL ctrlSetPosition [_minX,_maxY];
__JavelinIGUITargetingGateBR ctrlSetPosition [_maxX,_maxY];
{_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingGateTL,__JavelinIGUITargetingGateTR,__JavelinIGUITargetingGateBL,__JavelinIGUITargetingGateBR];
if(diag_tickTime > _soundTime) then {
playSound "ACE_Javelin_Locking";
_soundTime = diag_tickTime + 0.25;
};
// Disallow fire
_fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire);
};
if (diag_tickTime > _soundNextPlayTime) then {
playSound "ACE_Javelin_Locked";
_soundNextPlayTime = diag_tickTime + 0.25;
};
} else {
// No targets found
_currentTarget = objNull;
_lockTime = 0;
// Lock in progress
__JavelinIGUISeek ctrlSetTextColor __ColorGray;
__JavelinIGUITargeting ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false;
__JavelinIGUITargetingConstraints ctrlShow false;
_currentShooter setVariable ["ace_missileguidance_target", nil, false];
if (diag_tickTime > _soundNextPlayTime) then {
playSound "ACE_Javelin_Locking";
_soundNextPlayTime = diag_tickTime + 0.25;
};
// Disallow fire
_fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire);
};
};
//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];
_args set[6, _fireDisabledEH];
uiNamespace setVariable[QGVAR(arguments), _args ];
_this set [0, diag_frameno];
_this set [1, _currentTarget];
_this set [2, _lockStartTime];
_this set [3, _soundNextPlayTime];
_this set [4, _fireDisabledEH];
_this set [5, _nextTargetScan];

View File

@ -1,39 +0,0 @@
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
TRACE_1("enter", _this);
#define __LOCKONTIMERANDOM 1 // Deviation in lock on time
if((count _this) > 0) then {
uiNameSpace setVariable ['ACE_RscOptics_javelin',_this select 0];
};
private _currentShooter = if (ACE_player call CBA_fnc_canUseWeapon) then {ACE_player} else {vehicle ACE_player};
TRACE_2("shooter",_currentShooter,typeOf _currentShooter);
_currentShooter setVariable ["ace_missileguidance_target", nil, false];
__JavelinIGUISeek ctrlSetTextColor __ColorGray;
__JavelinIGUINFOV ctrlSetTextColor __ColorGray;
__JavelinIGUITargeting ctrlShow false;
__JavelinIGUITargetingConstrains ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false;
if(GVAR(pfehID) != -1) then {
[] call FUNC(onOpticUnload); // Unload optic if it was already loaded
};
uiNameSpace setVariable [QGVAR(arguments),
[
diag_tickTime, // Last runtime
objNull, // currentTargetObject
0, // Run Time
0, // Lock Time
0, // Sound timer
(random __LOCKONTIMERANDOM), // random lock time addition
-1
]
];
GVAR(pfehID) = [FUNC(onOpticDraw), 0, []] call CBA_fnc_addPerFrameHandler;

View File

@ -1,20 +0,0 @@
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
TRACE_1("enter", _this);
private ["_args", "_disableFireEH"];
// uiNameSpace setVariable ['ACE_RscOptics_javelin',nil];
if(GVAR(pfehID) != -1) then {
[GVAR(pfehID)] call CBA_fnc_removePerFrameHandler;
GVAR(pfehID) = -1;
};
_args = uiNamespace getVariable[QGVAR(arguments), nil ];
if(!isNil "_args") then {
_disableFireEH = _args select 6;
if(_disableFireEH > 0 && difficulty > 0) then {
[ACE_player, "DefaultAction", _disableFireEH] call EFUNC(common,removeActionEventHandler);
};
uiNameSpace setVariable [QGVAR(arguments),nil];
};

View File

@ -1,11 +1,27 @@
/*
* Author: jaynus
* Updates fire mode on javelin display (top/dir)
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ace_javelin_fnc_showFireMode
*
* Public: No
*/
//#define DEBUG_MODE_FULL
#include "script_component.hpp"
TRACE_1("enter", _this);
private _currentShooter = if (ACE_player call CBA_fnc_canUseWeapon) then {ACE_player} else {vehicle ACE_player};
private _currentFireMode = _currentShooter getVariable ["ace_missileguidance_attackProfile", "JAV_TOP"];
if(_currentFireMode == "JAV_TOP") then {
TRACE_1("showFireMode", _currentFireMode);
if (_currentFireMode == "JAV_TOP") then {
__JavelinIGUITop ctrlSetTextColor __ColorGreen;
__JavelinIGUIDir ctrlSetTextColor __ColorGray;
} else {

View File

@ -5,18 +5,16 @@
if (GETGVAR(isLockKeyDown,false)) exitWith {false};
GVAR(isLockKeyDown) = true;
TRACE_1("lock key down",GVAR(isLockKeyDown));
// Statement
[ACE_player] call FUNC(lockKeyDown);
// Return false so it doesn't block the rest weapon action
false
},
{
// prevent holding down
GVAR(isLockKeyDown) = false;
TRACE_1("lock key up",GVAR(isLockKeyDown));
// Statement
[ACE_player] call FUNC(lockKeyUp);
false
},
[15, [false, false, false]], false] call CBA_fnc_addKeybind; //Tab Key
@ -27,4 +25,4 @@
[ACE_player] call FUNC(cycleFireMode);
false
},
[15, [false, true, false]], false] call CBA_fnc_addKeybind; //Ctrl+Tab Key
[15, [false, true, false]], false] call CBA_fnc_addKeybind; //Ctrl+Tab Key

View File

@ -16,9 +16,6 @@
#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")
@ -29,8 +26,6 @@
#define __JavelinIGUISeek (__JavelinIGUI displayCtrl 699000)
#define __JavelinIGUITop (__JavelinIGUI displayCtrl 699001)
#define __JavelinIGUIDir (__JavelinIGUI displayCtrl 699002)
#define __JavelinIGUINFOV (__JavelinIGUI displayCtrl 1003)
#define __JavelinIGUIWFOV (__JavelinIGUI displayCtrl 1004)
#define __JavelinIGUIRangefinder (__JavelinIGUI displayCtrl 151)
// Constrains