From 5d6fd9ab3ea1db6ef2d4c94239a0328ff75dcabb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 13 Jan 2015 01:17:52 -0300 Subject: [PATCH] CBAfy AGM_Hearing --- addons/hearing/CfgAmmo.hpp | 7 + addons/hearing/CfgEventHandlers.hpp | 36 +++ addons/hearing/CfgSounds.hpp | 14 ++ addons/hearing/CfgVehicles.hpp | 101 +++++++++ addons/hearing/CfgWeapons.hpp | 15 ++ ...arplugs_x_ca.paa => ace_earplugs_x_ca.paa} | Bin addons/hearing/XEH_postInit.sqf | 55 +++++ addons/hearing/XEH_preInit.sqf | 9 + addons/hearing/clientInit.sqf | 64 ------ addons/hearing/config.cpp | 207 ++---------------- addons/hearing/functions/fn_addEarPlugs.sqf | 9 +- addons/hearing/functions/fn_earRinging.sqf | 25 ++- addons/hearing/functions/fn_explosionNear.sqf | 3 +- addons/hearing/functions/fn_firedNear.sqf | 5 +- addons/hearing/functions/fn_hasEarPlugsIn.sqf | 7 +- addons/hearing/functions/fn_putInEarplugs.sqf | 5 +- .../hearing/functions/fn_removeEarplugs.sqf | 11 +- ...ing_heavy.wav => ace_earringing_heavy.wav} | Bin ...g_medium.wav => ace_earringing_medium.wav} | Bin ...nging_weak.wav => ace_earringing_weak.wav} | Bin 20 files changed, 289 insertions(+), 284 deletions(-) create mode 100644 addons/hearing/CfgAmmo.hpp create mode 100644 addons/hearing/CfgEventHandlers.hpp create mode 100644 addons/hearing/CfgSounds.hpp create mode 100644 addons/hearing/CfgVehicles.hpp create mode 100644 addons/hearing/CfgWeapons.hpp rename addons/hearing/UI/{agm_earplugs_x_ca.paa => ace_earplugs_x_ca.paa} (100%) create mode 100644 addons/hearing/XEH_postInit.sqf create mode 100644 addons/hearing/XEH_preInit.sqf delete mode 100644 addons/hearing/clientInit.sqf rename addons/hearing/sounds/{agm_earringing_heavy.wav => ace_earringing_heavy.wav} (100%) rename addons/hearing/sounds/{agm_earringing_medium.wav => ace_earringing_medium.wav} (100%) rename addons/hearing/sounds/{agm_earringing_weak.wav => ace_earringing_weak.wav} (100%) diff --git a/addons/hearing/CfgAmmo.hpp b/addons/hearing/CfgAmmo.hpp new file mode 100644 index 0000000000..dea7901434 --- /dev/null +++ b/addons/hearing/CfgAmmo.hpp @@ -0,0 +1,7 @@ +// Setting up old stuff for A3 +class CfgAmmo { + class BulletBase; + class B_127x108_Ball: BulletBase { + audibleFire = 15; + }; +}; \ No newline at end of file diff --git a/addons/hearing/CfgEventHandlers.hpp b/addons/hearing/CfgEventHandlers.hpp new file mode 100644 index 0000000000..1198729b4d --- /dev/null +++ b/addons/hearing/CfgEventHandlers.hpp @@ -0,0 +1,36 @@ + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit) ); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + clientInit = QUOTE( call COMPILE_FILE(XEH_postInit.sqf) ); + }; +}; + +class Extended_Init_EventHandlers { + class CAManBase { + class GVAR(AddEarPlugs) { + init = QUOTE( if (local (_this select 0)) then {_this call FUNC(addEarPlugs)}; ); + }; + }; +}; + +class Extended_FiredNear_EventHandlers { + class CAManBase { + class GVAR(FiredNear) { + clientFiredNear = QUOTE( if (_this select 0 == ACE_player) then {_this call FUNC(firedNear)}; ); + }; + }; +}; + +class Extended_Explosion_EventHandlers { + class CAManBase { + class GVAR(ExplosionNear) { + clientExplosion = QUOTE( if (_this select 0 == #CE_player) then {_this call FUNC(explosionNear)}; ); + }; + }; +}; \ No newline at end of file diff --git a/addons/hearing/CfgSounds.hpp b/addons/hearing/CfgSounds.hpp new file mode 100644 index 0000000000..ce442838d0 --- /dev/null +++ b/addons/hearing/CfgSounds.hpp @@ -0,0 +1,14 @@ +class CfgSounds { + class ACE_EarRinging_Weak { + sound[] = {QUOTE(PATHOF(sounds\ACE_earringing_weak.wav),8,1.7}; + titles[] = {}; + }; + class ACE_EarRinging_Medium { + sound[] = {QUOTE(PATHOF(sounds\ACE_earringing_medium.wav),8,1.7}; + titles[] = {}; + }; + class ACE_EarRinging_Heavy { + sound[] = {QUOTE(PATHOF(sounds\ACE_earringing_heavy.wav),8,1.7}; + titles[] = {}; + }; +}; \ No newline at end of file diff --git a/addons/hearing/CfgVehicles.hpp b/addons/hearing/CfgVehicles.hpp new file mode 100644 index 0000000000..153357115e --- /dev/null +++ b/addons/hearing/CfgVehicles.hpp @@ -0,0 +1,101 @@ + +#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ + name = #ITEM; \ + count = COUNT; \ +}; + +class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class ACE_Equipment { + class ACE_PutInEarplugs { + displayName = "$STR_ACE_Hearing_Earbuds_On"; + condition = QUOTE( !([_player] call FUNC(hasEarPlugsIn)) && {'ACE_EarBuds' in items _player} ); + statement = QUOTE( [_player] call FUNC(putInEarPlugs) ); + showDisabled = 0; + priority = 2.5; + icon = QUOTE(PATHOF(UI\ACE_earplugs_x_ca.paa)); + hotkey = "E"; + enableInside = 1; + }; + class ACE_RemoveEarplugs { + displayName = "$STR_ACE_Hearing_Earbuds_Off"; + condition = QUOTE( [_player] call FUNC(hasEarPlugsIn) ); + statement = QUOTE( [_player] call FUNC(removeEarPlugs) ); + showDisabled = 0; + priority = 2.5; + icon = QUOTE(PATHOF(UI\ACE_earplugs_x_ca.paa)); + hotkey = "E"; + enableInside = 1; + }; + }; + }; + }; + + class ReammoBox_F; + class NATO_Box_Base; + class EAST_Box_Base; + class IND_Box_Base; + class FIA_Box_Base_F; + + class Box_NATO_Support_F: NATO_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_EarBuds,12) + }; + }; + + class B_supplyCrate_F: ReammoBox_F { + class TransportItems { + MACRO_ADDITEM(ACE_EarBuds,12) + }; + }; + + class Box_East_Support_F: EAST_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_EarBuds,12) + }; + }; + + class O_supplyCrate_F: B_supplyCrate_F { + class TransportItems { + MACRO_ADDITEM(ACE_EarBuds,12) + }; + }; + + class Box_IND_Support_F: IND_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_EarBuds,12) + }; + }; + + class Box_FIA_Support_F: FIA_Box_Base_F { + class TransportItems { + MACRO_ADDITEM(ACE_EarBuds,12) + }; + }; + + class I_supplyCrate_F: B_supplyCrate_F { + class TransportItems { + MACRO_ADDITEM(ACE_EarBuds,12) + }; + }; + + class IG_supplyCrate_F: ReammoBox_F { + class TransportItems { + MACRO_ADDITEM(ACE_EarBuds,12) + }; + }; + + class C_supplyCrate_F: ReammoBox_F { + class TransportItems { + MACRO_ADDITEM(ACE_EarBuds,12) + }; + }; + + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_EarBuds,12) + }; + }; +}; diff --git a/addons/hearing/CfgWeapons.hpp b/addons/hearing/CfgWeapons.hpp new file mode 100644 index 0000000000..d4614b6370 --- /dev/null +++ b/addons/hearing/CfgWeapons.hpp @@ -0,0 +1,15 @@ +class CfgWeapons { + class ACE_ItemCore; + class InventoryItem_Base_F; + + class ACE_EarBuds: ACE_ItemCore { + displayName = "$STR_ACE_Hearing_Earbuds_Name"; + descriptionShort = "$STR_ACE_Hearing_Earbuds_Description"; + model = QUOTE(PATHOF(ACE_earplugs.p3d); + picture = QUOTE(PATHOF(UI\ACE_earplugs_x_ca.paa); + scope = 2; + class ItemInfo: InventoryItem_Base_F { + mass = 1; + }; + }; +}; \ No newline at end of file diff --git a/addons/hearing/UI/agm_earplugs_x_ca.paa b/addons/hearing/UI/ace_earplugs_x_ca.paa similarity index 100% rename from addons/hearing/UI/agm_earplugs_x_ca.paa rename to addons/hearing/UI/ace_earplugs_x_ca.paa diff --git a/addons/hearing/XEH_postInit.sqf b/addons/hearing/XEH_postInit.sqf new file mode 100644 index 0000000000..bd9c066faa --- /dev/null +++ b/addons/hearing/XEH_postInit.sqf @@ -0,0 +1,55 @@ +// by commy2 and CAA-Picard +#define STRENGHTODEAFNESS 3 +#define MAXDEAFNESS 1.1 + +GVAR(currentDeafness) = 0; +GVAR(newStrength) = 0; + +// Spawn volume updating process +0 spawn { + while {true} do { + _player = ACE_player; + + // Check if new noises increase deafness + if (GVAR(newStrength) * STRENGHTODEAFNESS > GVAR(currentDeafness)) then { + GVAR(currentDeafness) = GVAR(newStrength) * STRENGHTODEAFNESS min MAXDEAFNESS; + }; + GVAR(newStrength) = 0; + + // Recover rate is slower if deafness is severe + _recoverRate = 0.01; + if (GVAR(currentDeafness) > 0.7) then { + _recoverRate = 0.005; + if (GVAR(currentDeafness) > 0.9) then { + _recoverRate = 0.002; + }; + }; + + // Deafness recovers with time + GVAR(currentDeafness) = GVAR(currentDeafness) - _recoverRate max 0; + + // needed until Bohemia fixes playSound to actually use the second argument + _volume = (1 - GVAR(currentDeafness) max 0)^2 max 0.1; + + // Earplugs reduce hearing 20% + if ([_player] call FUNC(hasEarPlugsIn)) then { + _volume = _volume min 0.8; + }; + + // Reduce volume if player is unconscious + if (_player getVariable ["ACE_isUnconscious", false]) then { + _volume = _volume min 0.4; + }; + + if (!(missionNameSpace getVariable [QGVAR(disableVolumeUpdate), false])) then { + 0.1 fadeSound _volume; + 0.1 fadeSpeech _volume; + _player setVariable ["tf_globalVolume", _volume]; + _player setVariable ["acre_sys_core_globalVolume", _volume]; + }; + + //hintSilent format ["GVAR(currentDeafness), _Volume = %1, %2", GVAR(currentDeafness), _volume]; + + sleep 0.1; + }; +}; diff --git a/addons/hearing/XEH_preInit.sqf b/addons/hearing/XEH_preInit.sqf new file mode 100644 index 0000000000..14e037595e --- /dev/null +++ b/addons/hearing/XEH_preInit.sqf @@ -0,0 +1,9 @@ +#include "script_component.hpp" + +PREP(addEarPlugs); +PREP(earRinging); +PREP(explosionNear); +PREP(firedNear); +PREP(hasEarPlugsIn); +PREP(putInEarPlugs); +PREP(removeEarPlugs); \ No newline at end of file diff --git a/addons/hearing/clientInit.sqf b/addons/hearing/clientInit.sqf deleted file mode 100644 index d1296f0aef..0000000000 --- a/addons/hearing/clientInit.sqf +++ /dev/null @@ -1,64 +0,0 @@ -// by commy2 and CAA-Picard -#define STRENGHTODEAFNESS 3 -#define MAXDEAFNESS 1.1 - -AGM_CurrentDeafness = 0; -AGM_NewStrength = 0; - -// Spawn volume updating process -0 spawn { - while {true} do { - _player = AGM_player; - - // Check if new noises increase deafness - if (AGM_NewStrength * STRENGHTODEAFNESS > AGM_CurrentDeafness) then { - AGM_CurrentDeafness = AGM_NewStrength * STRENGHTODEAFNESS min MAXDEAFNESS; - - // icon is CUT - /*if (AGM_CurrentDeafness > 0.4) then { - if (AGM_CurrentDeafness > 0.8) then { - [parseText ""] call AGM_Core_fnc_displayTextStructured; - } else { - [parseText ""] call AGM_Core_fnc_displayTextStructured; - }; - };*/ - }; - AGM_NewStrength = 0; - - // Recover rate is slower if deafness is severe - _recoverRate = 0.01; - if (AGM_CurrentDeafness > 0.7) then { - _recoverRate = 0.005; - if (AGM_CurrentDeafness > 0.9) then { - _recoverRate = 0.002; - }; - }; - - // Deafness recovers with time - AGM_CurrentDeafness = AGM_CurrentDeafness - _recoverRate max 0; - - // needed until Bohemia fixes playSound to actually use the second argument - _volume = (1 - AGM_CurrentDeafness max 0)^2 max 0.1; - - // Earplugs reduce hearing 20% - if ([_player] call AGM_Hearing_fnc_hasEarPlugsIn) then { - _volume = _volume min 0.8; - }; - - // Reduce volume if player is unconscious - if (_player getVariable ["AGM_isUnconscious", false]) then { - _volume = _volume min 0.4; - }; - - if (!(missionNameSpace getVariable ["AGM_Hearing_disableVolumeUpdate", false])) then { - 0.1 fadeSound _volume; - 0.1 fadeSpeech _volume; - _player setVariable ["tf_globalVolume", _volume]; - _player setVariable ["acre_sys_core_globalVolume", _volume]; - }; - - //hintSilent format ["AGM_CurrentDeafness, _Volume = %1, %2", AGM_CurrentDeafness, _volume]; - - sleep 0.1; - }; -}; diff --git a/addons/hearing/config.cpp b/addons/hearing/config.cpp index bdc4199346..5cb9890b51 100644 --- a/addons/hearing/config.cpp +++ b/addons/hearing/config.cpp @@ -1,198 +1,23 @@ +#include "script_component.hpp" + class CfgPatches { - class AGM_Hearing { - units[] = {}; - weapons[] = {"AGM_EarBuds"}; - requiredVersion = 0.60; - requiredAddons[] = {AGM_Core, AGM_Interaction}; - version = "0.95"; - versionStr = "0.95"; - versionAr[] = {0,95,0}; - author[] = {"KoffeinFlummi", "CAA-Picard", "HopeJ", "commy2"}; - authorUrl = "https://github.com/KoffeinFlummi/"; - }; + class ADDON { + units[] = {}; + weapons[] = {"ACE_EarBuds"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author[] = {"KoffeinFlummi", "CAA-Picard", "HopeJ", "commy2"}; + authorUrl = "https://github.com/KoffeinFlummi/"; + VERSION_CONFIG; + }; }; -class CfgFunctions { - class AGM_Hearing { - class AGM_Hearing { - file = "AGM_Hearing\functions"; - class addEarPlugs; - class earRinging; - class explosionNear; - class firedNear; - class hasEarPlugsIn; - class putInEarPlugs; - class removeEarPlugs; - }; - }; -}; +#include "CfgEventHandlers.hpp" -class Extended_PostInit_EventHandlers { - class AGM_Hearing { - clientInit = "call compile preprocessFileLineNumbers '\AGM_Hearing\clientInit.sqf'"; - }; -}; +#include "CfgVehicles.hpp" -class Extended_Init_EventHandlers { - class CAManBase { - class AGM_Hearing_AddEarPlugs { - init = "if (local (_this select 0)) then {_this call AGM_Hearing_fnc_addEarPlugs};"; - }; - }; -}; +#include "CfgSounds.hpp" -class Extended_FiredNear_EventHandlers { - class CAManBase { - class AGM_Hearing_FiredNear { - clientFiredNear = "if (_this select 0 == AGM_player) then {_this call AGM_Hearing_fnc_firedNear};"; - }; - }; -}; +#include "CfgWeapons.hpp" -class Extended_Explosion_EventHandlers { - class CAManBase { - class AGM_Hearing_ExplosionNear { - clientExplosion = "if (_this select 0 == AGM_player) then {_this call AGM_Hearing_fnc_explosionNear};"; - }; - }; -}; - -#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ -}; - -class CfgVehicles { - class Man; - class CAManBase: Man { - class AGM_SelfActions { - class AGM_Equipment { - class AGM_PutInEarplugs { - displayName = "$STR_AGM_Hearing_Earbuds_On"; - condition = "!([_player] call AGM_Hearing_fnc_hasEarPlugsIn) && {'AGM_EarBuds' in items _player}"; - statement = "[_player] call AGM_Hearing_fnc_putInEarPlugs"; - showDisabled = 0; - priority = 2.5; - icon = "AGM_Hearing\UI\agm_earplugs_x_ca.paa"; - hotkey = "E"; - enableInside = 1; - }; - class AGM_RemoveEarplugs { - displayName = "$STR_AGM_Hearing_Earbuds_Off"; - condition = "[_player] call AGM_Hearing_fnc_hasEarPlugsIn"; - statement = "[_player] call AGM_Hearing_fnc_removeEarPlugs"; - showDisabled = 0; - priority = 2.5; - icon = "AGM_Hearing\UI\agm_earplugs_x_ca.paa"; - hotkey = "E"; - enableInside = 1; - }; - }; - }; - }; - - class ReammoBox_F; - class NATO_Box_Base; - class EAST_Box_Base; - class IND_Box_Base; - class FIA_Box_Base_F; - - class Box_NATO_Support_F: NATO_Box_Base { - class TransportItems { - MACRO_ADDITEM(AGM_EarBuds,12) - }; - }; - - class B_supplyCrate_F: ReammoBox_F { - class TransportItems { - MACRO_ADDITEM(AGM_EarBuds,12) - }; - }; - - class Box_East_Support_F: EAST_Box_Base { - class TransportItems { - MACRO_ADDITEM(AGM_EarBuds,12) - }; - }; - - class O_supplyCrate_F: B_supplyCrate_F { - class TransportItems { - MACRO_ADDITEM(AGM_EarBuds,12) - }; - }; - - class Box_IND_Support_F: IND_Box_Base { - class TransportItems { - MACRO_ADDITEM(AGM_EarBuds,12) - }; - }; - - class Box_FIA_Support_F: FIA_Box_Base_F { - class TransportItems { - MACRO_ADDITEM(AGM_EarBuds,12) - }; - }; - - class I_supplyCrate_F: B_supplyCrate_F { - class TransportItems { - MACRO_ADDITEM(AGM_EarBuds,12) - }; - }; - - class IG_supplyCrate_F: ReammoBox_F { - class TransportItems { - MACRO_ADDITEM(AGM_EarBuds,12) - }; - }; - - class C_supplyCrate_F: ReammoBox_F { - class TransportItems { - MACRO_ADDITEM(AGM_EarBuds,12) - }; - }; - - class AGM_Box_Misc: Box_NATO_Support_F { - class TransportItems { - MACRO_ADDITEM(AGM_EarBuds,12) - }; - }; -}; - -class CfgSounds { - class AGM_EarRinging_Weak { - sound[] = {"\AGM_Hearing\sounds\agm_earringing_weak.wav",8,1.7}; - titles[] = {}; - }; - class AGM_EarRinging_Medium { - sound[] = {"\AGM_Hearing\sounds\agm_earringing_medium.wav",8,1.7}; - titles[] = {}; - }; - class AGM_EarRinging_Heavy { - sound[] = {"\AGM_Hearing\sounds\agm_earringing_heavy.wav",8,1.7}; - titles[] = {}; - }; -}; - -class CfgWeapons { - class AGM_ItemCore; - class InventoryItem_Base_F; - - class AGM_EarBuds: AGM_ItemCore { - displayName = "$STR_AGM_Hearing_Earbuds_Name"; - descriptionShort = "$STR_AGM_Hearing_Earbuds_Description"; - model = "\AGM_Hearing\agm_earplugs.p3d"; - picture = "\AGM_Hearing\UI\agm_earplugs_x_ca.paa"; - scope = 2; - class ItemInfo: InventoryItem_Base_F { - mass = 1; - }; - }; -}; - -// Setting up old stuff for A3 -class CfgAmmo { - class BulletBase; - class B_127x108_Ball: BulletBase { - audibleFire = 15; - }; -}; +#include "CfgAmmo.hpp" diff --git a/addons/hearing/functions/fn_addEarPlugs.sqf b/addons/hearing/functions/fn_addEarPlugs.sqf index 611c8c67df..58436b6223 100644 --- a/addons/hearing/functions/fn_addEarPlugs.sqf +++ b/addons/hearing/functions/fn_addEarPlugs.sqf @@ -2,13 +2,14 @@ * Author: commy2 * * Called on unit initialization. Adds earplugs if the unit is equipped with either a really loud primary weapon or a rocket launcher. - * + * * Argument: * 0: A Soldier (Object) - * + * * Return value: * Nothing */ +#include "\z\ace\addons\hearing\script_component.hpp" private ["_unit", "_launcher"]; @@ -18,7 +19,7 @@ _unit = _this select 0; _launcher = secondaryWeapon _unit; if (_launcher != "") exitWith { - _unit addItem "AGM_EarBuds"; + _unit addItem "ACE_EarBuds"; }; // otherwise add earplugs if the soldier has a big rifle @@ -31,5 +32,5 @@ if (isNil "_magazine") exitWith {}; _ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo"); if (getNumber (configFile >> "CfgAmmo" >> _ammo >> "audiblefire") > 8) then { - _unit addItem "AGM_EarBuds"; + _unit addItem "ACE_EarBuds"; }; diff --git a/addons/hearing/functions/fn_earRinging.sqf b/addons/hearing/functions/fn_earRinging.sqf index 84807bdda7..bb19679886 100644 --- a/addons/hearing/functions/fn_earRinging.sqf +++ b/addons/hearing/functions/fn_earRinging.sqf @@ -9,41 +9,42 @@ * Return Value: * none */ +#include "\z\ace\addons\hearing\script_component.hpp" private ["_unit", "_strength"]; _unit = _this select 0; _strength = _this select 1; -if (_unit getVariable ["AGM_hasEarPlugsin", false] || {_unit getVariable ["X39_MedSys_var_hasEarplugs", false]}) then { +if (_unit getVariable ["ACE_hasEarPlugsin", false]) then { _strength = _strength / 4; }; -AGM_NewStrength = AGM_NewStrength max _strength; +GVAR(newStrength) = GVAR(newStrength) max _strength; -if (missionNamespace getVariable ["AGM_isEarRingingPlaying", false]) exitWith {}; +if (missionNamespace getVariable [QGVAR(isEarRingingPlaying), false]) exitWith {}; if (_strength > 0.75) exitWith { - playSound "AGM_EarRinging_Heavy"; - AGM_isEarRingingPlaying = true; + playSound "ACE_EarRinging_Heavy"; + GVAR(isEarRingingPlaying) = true; 0 spawn { sleep 7; - AGM_isEarRingingPlaying = false; + GVAR(isEarRingingPlaying) = false; }; }; if (_strength > 0.5) exitWith { - playSound "AGM_EarRinging_Medium"; - AGM_isEarRingingPlaying = true; + playSound "ACE_EarRinging_Medium"; + GVAR(isEarRingingPlaying) = true; 0 spawn { sleep 5; - AGM_isEarRingingPlaying = false; + GVAR(isEarRingingPlaying) = false; }; }; if (_strength > 0.2) exitWith { - playSound "AGM_EarRinging_Weak"; - AGM_isEarRingingPlaying = true; + playSound "ACE_EarRinging_Weak"; + GVAR(isEarRingingPlaying) = true; 0 spawn { sleep 3; - AGM_isEarRingingPlaying = false; + GVAR(isEarRingingPlaying) = false; }; }; diff --git a/addons/hearing/functions/fn_explosionNear.sqf b/addons/hearing/functions/fn_explosionNear.sqf index 4540a98bf9..0808e959fa 100644 --- a/addons/hearing/functions/fn_explosionNear.sqf +++ b/addons/hearing/functions/fn_explosionNear.sqf @@ -9,6 +9,7 @@ * Return Value: * none */ +#include "\z\ace\addons\hearing\script_component.hpp" private ["_unit", "_damage", "_strength"]; @@ -20,5 +21,5 @@ if (_strength < 0.01) exitWith {}; [_unit, _strength] spawn { sleep 0.2; - _this call AGM_Hearing_fnc_earRinging; + _this call FUNC(earRinging); }; diff --git a/addons/hearing/functions/fn_firedNear.sqf b/addons/hearing/functions/fn_firedNear.sqf index 45fecbd43d..e5ed0465df 100644 --- a/addons/hearing/functions/fn_firedNear.sqf +++ b/addons/hearing/functions/fn_firedNear.sqf @@ -9,6 +9,7 @@ * Return Value: * none */ +#include "\z\ace\addons\hearing\script_component.hpp" private ["_unit", "_firer", "_distance", "_weapon", "_muzzle", "_mode", "_ammo", "_silencer", "_audibleFireCoef", "_loudness", "_strength"]; @@ -21,7 +22,7 @@ _mode = _this select 5; _ammo = _this select 6; if (_weapon in ["Throw", "Put"]) exitWith {}; -if (_unit != vehicle _unit && {!([_unit] call AGM_Core_fnc_isTurnedOut)}) exitWith {}; +if (_unit != vehicle _unit && {!([_unit] call EFUNC(common,isTurnedOut))}) exitWith {}; _silencer = switch (_weapon) do { case (primaryWeapon _unit) : {primaryWeaponItems _unit select 0}; @@ -47,5 +48,5 @@ if (_strength < 0.01) exitWith {}; [_unit, _strength] spawn { sleep 0.2; - _this call AGM_Hearing_fnc_earRinging; + _this call FUNC(earRinging); }; diff --git a/addons/hearing/functions/fn_hasEarPlugsIn.sqf b/addons/hearing/functions/fn_hasEarPlugsIn.sqf index 36eadae44d..7dccd83865 100644 --- a/addons/hearing/functions/fn_hasEarPlugsIn.sqf +++ b/addons/hearing/functions/fn_hasEarPlugsIn.sqf @@ -2,16 +2,17 @@ * Author: commy2 * * Check if the unit has earplugs put in. - * + * * Argument: * A soldier (Object) - * + * * Return value: * Boolean (Bool) */ +#include "\z\ace\addons\hearing\script_component.hpp" private "_unit"; _unit = _this select 0; -_unit getVariable ["AGM_hasEarPlugsin", false] || {_unit getVariable ["X39_MedSys_var_hasEarplugs", false]} +_unit getVariable ["ACE_hasEarPlugsin", false] diff --git a/addons/hearing/functions/fn_putInEarplugs.sqf b/addons/hearing/functions/fn_putInEarplugs.sqf index df7aa7e02a..20d521d5e2 100644 --- a/addons/hearing/functions/fn_putInEarplugs.sqf +++ b/addons/hearing/functions/fn_putInEarplugs.sqf @@ -10,6 +10,7 @@ * Return Value: * none */ +#include "\z\ace\addons\hearing\script_component.hpp" private "_player"; @@ -20,7 +21,7 @@ _player removeItem "AGM_EarBuds"; _player setVariable ["AGM_hasEarPlugsIn", true, true]; -[localize "STR_AGM_Hearing_Earbuds_Are_On"] call AGM_Core_fnc_displayTextStructured; +[localize "STR_AGM_Hearing_Earbuds_Are_On"] call EFUNC(common,displayTextStructured); /*// No Ear Buds in inventory, telling user -[localize "STR_AGM_Hearing_NoBuds"] call AGM_Core_fnc_displayTextStructured;*/ +[localize "STR_AGM_Hearing_NoBuds"] call EFUNC(common,displayTextStructured);*/ diff --git a/addons/hearing/functions/fn_removeEarplugs.sqf b/addons/hearing/functions/fn_removeEarplugs.sqf index 37ea1acfd4..1c125fd12f 100644 --- a/addons/hearing/functions/fn_removeEarplugs.sqf +++ b/addons/hearing/functions/fn_removeEarplugs.sqf @@ -10,18 +10,19 @@ * Return Value: * none */ +#include "\z\ace\addons\hearing\script_component.hpp" private "_player"; _player = _this select 0; -if !(_player canAdd "AGM_EarBuds") exitWith { // inventory full - [localize "STR_AGM_Hearing_Inventory_Full"] call AGM_Core_fnc_displayTextStructured; +if !(_player canAdd "ACE_EarBuds") exitWith { // inventory full + [localize "STR_ACE_Hearing_Inventory_Full"] call EFUNC(common,displayTextStructured); }; // Buds already in and removing them. -_player addItem "AGM_EarBuds"; +_player addItem "ACE_EarBuds"; -_player setVariable ["AGM_hasEarPlugsIn", false, true]; +_player setVariable ["ACE_hasEarPlugsIn", false, true]; -[localize "STR_AGM_Hearing_Earbuds_Are_Off"] call AGM_Core_fnc_displayTextStructured; +[localize "STR_ACE_Hearing_Earbuds_Are_Off"] call EFUNC(common,displayTextStructured); diff --git a/addons/hearing/sounds/agm_earringing_heavy.wav b/addons/hearing/sounds/ace_earringing_heavy.wav similarity index 100% rename from addons/hearing/sounds/agm_earringing_heavy.wav rename to addons/hearing/sounds/ace_earringing_heavy.wav diff --git a/addons/hearing/sounds/agm_earringing_medium.wav b/addons/hearing/sounds/ace_earringing_medium.wav similarity index 100% rename from addons/hearing/sounds/agm_earringing_medium.wav rename to addons/hearing/sounds/ace_earringing_medium.wav diff --git a/addons/hearing/sounds/agm_earringing_weak.wav b/addons/hearing/sounds/ace_earringing_weak.wav similarity index 100% rename from addons/hearing/sounds/agm_earringing_weak.wav rename to addons/hearing/sounds/ace_earringing_weak.wav