Fixed: Javelin CLU UI should have been a PFH not a draw. Migrated. Closes #531

This commit is contained in:
jaynus 2015-04-12 16:18:39 -07:00
parent 807ebd8bfe
commit 4bd489cd96
3 changed files with 35 additions and 20 deletions

View File

@ -14,7 +14,7 @@ class RscInGameUI {
idd = 300;
controls[] = { "ACE_javelin_elements_group", "CA_Distance", "ACE_Targeting" }; //, "ACE_TargetingConstrains", "ACE_TargetingGate", "ACE_TargetingLines"};
onLoad = QUOTE(_this call FUNC(onOpticLoad));
onUnload = "uiNameSpace setVariable ['ACE_RscOptics_javelin',nil];";
onUnload = "uiNameSpace setVariable ['ACE_RscOptics_javelin',nil];uiNameSpace setVariable ['ACE_RscOptics_javelin_PFH',nil];";
class CA_Distance: RscOpticsValue {
idc = 151;
@ -45,13 +45,6 @@ class RscInGameUI {
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";

View File

@ -1,6 +1,6 @@
//#define DEBUG_MODE_FULL
#define DEBUG_MODE_FULL
#include "script_component.hpp"
//TRACE_1("enter", _this);
TRACE_1("enter", _this);
#define __TRACKINTERVAL 0 // how frequent the check should be.
#define __LOCKONTIME 3.0 // Lock on won't occur sooner
@ -10,7 +10,19 @@
#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"];
private["_isJavelin", "_args", "_lastTick", "_runTime", "_soundTime", "_lockTime", "_newTarget", "_currentTarget", "_range", "_pos", "_targetArray"];
if( ! ([ (configFile >> "CfgWeapons" >> (currentWeapon (vehicle ACE_player)) ), "launch_Titan_base"] call EFUNC(common,inheritsFrom))
|| { (vehicle ACE_player) != ACE_player }
) exitWith {
__JavelinIGUITargeting ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false;
__JavelinIGUITargetingConstraints ctrlShow false;
[(_this select 1)] call cba_fnc_removePerFrameHandler;
uiNamespace setVariable["ACE_RscOptics_javelin_PFH", nil];
};
// Reset arguments if we havnt rendered in over a second
_args = uiNamespace getVariable[QGVAR(arguments), [] ];
@ -21,6 +33,8 @@ if( (count _args) > 0) then {
};
};
TRACE_1("Running", "Running");
// Pull the arguments
_currentTarget = _args select 1;
_runTime = _args select 2;
@ -37,9 +51,6 @@ if ((velocity ACE_player) distance [0,0,0] > 0.5 && {cameraView == "GUNNER"} &&
// Refresh the firemode
[] call FUNC(showFireMode);
// Only start locking on holding tab
if(!GVAR(isLockKeyDown)) exitWith { false };
_range = parseNumber (ctrlText __JavelinIGUIRangefinder);
if (_range > 50 && {_range < 2500}) then {
@ -73,8 +84,10 @@ if (isNull _newTarget) then {
__JavelinIGUISeek ctrlSetTextColor __ColorGray;
__JavelinIGUINFOV ctrlSetTextColor __ColorGreen;
__JavelinIGUITargeting ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false;
__JavelinIGUITargetingConstraints ctrlShow false;
ACE_player setVariable ["ace_missileguidance_target",nil, false];
@ -82,8 +95,9 @@ if (isNull _newTarget) then {
//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)}
&& {(call CBA_fnc_getFoV) select 1 > 9}
&& { (currentVisionMode ACE_player == 2)}
&& GVAR(isLockKeyDown)
) then {
// Lock on after 3 seconds
if(_currentTarget != _newTarget) then {
@ -98,8 +112,9 @@ if (isNull _newTarget) then {
__JavelinIGUISeek ctrlSetTextColor __ColorGreen;
__JavelinIGUINFOV ctrlSetTextColor __ColorNull;
__JavelinIGUITargeting ctrlShow true;
__JavelinIGUITargetingConstrains ctrlShow true;
__JavelinIGUITargetingConstrains ctrlShow false;
__JavelinIGUITargetingGate ctrlShow true;
__JavelinIGUITargetingLines ctrlShow true;
@ -187,10 +202,11 @@ if (isNull _newTarget) then {
} else {
// Something is wrong with our seek
_currentTarget = objNull;
ACE_player setVariable["ace_missileguidance_target", nil, false];
__JavelinIGUISeek ctrlSetTextColor __ColorGray;
__JavelinIGUINFOV ctrlSetTextColor __ColorGray;
__JavelinIGUITargetingConstrains ctrlShow false;
__JavelinIGUITargeting ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false;

View File

@ -24,4 +24,10 @@ uiNameSpace setVariable [QGVAR(arguments),
0, // Lock Time
0 // Sound timer
]
];
];
_pfh_handle = uiNamespace getVariable ["ACE_RscOptics_javelin_PFH", nil];
if(isNil "_pfh_handle") then {
_pfh_handle = [FUNC(onOpticDraw), 0, []] call CBA_fnc_addPerFrameHandler;
uiNamespace setVariable["ACE_RscOptics_javelin_PFH", _pfh_handle];
};