Converted to use CBA PFH's and MACROs.

This commit is contained in:
Garth L-H de Wet
2015-02-02 23:58:24 +02:00
parent 966cb6ffdf
commit aca1c0c6cf
5 changed files with 51 additions and 56 deletions

View File

@ -18,10 +18,11 @@
#include "script_component.hpp"
private ["_unit"];
_unit = _this select 0;
["ACE_ParachuteFix", "OnEachFrame"] call BIS_fnc_removeStackedEventHandler;
ACE_Parachuting_PFH = false;
[_unit, "AmovPercMevaSrasWrflDf_AmovPknlMstpSrasWrflDnon", 2] call ACE_Core_fnc_doAnimation;
[_unit] spawn {
sleep 1;
(_this select 0) playActionNow "Crouch";
};
GVAR(PFH) = false;
[_unit, "AmovPercMevaSrasWrflDf_AmovPknlMstpSrasWrflDnon", 2] call EFUNC(common,doAnimation);
[{
if (diag_tickTime >= ((_this select 0) select 0) + 1) then {
((_this select 0) select 1) playActionNow "Crouch";
[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);
};
}, 1, [diag_tickTime,_unit]] call CALLSTACK(cba_fnc_addPerFrameHandler);

View File

@ -15,5 +15,5 @@
call ACE_Parachute_fnc_hideAltimeter
*/
#include "script_component.hpp"
terminate ACE_Parachute_AltimeterFnc;
GVAR(AltimeterActive) = false;
(["ACE_Altimeter"] call BIS_fnc_rscLayer) cutText ["","PLAIN",0,true];

View File

@ -18,15 +18,18 @@
#include "script_component.hpp"
private "_player";
_player = ACE_player;
if (isNull _player) exitWith {["ACE_ParachuteFix", "OnEachFrame"] call BIS_fnc_removeStackedEventHandler;ACE_Parachuting_PFH = false;};
if (!GVAR(PFH)) exitWith {[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);};
if (isNull _player) exitWith {[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);GVAR(PFH) = false;};
if !((vehicle _player) isKindOf "ParachuteBase") exitWith {};
if (isTouchingGround _player) exitWith {};
if (isTouchingGround _player) exitWith {[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);GVAR(PFH) = false;};
private ["_pos", "_intersects"];
_pos = getPosASL (Vehicle _player);
private ["_pos"];
_pos = getPosASL (vehicle _player);
if ((lineIntersects [_pos, _pos vectorAdd [0,0,-0.5], vehicle _player, _player]) || {((ASLtoATL _pos) select 2) < 0.75}) then {
[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);
GVAR(PFH) = false;
// I believe this will not work for Zeus units.
deleteVehicle (vehicle _player);
[_player] call ACE_Parachute_fnc_doLanding;
[_player] call FUNC(doLanding);
};

View File

@ -21,33 +21,28 @@ _unit = _this select 0;
(["ACE_Altimeter"] call BIS_fnc_rscLayer) cutRsc ["ACE_Altimeter", "PLAIN",0,true];
if (isNull (uiNamespace getVariable ["ACE_Altimeter", displayNull])) exitWith {};
ACE_Parachute_AltimeterFnc = [uiNamespace getVariable ["ACE_Altimeter", displayNull], _unit] spawn {
private ["_height", "_hour", "_minute", "_descentRate"];
_unit = _this select 1;
_height = floor ((getPosASL _unit) select 2);
_oldHeight = _height;
_descentRate = 0;
GVAR(AltimeterActive) = true;
[{
if (!GVAR(AltimeterActive)) exitWith {[_this select 1] call CALLSTACK(cba_fnc_removePerFrameEventHandler);};
disableSerialization;
EXPLODE_4_PVT(_this select 0,_display,_unit,_oldHeight,_prevTime);
if !("ACE_Altimeter" in assignedItems _unit) exitWith {[_this select 1] call CALLSTACK(cba_fnc_removePerFrameEventHandler);call FUNC(hideAltimeter);};
private ["_height", "_hour", "_minute", "_descentRate","_HeightText", "_DecendRate", "_TimeText", "_curTime"];
_HeightText = _display displayCtrl 1100;
_DecendRate = _display displayCtrl 1000;
_TimeText = _display displayCtrl 1001;
_hour = floor daytime;
_minute = floor ((daytime - _hour) * 60);
disableSerialization;
private ["_HeightText", "_DecendRate", "_TimeText", "_prevTime", "_curTime"];
_HeightText = (_this select 0) displayCtrl 1100;
_DecendRate = (_this select 0) displayCtrl 1000;
_TimeText = (_this select 0) displayCtrl 1001;
_curTime = time;
_prevTime = _curTime;
while {true} do {
_TimeText ctrlSetText (format ["%1:%2",[_hour, 2] call ACE_Core_fnc_numberToDigitsString,[_minute, 2] call ACE_Core_fnc_numberToDigitsString]);
_HeightText ctrlSetText (format ["%1", floor(_height)]);
_DecendRate ctrlSetText (format ["%1", _descentRate max 0]);
sleep 0.2;
_height = (getPosASL _unit) select 2;
_curTime = time;
_descentRate = floor ((_oldHeight - _height) / (_curTime - _prevTime));
_oldHeight = _height;
_prevTime = _curTime;
// close altimeter, @todo _unit can change due to team switch, zeus!
if !("ACE_Altimeter" in assignedItems _unit) exitWith {call ACE_Parachute_fnc_hideAltimeter};
};
};
_height = (getPosASL _unit) select 2;
_curTime = time;
_descentRate = floor ((_oldHeight - _height) / (_curTime - _prevTime));
_TimeText ctrlSetText (format ["%1:%2",[_hour, 2] call EFUNC(common,numberToDigitsString),[_minute, 2] call EFUNC(common,numberToDigitsString)]);
_HeightText ctrlSetText (format ["%1", floor(_height)]);
_DecendRate ctrlSetText (format ["%1", _descentRate max 0]);
(_this select 0) set [2, _height];
(_this select 0) set [3, _curTime];
}, 0.2, [uiNamespace getVariable ["ACE_Altimeter", displayNull], _unit,floor ((getPosASL _unit) select 2), time]] call CALLSTACK(cba_fnc_addPerFrameEventHandler);