From bacb7d069b0094ee0e7ff103061a18d9d11cdf99 Mon Sep 17 00:00:00 2001 From: Dedmen Miller Date: Tue, 7 Nov 2017 22:21:58 +0100 Subject: [PATCH] Don't recompile XEH EH's before every call (#5728) * Fix medical respawn/init * Medical use CBA addClassEH * Movement inventoryDisplayLoad * Medical handleRespawn header typo * Parachute handleRespawn * Rearm and parachute handleRespawn * concertina_wire handleInit * Fix header * use XEH function instead of config * use XEH function instead of config * remove unneeded init eh --- addons/concertina_wire/CfgEventHandlers.hpp | 4 +- addons/concertina_wire/XEH_PREP.hpp | 1 + addons/concertina_wire/XEH_init.sqf | 3 -- .../functions/fnc_handleInit.sqf | 18 +++++++++ addons/medical/CfgEventHandlers.hpp | 37 ------------------- addons/medical/XEH_PREP.hpp | 4 +- addons/medical/XEH_preInit.sqf | 5 +++ .../fnc_handleInit.sqf} | 15 ++++++++ .../fnc_handleRespawn.sqf} | 15 ++++++++ addons/movement/CfgEventHandlers.hpp | 2 +- addons/movement/XEH_PREP.hpp | 1 + .../fnc_inventoryDisplayLoad.sqf} | 17 ++++++++- addons/parachute/CfgEventHandlers.hpp | 2 +- addons/parachute/XEH_PREP.hpp | 1 + .../fnc_handleRespawn.sqf} | 4 +- addons/rearm/CfgEventHandlers.hpp | 2 +- addons/rearm/XEH_PREP.hpp | 1 + .../fnc_handleRespawn.sqf} | 15 ++++++++ 18 files changed, 98 insertions(+), 49 deletions(-) delete mode 100644 addons/concertina_wire/XEH_init.sqf create mode 100644 addons/concertina_wire/functions/fnc_handleInit.sqf rename addons/medical/{XEH_init.sqf => functions/fnc_handleInit.sqf} (59%) rename addons/medical/{XEH_respawn.sqf => functions/fnc_handleRespawn.sqf} (71%) rename addons/movement/{XEH_inventoryDisplayLoad.sqf => functions/fnc_inventoryDisplayLoad.sqf} (59%) rename addons/parachute/{XEH_respawn.sqf => functions/fnc_handleRespawn.sqf} (66%) rename addons/rearm/{XEH_respawn.sqf => functions/fnc_handleRespawn.sqf} (63%) diff --git a/addons/concertina_wire/CfgEventHandlers.hpp b/addons/concertina_wire/CfgEventHandlers.hpp index 80711b5390..b0ff603096 100644 --- a/addons/concertina_wire/CfgEventHandlers.hpp +++ b/addons/concertina_wire/CfgEventHandlers.hpp @@ -40,12 +40,12 @@ class Extended_Init_EventHandlers { }; class ACE_ConcertinaWire { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_init)); + init = QUOTE(call FUNC(handleInit)); }; }; class Land_Razorwire_F { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_init)); + init = QUOTE(call FUNC(handleInit)); }; }; }; diff --git a/addons/concertina_wire/XEH_PREP.hpp b/addons/concertina_wire/XEH_PREP.hpp index 34a666a6b9..5fffc24969 100644 --- a/addons/concertina_wire/XEH_PREP.hpp +++ b/addons/concertina_wire/XEH_PREP.hpp @@ -3,5 +3,6 @@ PREP(deploy); PREP(dismount); PREP(dismountSuccess); PREP(handleDamage); +PREP(handleInit); PREP(handleKilled); PREP(vehicleDamage); diff --git a/addons/concertina_wire/XEH_init.sqf b/addons/concertina_wire/XEH_init.sqf deleted file mode 100644 index b24353b4df..0000000000 --- a/addons/concertina_wire/XEH_init.sqf +++ /dev/null @@ -1,3 +0,0 @@ -#include "script_component.hpp" -params ["_wire"]; -_wire addEventHandler ["HandleDamage", {call FUNC(handleDamage)}]; diff --git a/addons/concertina_wire/functions/fnc_handleInit.sqf b/addons/concertina_wire/functions/fnc_handleInit.sqf new file mode 100644 index 0000000000..d547a09463 --- /dev/null +++ b/addons/concertina_wire/functions/fnc_handleInit.sqf @@ -0,0 +1,18 @@ +/* + * Author: Rocko + * Handles wire Init + * + * Arguments: + * 0: wire + * + * Return Value: + * None + * + * Example: + * [wire] call ace_concertina_wire_fnc_handleInit + * + * Public: No + */ +#include "script_component.hpp" +params ["_wire"]; +_wire addEventHandler ["HandleDamage", {call FUNC(handleDamage)}]; diff --git a/addons/medical/CfgEventHandlers.hpp b/addons/medical/CfgEventHandlers.hpp index ab7c1868ab..becf395052 100644 --- a/addons/medical/CfgEventHandlers.hpp +++ b/addons/medical/CfgEventHandlers.hpp @@ -16,40 +16,3 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; - -class Extended_Init_EventHandlers { - class CAManBase { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_init)); - }; - }; - class ACE_bodyBagObject { - class ADDON { - init = QUOTE(_this call DEFUNC(dragging,initObject)); - }; - }; -}; - -class Extended_Respawn_EventHandlers { - class CAManBase { - class ADDON { - respawn = QUOTE(call COMPILE_FILE(XEH_respawn)); - }; - }; -}; - -class Extended_Killed_EventHandlers { - class CAManBase { - class ADDON { - killed = QUOTE(call FUNC(handleKilled)); - }; - }; -}; - -class Extended_Local_EventHandlers { - class CAManBase { - class ADDON { - local = QUOTE(call FUNC(handleLocal)); - }; - }; -}; diff --git a/addons/medical/XEH_PREP.hpp b/addons/medical/XEH_PREP.hpp index 9749bd7efc..e6fa31112d 100644 --- a/addons/medical/XEH_PREP.hpp +++ b/addons/medical/XEH_PREP.hpp @@ -40,9 +40,11 @@ PREP(handleDamage_fractures); PREP(handleDamage_internalInjuries); PREP(handleDamage_wounds); PREP(handleDamage_woundsOld); -PREP(handleUnitVitals); +PREP(handleInit); PREP(handleKilled); PREP(handleLocal); +PREP(handleRespawn); +PREP(handleUnitVitals); PREP(handleBandageOpening); PREP(hasItem); PREP(hasItems); diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index 6d09e9427c..57d1fd07a4 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -41,6 +41,11 @@ private _fixStatic = { }; ["StaticWeapon", "init", _fixStatic] call CBA_fnc_addClassEventHandler; ["Car", "init", _fixStatic] call CBA_fnc_addClassEventHandler; +["CAManBase", "Init", FUNC(handleInit)] call CBA_fnc_addClassEventHandler; +["CAManBase", "Respawn", FUNC(handleRespawn)] call CBA_fnc_addClassEventHandler; +["CAManBase", "Killed", FUNC(handleKilled)] call CBA_fnc_addClassEventHandler; +["CAManBase", "Local", FUNC(handleLocal)] call CBA_fnc_addClassEventHandler; + addMissionEventHandler ["Loaded",{ { TRACE_1("starting preload (save load)",_x); diff --git a/addons/medical/XEH_init.sqf b/addons/medical/functions/fnc_handleInit.sqf similarity index 59% rename from addons/medical/XEH_init.sqf rename to addons/medical/functions/fnc_handleInit.sqf index acdd50ce82..7094219aae 100644 --- a/addons/medical/XEH_init.sqf +++ b/addons/medical/functions/fnc_handleInit.sqf @@ -1,3 +1,18 @@ +/* + * Author: KoffeinFlummi + * Called when a unit is initialized via XEH_init + * + * Arguments: + * 0: The Unit + * + * Return Value: + * None + * + * Example: + * [bob] call ACE_medical_fnc_handleInit + * + * Public: No + */ #include "script_component.hpp" params ["_unit"]; diff --git a/addons/medical/XEH_respawn.sqf b/addons/medical/functions/fnc_handleRespawn.sqf similarity index 71% rename from addons/medical/XEH_respawn.sqf rename to addons/medical/functions/fnc_handleRespawn.sqf index 1d1c34d6c7..45fddb7572 100644 --- a/addons/medical/XEH_respawn.sqf +++ b/addons/medical/functions/fnc_handleRespawn.sqf @@ -1,3 +1,18 @@ +/* + * Author: KoffeinFlummi + * Called when a unit is Respawned + * + * Arguments: + * 0: The Unit + * + * Return Value: + * None + * + * Example: + * [bob] call ACE_medical_fnc_handleRespawn + * + * Public: No + */ #include "script_component.hpp" params ["_unit"]; diff --git a/addons/movement/CfgEventHandlers.hpp b/addons/movement/CfgEventHandlers.hpp index 083c5bb089..369f47e1dd 100644 --- a/addons/movement/CfgEventHandlers.hpp +++ b/addons/movement/CfgEventHandlers.hpp @@ -19,6 +19,6 @@ class Extended_PostInit_EventHandlers { class Extended_DisplayLoad_EventHandlers { class RscDisplayInventory { - ADDON = QUOTE(_this call COMPILE_FILE(XEH_inventoryDisplayLoad)); + ADDON = QUOTE(_this call FUNC(inventoryDisplayLoad)); }; }; diff --git a/addons/movement/XEH_PREP.hpp b/addons/movement/XEH_PREP.hpp index 04913f7670..609908450c 100644 --- a/addons/movement/XEH_PREP.hpp +++ b/addons/movement/XEH_PREP.hpp @@ -5,3 +5,4 @@ PREP(canClimb); PREP(climb); PREP(handleClimb); PREP(handleVirtualMass); +PREP(inventoryDisplayLoad); diff --git a/addons/movement/XEH_inventoryDisplayLoad.sqf b/addons/movement/functions/fnc_inventoryDisplayLoad.sqf similarity index 59% rename from addons/movement/XEH_inventoryDisplayLoad.sqf rename to addons/movement/functions/fnc_inventoryDisplayLoad.sqf index ae717e7b39..bc48d4d09c 100644 --- a/addons/movement/XEH_inventoryDisplayLoad.sqf +++ b/addons/movement/functions/fnc_inventoryDisplayLoad.sqf @@ -1,4 +1,19 @@ -#include "script_component.hpp" +/* + * Author: commy2 + * Executed every time an inventory display is opened. + * + * Arguments: + * 0: Inventory display + * + * Return Value: + * None + * + * Example: + * [DISPLAY] call ACE_movement_fnc_inventoryDisplayLoad + * + * Public: No + */ + #include "script_component.hpp" disableSerialization; diff --git a/addons/parachute/CfgEventHandlers.hpp b/addons/parachute/CfgEventHandlers.hpp index f972afc2ca..cdfb6d56fe 100644 --- a/addons/parachute/CfgEventHandlers.hpp +++ b/addons/parachute/CfgEventHandlers.hpp @@ -20,7 +20,7 @@ class Extended_PostInit_EventHandlers { class Extended_Respawn_EventHandlers { class CAManBase { class ADDON { - respawn = QUOTE(call COMPILE_FILE(XEH_respawn)); + respawn = QUOTE(call FUNC(handleRespawn)); }; }; }; diff --git a/addons/parachute/XEH_PREP.hpp b/addons/parachute/XEH_PREP.hpp index c2567b8468..7e5687502e 100644 --- a/addons/parachute/XEH_PREP.hpp +++ b/addons/parachute/XEH_PREP.hpp @@ -1,6 +1,7 @@ PREP(doLanding); PREP(handleInfoDisplayChanged); +PREP(handleRespawn); PREP(hideAltimeter); PREP(onEachFrame); PREP(showAltimeter); diff --git a/addons/parachute/XEH_respawn.sqf b/addons/parachute/functions/fnc_handleRespawn.sqf similarity index 66% rename from addons/parachute/XEH_respawn.sqf rename to addons/parachute/functions/fnc_handleRespawn.sqf index 31e3ff2ae2..5dc91ecae3 100644 --- a/addons/parachute/XEH_respawn.sqf +++ b/addons/parachute/functions/fnc_handleRespawn.sqf @@ -9,9 +9,9 @@ * None * * Example: - * None + * call ace_parachute_fnc_handleRespawn * * Public: No */ #include "script_component.hpp" -ACE_player setVariable [QGVAR(chuteIsCut), false]; \ No newline at end of file +ACE_player setVariable [QGVAR(chuteIsCut), false]; diff --git a/addons/rearm/CfgEventHandlers.hpp b/addons/rearm/CfgEventHandlers.hpp index 17edc1dc30..1c715de8df 100644 --- a/addons/rearm/CfgEventHandlers.hpp +++ b/addons/rearm/CfgEventHandlers.hpp @@ -28,7 +28,7 @@ class Extended_PostInit_EventHandlers { class Extended_Respawn_EventHandlers { class CAManBase { class ADDON { - respawn = QUOTE(call COMPILE_FILE(XEH_respawn)); + respawn = QUOTE(call FUNC(XEH_respawn)); }; }; }; diff --git a/addons/rearm/XEH_PREP.hpp b/addons/rearm/XEH_PREP.hpp index 05377af37a..a8c2ed9625 100644 --- a/addons/rearm/XEH_PREP.hpp +++ b/addons/rearm/XEH_PREP.hpp @@ -19,6 +19,7 @@ PREP(getTurretConfigMagazines); PREP(getTurretMagazineAmmo); PREP(grabAmmo); PREP(handleKilled); +PREP(handleRespawn); PREP(handleUnconscious); PREP(hasEnoughSupply); PREP(initSupplyVehicle); diff --git a/addons/rearm/XEH_respawn.sqf b/addons/rearm/functions/fnc_handleRespawn.sqf similarity index 63% rename from addons/rearm/XEH_respawn.sqf rename to addons/rearm/functions/fnc_handleRespawn.sqf index 5148894f98..26cb918c0e 100644 --- a/addons/rearm/XEH_respawn.sqf +++ b/addons/rearm/functions/fnc_handleRespawn.sqf @@ -1,3 +1,18 @@ +/* + * Author: unknown + * Called when a unit is Respawned + * + * Arguments: + * 0: The Unit + * + * Return Value: + * None + * + * Example: + * [bob] call ACE_rearm_fnc_handleRespawn + * + * Public: No + */ #include "script_component.hpp" params ["_unit"];