diff --git a/TO_MERGE/agm/Parachute/clientInit.sqf b/TO_MERGE/agm/Parachute/clientInit.sqf deleted file mode 100644 index 5cd18c3ea8..0000000000 --- a/TO_MERGE/agm/Parachute/clientInit.sqf +++ /dev/null @@ -1,33 +0,0 @@ -/* - Name: AGM_Parachute_fnc_init - - Author: Garth de Wet (LH) - - Description: - Auto called by Arma. - Initialises the parachute system. - - Parameters: - - Returns: - Nothing - - Example: - call AGM_Parachute_fnc_init; -*/ -[] spawn { - AGM_Parachuting_PFH = false; - while {true} do { - sleep 1; - // I believe this doesn't work for Zeus. - // vehicle _player - if (!AGM_Parachuting_PFH && {(vehicle AGM_player) isKindOf "ParachuteBase"}) then { - AGM_Parachuting_PFH = true; - ["AGM_ParachuteFix", "OnEachFrame", {call AGM_Parachute_fnc_onEachFrame;}] call BIS_fnc_addStackedEventHandler; - }; - }; -}; - -// don't show speed and height when in expert mode -["Parachute", {if (!cadetMode) then {_dlg = _this select 0; {(_dlg displayCtrl _x) ctrlShow false} forEach [121, 122, 1004, 1005, 1006, 1014];};}] call AGM_Core_fnc_addInfoDisplayEventHandler; //@todo addEventHandler infoDisplayChanged with select 1 == "Parachute" -["Soldier", {if (!cadetMode) then {_dlg = _this select 0; {_ctrl = (_dlg displayCtrl _x); _ctrl ctrlSetPosition [0,0,0,0]; _ctrl ctrlCommit 0;} forEach [380, 382]};}] call AGM_Core_fnc_addInfoDisplayEventHandler; //@todo addEventHandler infoDisplayChanged with select 1 == "Soldier" diff --git a/TO_MERGE/agm/Parachute/config.cpp b/TO_MERGE/agm/Parachute/config.cpp deleted file mode 100644 index 78a3f42f75..0000000000 --- a/TO_MERGE/agm/Parachute/config.cpp +++ /dev/null @@ -1,90 +0,0 @@ -class CfgPatches { - class AGM_Parachute { - units[] = {"AGM_NonSteerableParachute"}; - weapons[] = {"AGM_Altimeter"}; - requiredVersion = 0.60; - requiredAddons[] = {AGM_Core}; - version = "0.95"; - versionStr = "0.95"; - versionAr[] = {0,95,0}; - author[] = {"Garth 'LH' de Wet"}; - }; -}; - -class CfgFunctions { - class AGM_Parachute { - class AGM_Parachute { - file = "\AGM_Parachute\functions"; - class onEachFrame; - class doLanding; - class hideAltimeter; - class showAltimeter; - }; - }; -}; - -class Extended_PostInit_EventHandlers { - class AGM_Parachute { - clientInit = "call compile preprocessFileLineNumbers '\AGM_Parachute\clientInit.sqf';"; - }; -}; - -class AGM_Core_Default_Keys { - class showAltimeterNew { - displayName = "$STR_AGM_Parachute_showAltimeter"; - condition = "'AGM_Altimeter' in assignedItems _player"; - statement = "if (isNull (missionNamespace getVariable ['AGM_Parachute_AltimeterFnc', scriptNull])) then {[_player] call AGM_Parachute_fnc_showAltimeter} else {call AGM_Parachute_fnc_hideAltimeter}"; - exceptions[] = {"AGM_Drag_isNotDragging", "AGM_Medical_canTreat", "AGM_Interaction_isNotEscorting"}; - key = 24; - shift = 0; - control = 0; - alt = 0; - }; -}; - -#include "RscTitles.hpp" - -class CfgWeapons { - class ItemWatch; - class AGM_Altimeter:ItemWatch { - author = "$STR_AGM_Core_AGMTeam"; - descriptionShort = "$STR_AGM_Parachute_AltimeterDescription"; - displayName = "$STR_AGM_Parachute_AltimeterDisplayName"; - picture = "\AGM_Parachute\UI\watch_altimeter.paa"; - }; -}; - -class CfgVehicles { - class Box_NATO_Support_F; - class AGM_Box_Misc: Box_NATO_Support_F { - class TransportItems { - class _xx_AGM_Altimeter { - name = "AGM_Altimeter"; - count = 6; - }; - }; - class TransportBackpacks { - class _xx_AGM_NonSteerableParachute { - backpack = "AGM_NonSteerableParachute"; - count = 4; - }; - }; - }; - - class B_Parachute; - class AGM_NonSteerableParachute: B_Parachute { - author = "$STR_AGM_Core_AGMTeam"; - scope = 2; - displayName = "$STR_AGM_Parachute_NonSteerableParachute"; - //picture = "\A3\Characters_F\data\ui\icon_b_parachute_ca.paa"; // @todo - //model = "\A3\Weapons_F\Ammoboxes\Bags\Backpack_Parachute"; // @todo - backpackSimulation = "ParachuteNonSteerable"; //ParachuteSteerable - ParachuteClass = "NonSteerable_Parachute_F"; - maximumLoad = 0; - mass = 100; - }; - - class B_Soldier_05_f; class B_Pilot_F: B_Soldier_05_f {backpack = "AGM_NonSteerableParachute";}; - class I_Soldier_04_F; class I_pilot_F: I_Soldier_04_F {backpack = "AGM_NonSteerableParachute";}; - class O_helipilot_F; class O_Pilot_F: O_helipilot_F {backpack = "AGM_NonSteerableParachute";}; -}; diff --git a/TO_MERGE/agm/Parachute/functions/fn_doLanding.sqf b/TO_MERGE/agm/Parachute/functions/fn_doLanding.sqf deleted file mode 100644 index a4d4cf9f81..0000000000 --- a/TO_MERGE/agm/Parachute/functions/fn_doLanding.sqf +++ /dev/null @@ -1,25 +0,0 @@ -/* - Name: AGM_Parachute_fnc_doLanding - - Author: Garth de Wet (LH) - - Description: - Performs the landing animation fix - - Parameters: - 0: OBJECT - unit - - Returns: - Nothing - - Example: - [player] call AGM_Parachute_fnc_doLanding; -*/ -_unit = _this select 0; -["AGM_ParachuteFix", "OnEachFrame"] call BIS_fnc_removeStackedEventHandler; -AGM_Parachuting_PFH = false; -[_unit, "AmovPercMevaSrasWrflDf_AmovPknlMstpSrasWrflDnon", 2] call AGM_Core_fnc_doAnimation; -[_unit] spawn { - sleep 1; - (_this select 0) playActionNow "Crouch"; -}; \ No newline at end of file diff --git a/TO_MERGE/agm/Parachute/functions/fn_hideAltimeter.sqf b/TO_MERGE/agm/Parachute/functions/fn_hideAltimeter.sqf deleted file mode 100644 index 4144789613..0000000000 --- a/TO_MERGE/agm/Parachute/functions/fn_hideAltimeter.sqf +++ /dev/null @@ -1,18 +0,0 @@ -/* - Name: AGM_Parachute_fnc_hideAltimeter - - Author: Garth de Wet (LH) - - Description: - Removes the altimeter from the screen. - - Parameters: - - Returns: - Nothing - - Example: - call AGM_Parachute_fnc_hideAltimeter -*/ -terminate AGM_Parachute_AltimeterFnc; -(["AGM_Altimeter"] call BIS_fnc_rscLayer) cutText ["","PLAIN",0,true]; diff --git a/TO_MERGE/agm/Parachute/functions/fn_onEachFrame.sqf b/TO_MERGE/agm/Parachute/functions/fn_onEachFrame.sqf deleted file mode 100644 index 367396d8ac..0000000000 --- a/TO_MERGE/agm/Parachute/functions/fn_onEachFrame.sqf +++ /dev/null @@ -1,31 +0,0 @@ -/* - Name: AGM_Parachute_fnc_onEachFrame - - Author: Garth de Wet (LH) - - Description: - Checks if a unit can defuse an explosive - - Parameters: - 0: OBJECT - unit - - Returns: - Nothing - - Example: - call AGM_Parachute_fnc_onEachFrame; -*/ -private "_player"; -_player = AGM_player; -if (isNull _player) exitWith {["AGM_ParachuteFix", "OnEachFrame"] call BIS_fnc_removeStackedEventHandler;AGM_Parachuting_PFH = false;}; -if !((vehicle _player) isKindOf "ParachuteBase") exitWith {}; -if (isTouchingGround _player) exitWith {}; - -private ["_pos", "_intersects"]; -_pos = getPosASL (Vehicle _player); - -if ((lineIntersects [_pos, _pos vectorAdd [0,0,-0.5], vehicle _player, _player]) || {((ASLtoATL _pos) select 2) < 0.75}) then { -// I believe this will not work for Zeus units. - deleteVehicle (vehicle _player); - [_player] call AGM_Parachute_fnc_doLanding; -}; diff --git a/TO_MERGE/agm/Parachute/functions/fn_showAltimeter.sqf b/TO_MERGE/agm/Parachute/functions/fn_showAltimeter.sqf deleted file mode 100644 index c7547335c0..0000000000 --- a/TO_MERGE/agm/Parachute/functions/fn_showAltimeter.sqf +++ /dev/null @@ -1,52 +0,0 @@ -/* - Name: AGM_Parachute_fnc_showAltimeter - - Author: Garth de Wet (LH) - - Description: - Displays the altimeter on screen. - - Parameters: - 0: OBJECT - unit to track for the altimeter - - Returns: - Nothing - - Example: - [player] call AGM_Parachute_fnc_showAltimeter -*/ -private ["_unit"]; -_unit = _this select 0; -(["AGM_Altimeter"] call BIS_fnc_rscLayer) cutRsc ["AGM_Altimeter", "PLAIN",0,true]; -if (isNull (uiNamespace getVariable ["AGM_Altimeter", displayNull])) exitWith {}; - -AGM_Parachute_AltimeterFnc = [uiNamespace getVariable ["AGM_Altimeter", displayNull], _unit] spawn { - private ["_height", "_hour", "_minute", "_descentRate"]; - _unit = _this select 1; - _height = floor ((getPosASL _unit) select 2); - _oldHeight = _height; - _descentRate = 0; - _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 AGM_Core_fnc_numberToDigitsString,[_minute, 2] call AGM_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 !("AGM_Altimeter" in assignedItems _unit) exitWith {call AGM_Parachute_fnc_hideAltimeter}; - }; -}; diff --git a/addons/parachute/$PBOPREFIX$ b/addons/parachute/$PBOPREFIX$ new file mode 100644 index 0000000000..724d3e9c6d --- /dev/null +++ b/addons/parachute/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\parachute diff --git a/addons/parachute/CfgEventHandlers.hpp b/addons/parachute/CfgEventHandlers.hpp new file mode 100644 index 0000000000..8c7edda20f --- /dev/null +++ b/addons/parachute/CfgEventHandlers.hpp @@ -0,0 +1,10 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; diff --git a/TO_MERGE/agm/Parachute/Gurtgeschirr.p3d b/addons/parachute/Gurtgeschirr.p3d similarity index 100% rename from TO_MERGE/agm/Parachute/Gurtgeschirr.p3d rename to addons/parachute/Gurtgeschirr.p3d diff --git a/addons/parachute/README.md b/addons/parachute/README.md new file mode 100644 index 0000000000..fcf1a36333 --- /dev/null +++ b/addons/parachute/README.md @@ -0,0 +1,11 @@ +ace_parachute +=========== + +Improves parachutes and adds an altimeter. + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [CorruptedHeart](https://github.com/CorruptedHeart) +- [esteldunedain](https://github.com/esteldunedain) diff --git a/TO_MERGE/agm/Parachute/RscTitles.hpp b/addons/parachute/RscTitles.hpp similarity index 89% rename from TO_MERGE/agm/Parachute/RscTitles.hpp rename to addons/parachute/RscTitles.hpp index ae90e0f472..d51bcad128 100644 --- a/TO_MERGE/agm/Parachute/RscTitles.hpp +++ b/addons/parachute/RscTitles.hpp @@ -1,18 +1,18 @@ class RscText; class RscPicture; class RscTitles { - class AGM_Altimeter { + class ACE_Altimeter { idd = 9935; enableSimulation = 1; movingEnable = 0; fadeIn=0; fadeOut=1; duration = 10e10; - onLoad = "uiNamespace setVariable ['AGM_Altimeter', _this select 0];"; + onLoad = "uiNamespace setVariable ['ACE_Altimeter', _this select 0];"; class controls { class AltimeterImage: RscPicture { idc = 1200; - text = "AGM_Parachute\UI\watch_altimeter.paa"; + text = PATHTOF(UI\watch_altimeter.paa); x = 0.118437 * safezoneW + safezoneX; y = 0.621 * safezoneH + safezoneY; w = 0.20625 * safezoneW; @@ -48,4 +48,4 @@ class RscTitles { }; }; }; -}; \ No newline at end of file +}; diff --git a/TO_MERGE/agm/Parachute/T10Schirm.p3d b/addons/parachute/T10Schirm.p3d similarity index 100% rename from TO_MERGE/agm/Parachute/T10Schirm.p3d rename to addons/parachute/T10Schirm.p3d diff --git a/TO_MERGE/agm/Parachute/UI/watch_altimeter.paa b/addons/parachute/UI/watch_altimeter.paa similarity index 100% rename from TO_MERGE/agm/Parachute/UI/watch_altimeter.paa rename to addons/parachute/UI/watch_altimeter.paa diff --git a/addons/parachute/XEH_postInit.sqf b/addons/parachute/XEH_postInit.sqf new file mode 100644 index 0000000000..a15e125edd --- /dev/null +++ b/addons/parachute/XEH_postInit.sqf @@ -0,0 +1,43 @@ +/* + * Author: Garth 'L-H' de Wet + * Initialises the parachute system. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * None + * + * Public: No + */ +#include "script_component.hpp" +if (!hasInterface) exitWith {}; + +["ACE3", localize "STR_ACE_Parachute_showAltimeter", +{ + // Conditions: canInteract + _exceptions = [QEGVAR(interaction,isNotEscorting)]; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + if (!('ACE_Altimeter' in assignedItems ace_player)) exitWith {false}; + if (!(missionNamespace getVariable [QGVAR(AltimeterActive), false])) then { + [ace_player] call FUNC(showAltimeter); + } else { + call FUNC(hideAltimeter); + }; + true +}, [24, false, false, false], false, "keydown"] call CALLSTACK(cba_fnc_registerKeybind); + +GVAR(PFH) = false; +["playerVehicleChanged",{ + if (!GVAR(PFH) && {(vehicle ACE_player) isKindOf "ParachuteBase"}) then { + GVAR(PFH) = true; + [FUNC(onEachFrame), 0.1, []] call CALLSTACK(cba_fnc_addPerFrameHandler); + }; +}] call EFUNC(common,addEventHandler); + +// don't show speed and height when in expert mode +["Parachute", {if (!cadetMode) then {_dlg = _this select 0; {(_dlg displayCtrl _x) ctrlShow false} forEach [121, 122, 1004, 1005, 1006, 1014];};}] call EFUNC(common,addInfoDisplayEventHandler); //@todo addEventHandler infoDisplayChanged with select 1 == "Parachute" +["Soldier", {if (!cadetMode) then {_dlg = _this select 0; {_ctrl = (_dlg displayCtrl _x); _ctrl ctrlSetPosition [0,0,0,0]; _ctrl ctrlCommit 0;} forEach [380, 382]};}] call EFUNC(common,addInfoDisplayEventHandler); //@todo addEventHandler infoDisplayChanged with select 1 == "Soldier" diff --git a/addons/parachute/XEH_preInit.sqf b/addons/parachute/XEH_preInit.sqf new file mode 100644 index 0000000000..91c24606c6 --- /dev/null +++ b/addons/parachute/XEH_preInit.sqf @@ -0,0 +1,25 @@ +/* + * Author: Garth 'L-H' de Wet + * Initialises the parachute system. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * None + * + * Public: No + */ +#include "script_component.hpp" + +ADDON = false; + +PREP(doLanding); +PREP(hideAltimeter); +PREP(onEachFrame); +PREP(showAltimeter); + +ADDON = true; diff --git a/addons/parachute/config.cpp b/addons/parachute/config.cpp new file mode 100644 index 0000000000..924c8ccb2c --- /dev/null +++ b/addons/parachute/config.cpp @@ -0,0 +1,61 @@ +#include "script_component.hpp" + +class CfgPatches { + class ACE_Parachute { + units[] = {"ACE_NonSteerableParachute"}; + weapons[] = {"ACE_Altimeter"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + VERSION_CONFIG; + author[] = {"Garth 'LH' de Wet"}; + authorUrl = "http://garth.snakebiteink.co.za/"; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "RscTitles.hpp" + +class CfgWeapons { + class ItemWatch; + class ACE_Altimeter:ItemWatch { + author = "$STR_ACE_Common_ACETeam"; + descriptionShort = "$STR_ACE_Parachute_AltimeterDescription"; + displayName = "$STR_ACE_Parachute_AltimeterDisplayName"; + picture = PATHTOF(UI\watch_altimeter.paa); + }; +}; + +class CfgVehicles { + class Box_NATO_Support_F; + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + class _xx_ACE_Altimeter { + name = "ACE_Altimeter"; + count = 6; + }; + }; + class TransportBackpacks { + class _xx_ACE_NonSteerableParachute { + backpack = "ACE_NonSteerableParachute"; + count = 4; + }; + }; + }; + + class B_Parachute; + class ACE_NonSteerableParachute: B_Parachute { + author = "$STR_ACE_Common_ACETeam"; + scope = 2; + displayName = "$STR_ACE_Parachute_NonSteerableParachute"; + //picture = "\A3\Characters_F\data\ui\icon_b_parachute_ca.paa"; // @todo + //model = "\A3\Weapons_F\Ammoboxes\Bags\Backpack_Parachute"; // @todo + backpackSimulation = "ParachuteNonSteerable"; //ParachuteSteerable + ParachuteClass = "NonSteerable_Parachute_F"; + maximumLoad = 0; + mass = 100; + }; + + class B_Soldier_05_f; class B_Pilot_F: B_Soldier_05_f {backpack = "ACE_NonSteerableParachute";}; + class I_Soldier_04_F; class I_pilot_F: I_Soldier_04_F {backpack = "ACE_NonSteerableParachute";}; + class O_helipilot_F; class O_Pilot_F: O_helipilot_F {backpack = "ACE_NonSteerableParachute";}; +}; diff --git a/addons/parachute/functions/fnc_doLanding.sqf b/addons/parachute/functions/fnc_doLanding.sqf new file mode 100644 index 0000000000..134ab8a3ea --- /dev/null +++ b/addons/parachute/functions/fnc_doLanding.sqf @@ -0,0 +1,26 @@ +/* + * Author: Garth 'L-H' de Wet + * Performs the landing animation fix + * + * Arguments: + * 0: unit + * + * Return Value: + * None + * + * Example: + * [player] call ACE_Parachute_fnc_doLanding; + * + * Public: No + */ +#include "script_component.hpp" +private ["_unit"]; +_unit = _this select 0; +GVAR(PFH) = false; +[_unit, "AmovPercMevaSrasWrflDf_AmovPknlMstpSrasWrflDnon", 2] call EFUNC(common,doAnimation); +[{ + if (time >= ((_this select 0) select 0) + 1) then { + ((_this select 0) select 1) playActionNow "Crouch"; + [(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler); + }; +}, 1, [time,_unit]] call CALLSTACK(cba_fnc_addPerFrameHandler); diff --git a/addons/parachute/functions/fnc_hideAltimeter.sqf b/addons/parachute/functions/fnc_hideAltimeter.sqf new file mode 100644 index 0000000000..dd7d29fce4 --- /dev/null +++ b/addons/parachute/functions/fnc_hideAltimeter.sqf @@ -0,0 +1,18 @@ +/* + * Author: Garth 'L-H' de Wet + * Removes the altimeter from the screen. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ACE_Parachute_fnc_hideAltimeter + * + * Public: No + */ +#include "script_component.hpp" +GVAR(AltimeterActive) = false; +(["ACE_Altimeter"] call BIS_fnc_rscLayer) cutText ["","PLAIN",0,true]; diff --git a/addons/parachute/functions/fnc_onEachFrame.sqf b/addons/parachute/functions/fnc_onEachFrame.sqf new file mode 100644 index 0000000000..be9f0e000c --- /dev/null +++ b/addons/parachute/functions/fnc_onEachFrame.sqf @@ -0,0 +1,33 @@ +/* + * Author: Garth 'L-H' de Wet + * Checks whether the unit should preform landing. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ACE_Parachute_fnc_onEachFrame; + * + * Public: No + */ +#include "script_component.hpp" +private "_player"; +_player = ACE_player; +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 {[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);GVAR(PFH) = false;}; +if (isTouchingGround _player) exitWith {[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);GVAR(PFH) = false;}; + +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 FUNC(doLanding); +}; diff --git a/addons/parachute/functions/fnc_showAltimeter.sqf b/addons/parachute/functions/fnc_showAltimeter.sqf new file mode 100644 index 0000000000..1b3edc26f5 --- /dev/null +++ b/addons/parachute/functions/fnc_showAltimeter.sqf @@ -0,0 +1,46 @@ +/* + * Author: Garth 'L-H' de Wet + * Displays the altimeter on screen. + * + * Arguments: + * 0: unit + * + * Return Value: + * None + * + * Example: + * [player] call ACE_Parachute_fnc_showAltimeter + * + * Public: Yes + */ +#include "script_component.hpp" +private ["_unit"]; +_unit = _this select 0; +(["ACE_Altimeter"] call BIS_fnc_rscLayer) cutRsc ["ACE_Altimeter", "PLAIN",0,true]; +if (isNull (uiNamespace getVariable ["ACE_Altimeter", displayNull])) exitWith {}; + +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); + + _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); diff --git a/addons/parachute/functions/script_component.hpp b/addons/parachute/functions/script_component.hpp new file mode 100644 index 0000000000..29f2e63e07 --- /dev/null +++ b/addons/parachute/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\parachute\script_component.hpp" diff --git a/addons/parachute/script_component.hpp b/addons/parachute/script_component.hpp new file mode 100644 index 0000000000..0b0493b202 --- /dev/null +++ b/addons/parachute/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT parachute +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_PARACHUTE + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_PARACHUTE + #define DEBUG_SETTINGS DEBUG_SETTINGS_PARACHUTE +#endif + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/TO_MERGE/agm/Parachute/stringtable.xml b/addons/parachute/stringtable.xml similarity index 89% rename from TO_MERGE/agm/Parachute/stringtable.xml rename to addons/parachute/stringtable.xml index f1542b1db8..f97b389eeb 100644 --- a/TO_MERGE/agm/Parachute/stringtable.xml +++ b/addons/parachute/stringtable.xml @@ -1,8 +1,8 @@  - + - + Altimeter Altimètre Höhenmesser @@ -12,7 +12,7 @@ Magasságmérő Высотомер - + Altimeter Watch Montre altimètre Höhenmesser @@ -22,7 +22,7 @@ Magasságmérő Часы с высотомером - + Used to show height, descent rate and the time. Affiche la hauteur, le taux de descente et l'heure. Zeigt Höhe, Fallgeschwindigkeit und Uhrzeit. @@ -32,7 +32,7 @@ Mutatja a magasságot, zuhanás sebességét és az időt. Используется для определения высоты, скорости снижения и времени. - + Non-Steerable Parachute Ungelenkter Fallschirm Paracaídas no dirigible