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/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/addons/parachute/RscTitles.hpp b/addons/parachute/RscTitles.hpp index ae90e0f472..d51bcad128 100644 --- a/addons/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/addons/parachute/XEH_postInit.sqf b/addons/parachute/XEH_postInit.sqf new file mode 100644 index 0000000000..35df85aa7f --- /dev/null +++ b/addons/parachute/XEH_postInit.sqf @@ -0,0 +1,30 @@ +#include "script_component.hpp" +if (!hasInterface) exitWith {}; + +["ACE3", localize "STR_ACE_Parachute_showAltimeter", +{ + if (!('ACE_Altimeter' in assignedItems ace_player)) exitWith {false}; + if (isNull (missionNamespace getVariable ['ACE_Parachute_AltimeterFnc', scriptNull])) then { + [ace_player] call ACE_Parachute_fnc_showAltimeter + } else { + call ACE_Parachute_fnc_hideAltimeter + }; + true +}, [24, false, false, false], false, "keydown"] call CALLSTACK(cba_fnc_registerKeybind); + +[] spawn { + ACE_Parachuting_PFH = false; + while {true} do { + sleep 1; + // I believe this doesn't work for Zeus. + // vehicle _player + if (!ACE_Parachuting_PFH && {(vehicle ACE_player) isKindOf "ParachuteBase"}) then { + ACE_Parachuting_PFH = true; + ["ACE_ParachuteFix", "OnEachFrame", {call ACE_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 ACE_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 ACE_Core_fnc_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..ca247901e5 --- /dev/null +++ b/addons/parachute/XEH_preInit.sqf @@ -0,0 +1,10 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(doLanding); +PREP(hideAltimeter); +PREP(onEachFrame); +PREP(showAltimeter); + +ADDON = true; diff --git a/addons/parachute/clientInit.sqf b/addons/parachute/clientInit.sqf deleted file mode 100644 index 5cd18c3ea8..0000000000 --- a/addons/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/addons/parachute/config.cpp b/addons/parachute/config.cpp index 78a3f42f75..924c8ccb2c 100644 --- a/addons/parachute/config.cpp +++ b/addons/parachute/config.cpp @@ -1,81 +1,52 @@ +#include "script_component.hpp" + 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}; + 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/"; }; }; -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 "CfgEventHandlers.hpp" #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 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 AGM_Box_Misc: Box_NATO_Support_F { + class ACE_Box_Misc: Box_NATO_Support_F { class TransportItems { - class _xx_AGM_Altimeter { - name = "AGM_Altimeter"; + class _xx_ACE_Altimeter { + name = "ACE_Altimeter"; count = 6; }; }; class TransportBackpacks { - class _xx_AGM_NonSteerableParachute { - backpack = "AGM_NonSteerableParachute"; + class _xx_ACE_NonSteerableParachute { + backpack = "ACE_NonSteerableParachute"; count = 4; }; }; }; class B_Parachute; - class AGM_NonSteerableParachute: B_Parachute { - author = "$STR_AGM_Core_AGMTeam"; + class ACE_NonSteerableParachute: B_Parachute { + author = "$STR_ACE_Common_ACETeam"; scope = 2; - displayName = "$STR_AGM_Parachute_NonSteerableParachute"; + 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 @@ -84,7 +55,7 @@ class CfgVehicles { 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";}; + 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/fn_hideAltimeter.sqf b/addons/parachute/functions/fn_hideAltimeter.sqf deleted file mode 100644 index 4144789613..0000000000 --- a/addons/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/addons/parachute/functions/fn_doLanding.sqf b/addons/parachute/functions/fnc_doLanding.sqf similarity index 52% rename from addons/parachute/functions/fn_doLanding.sqf rename to addons/parachute/functions/fnc_doLanding.sqf index a4d4cf9f81..24ce6b7a4e 100644 --- a/addons/parachute/functions/fn_doLanding.sqf +++ b/addons/parachute/functions/fnc_doLanding.sqf @@ -1,25 +1,27 @@ /* - Name: AGM_Parachute_fnc_doLanding - + Name: ACE_Parachute_fnc_doLanding + Author: Garth de Wet (LH) - + Description: Performs the landing animation fix - - Parameters: + + Parameters: 0: OBJECT - unit - + Returns: Nothing - + Example: - [player] call AGM_Parachute_fnc_doLanding; + [player] call ACE_Parachute_fnc_doLanding; */ +#include "script_component.hpp" +private ["_unit"]; _unit = _this select 0; -["AGM_ParachuteFix", "OnEachFrame"] call BIS_fnc_removeStackedEventHandler; -AGM_Parachuting_PFH = false; -[_unit, "AmovPercMevaSrasWrflDf_AmovPknlMstpSrasWrflDnon", 2] call AGM_Core_fnc_doAnimation; +["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"; -}; \ No newline at end of file +}; diff --git a/addons/parachute/functions/fnc_hideAltimeter.sqf b/addons/parachute/functions/fnc_hideAltimeter.sqf new file mode 100644 index 0000000000..bf2dbf87da --- /dev/null +++ b/addons/parachute/functions/fnc_hideAltimeter.sqf @@ -0,0 +1,19 @@ +/* + Name: ACE_Parachute_fnc_hideAltimeter + + Author: Garth de Wet (LH) + + Description: + Removes the altimeter from the screen. + + Parameters: + + Returns: + Nothing + + Example: + call ACE_Parachute_fnc_hideAltimeter +*/ +#include "script_component.hpp" +terminate ACE_Parachute_AltimeterFnc; +(["ACE_Altimeter"] call BIS_fnc_rscLayer) cutText ["","PLAIN",0,true]; diff --git a/addons/parachute/functions/fn_onEachFrame.sqf b/addons/parachute/functions/fnc_onEachFrame.sqf similarity index 63% rename from addons/parachute/functions/fn_onEachFrame.sqf rename to addons/parachute/functions/fnc_onEachFrame.sqf index 367396d8ac..ddb5c13f49 100644 --- a/addons/parachute/functions/fn_onEachFrame.sqf +++ b/addons/parachute/functions/fnc_onEachFrame.sqf @@ -1,23 +1,24 @@ /* - Name: AGM_Parachute_fnc_onEachFrame - + Name: ACE_Parachute_fnc_onEachFrame + Author: Garth de Wet (LH) - + Description: Checks if a unit can defuse an explosive - - Parameters: + + Parameters: 0: OBJECT - unit - + Returns: Nothing - + Example: - call AGM_Parachute_fnc_onEachFrame; + call ACE_Parachute_fnc_onEachFrame; */ +#include "script_component.hpp" private "_player"; -_player = AGM_player; -if (isNull _player) exitWith {["AGM_ParachuteFix", "OnEachFrame"] call BIS_fnc_removeStackedEventHandler;AGM_Parachuting_PFH = false;}; +_player = ACE_player; +if (isNull _player) exitWith {["ACE_ParachuteFix", "OnEachFrame"] call BIS_fnc_removeStackedEventHandler;ACE_Parachuting_PFH = false;}; if !((vehicle _player) isKindOf "ParachuteBase") exitWith {}; if (isTouchingGround _player) exitWith {}; @@ -27,5 +28,5 @@ _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; + [_player] call ACE_Parachute_fnc_doLanding; }; diff --git a/addons/parachute/functions/fn_showAltimeter.sqf b/addons/parachute/functions/fnc_showAltimeter.sqf similarity index 69% rename from addons/parachute/functions/fn_showAltimeter.sqf rename to addons/parachute/functions/fnc_showAltimeter.sqf index c7547335c0..f2b03b1538 100644 --- a/addons/parachute/functions/fn_showAltimeter.sqf +++ b/addons/parachute/functions/fnc_showAltimeter.sqf @@ -1,26 +1,27 @@ /* - Name: AGM_Parachute_fnc_showAltimeter - + Name: ACE_Parachute_fnc_showAltimeter + Author: Garth de Wet (LH) - + Description: Displays the altimeter on screen. - - Parameters: + + Parameters: 0: OBJECT - unit to track for the altimeter - + Returns: Nothing - + Example: - [player] call AGM_Parachute_fnc_showAltimeter + [player] call ACE_Parachute_fnc_showAltimeter */ +#include "script_component.hpp" 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 {}; +(["ACE_Altimeter"] call BIS_fnc_rscLayer) cutRsc ["ACE_Altimeter", "PLAIN",0,true]; +if (isNull (uiNamespace getVariable ["ACE_Altimeter", displayNull])) exitWith {}; -AGM_Parachute_AltimeterFnc = [uiNamespace getVariable ["AGM_Altimeter", displayNull], _unit] spawn { +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); @@ -36,7 +37,7 @@ AGM_Parachute_AltimeterFnc = [uiNamespace getVariable ["AGM_Altimeter", displayN _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]); + _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; @@ -47,6 +48,6 @@ AGM_Parachute_AltimeterFnc = [uiNamespace getVariable ["AGM_Altimeter", displayN _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}; + if !("ACE_Altimeter" in assignedItems _unit) exitWith {call ACE_Parachute_fnc_hideAltimeter}; }; }; 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/addons/parachute/stringtable.xml b/addons/parachute/stringtable.xml index f1542b1db8..f97b389eeb 100644 --- a/addons/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