diff --git a/addons/hearing/ACE_Settings.hpp b/addons/hearing/ACE_Settings.hpp
index 13f445a987..047a84d9c9 100644
--- a/addons/hearing/ACE_Settings.hpp
+++ b/addons/hearing/ACE_Settings.hpp
@@ -2,8 +2,8 @@ class ACE_Settings {
class GVAR(EnableCombatDeafness) {
value = 1;
typeName = "BOOL";
- displayName = CSTRING(CombatDeafness_DisplayName);
- description = CSTRING(CombatDeafness_Description);
+ displayName = CSTRING(EnableCombatDeafness_DisplayName);
+ description = CSTRING(EnableCombatDeafness_Description);
};
class GVAR(EarplugsVolume) {
value = 0.5;
@@ -17,7 +17,8 @@ class ACE_Settings {
value = 0;
typeName = "BOOL";
isClientSettable = 1;
- displayName = CSTRING(DisableEarRinging);
+ displayName = CSTRING(DisableEarRinging_DisplayName);
+ description = CSTRING(DisableEarRinging_Description);
};
class GVAR(enabledForZeusUnits) {
value = 1;
diff --git a/addons/hearing/CfgSounds.hpp b/addons/hearing/CfgSounds.hpp
index 2d757041be..7afdae88cb 100644
--- a/addons/hearing/CfgSounds.hpp
+++ b/addons/hearing/CfgSounds.hpp
@@ -11,9 +11,21 @@ class CfgSounds {
sound[] = {QUOTE(PATHTOF(sounds\ACE_earringing_heavy.wav)),8,1.7};
titles[] = {};
};
- class ACE_Combat_Deafness {
+ class ACE_Combat_Deafness_Heavy {
+ sound[] = {QUOTE(PATHTOF(sounds\deafness.ogg)),8,1};
+ titles[] = {};
+ };
+ class ACE_Combat_Deafness_Medium {
sound[] = {QUOTE(PATHTOF(sounds\deafness.ogg)),3,1};
titles[] = {};
+ };
+ class ACE_Combat_Deafness_Heavy_NoRing {
+ sound[] = {QUOTE(PATHTOF(sounds\deafness_noring.ogg)),8,1};
+ titles[] = {};
+ };
+ class ACE_Combat_Deafness_Medium_NoRing {
+ sound[] = {QUOTE(PATHTOF(sounds\deafness_noring.ogg)),3,1};
+ titles[] = {};
};
class ACE_Ring_Backblast {
sound[] = {QUOTE(PATHTOF(sounds\backblast_ring.ogg)),1,1};
diff --git a/addons/hearing/CfgVehicles.hpp b/addons/hearing/CfgVehicles.hpp
index 3873377052..17dec1641b 100644
--- a/addons/hearing/CfgVehicles.hpp
+++ b/addons/hearing/CfgVehicles.hpp
@@ -103,13 +103,14 @@ class CfgVehicles {
icon = PATHTOF(UI\Icon_Module_Hearing_ca.paa);
class Arguments {
class EnableCombatDeafness {
- displayName = CSTRING(CombatDeafness_DisplayName);
- description = CSTRING(CombatDeafness_Description);
+ displayName = CSTRING(EnableCombatDeafness_DisplayName);
+ description = CSTRING(EnableCombatDeafness_Description);
typeName = "BOOL";
defaultValue = 1;
};
class DisableEarRinging {
- displayName = CSTRING(DisableEarRinging);
+ displayName = CSTRING(DisableEarRinging_DisplayName);
+ description = CSTRING(DisableEarRinging_Description);
typeName = "NUMBER";
class values {
class DoNotForce {
diff --git a/addons/hearing/XEH_postInit.sqf b/addons/hearing/XEH_postInit.sqf
index 4ff2f84b6c..eb62c37bf4 100644
--- a/addons/hearing/XEH_postInit.sqf
+++ b/addons/hearing/XEH_postInit.sqf
@@ -9,12 +9,7 @@ GVAR(deafnessDV) = 0;
GVAR(deafnessPrior) = 0;
GVAR(volume) = 1;
GVAR(playerVehAttenuation) = 1;
-
-GVAR(beep) = false;
-GVAR(beep2) = false;
-GVAR(time2) = 0;
GVAR(time3) = 0;
-GVAR(time4) = 0;
["SettingsInitialized", {
// Spawn volume updating process
@@ -30,10 +25,5 @@ GVAR(time4) = 0;
GVAR(deafnessDV) = 0;
GVAR(deafnessPrior) = 0;
ACE_player setVariable [QGVAR(deaf), false];
-
- GVAR(beep) = false;
- GVAR(beep2) = false;
- GVAR(time2) = 0;
GVAR(time3) = 0;
- GVAR(time4) = 0;
}] call EFUNC(common,addEventhandler);
diff --git a/addons/hearing/functions/fnc_explosionNear.sqf b/addons/hearing/functions/fnc_explosionNear.sqf
index 7e4d0b9bfc..338d9c26e3 100644
--- a/addons/hearing/functions/fnc_explosionNear.sqf
+++ b/addons/hearing/functions/fnc_explosionNear.sqf
@@ -16,8 +16,8 @@
*/
#include "script_component.hpp"
-//Only run if deafness or ear ringing is enabled:
-if ((!GVAR(enableCombatDeafness)) && GVAR(DisableEarRinging)) exitWith {};
+// Only run if combat deafness is enabled
+if (!GVAR(EnableCombatDeafness)) exitWith {};
params ["_unit", "_damage"];
@@ -29,4 +29,5 @@ private ["_strength"];
_strength = (0 max _damage) * 30;
if (_strength < 0.01) exitWith {};
-[{_this call FUNC(earRinging)}, [_unit, _strength], 0.2] call EFUNC(common,waitAndExecute);
+// Call inmediately, as it will get pick up later anyway by the update thread
+[ACE_player, _strength] call FUNC(earRinging);
diff --git a/addons/hearing/functions/fnc_firedNear.sqf b/addons/hearing/functions/fnc_firedNear.sqf
index 31f693bafd..5b5b4db181 100644
--- a/addons/hearing/functions/fnc_firedNear.sqf
+++ b/addons/hearing/functions/fnc_firedNear.sqf
@@ -22,8 +22,8 @@
*/
#include "script_component.hpp"
-//Only run if deafness or ear ringing is enabled:
-if ((!GVAR(enableCombatDeafness)) && GVAR(DisableEarRinging)) exitWith {};
+// Only run if combat deafness is enabled
+if (!GVAR(EnableCombatDeafness)) exitWith {};
params ["_object", "_firer", "_distance", "_weapon", "", "", "_ammo"];
@@ -97,4 +97,5 @@ TRACE_1("result",_strength);
if (_strength < 0.01) exitWith {};
-[{_this call FUNC(earRinging)}, [ACE_player, _strength], 0.2] call EFUNC(common,waitAndExecute);
+// Call inmediately, as it will get pick up later anyway by the update thread
+[ACE_player, _strength] call FUNC(earRinging);
diff --git a/addons/hearing/functions/fnc_moduleHearing.sqf b/addons/hearing/functions/fnc_moduleHearing.sqf
index 35836ddb0c..053bcb6d7f 100644
--- a/addons/hearing/functions/fnc_moduleHearing.sqf
+++ b/addons/hearing/functions/fnc_moduleHearing.sqf
@@ -12,13 +12,12 @@
params ["_logic"];
-[_logic, QGVAR(enableCombatDeafness), "EnableCombatDeafness"] call EFUNC(common,readSettingFromModule);
+[_logic, QGVAR(EnableCombatDeafness), "EnableCombatDeafness"] call EFUNC(common,readSettingFromModule);
// Do Not Force - read module setting only non-default is set due to using SCALAR
if ((_logic getVariable "DisableEarRinging") != -1) then {
[_logic, QGVAR(DisableEarRinging), "DisableEarRinging"] call EFUNC(common,readSettingFromModule);
};
-
[_logic, QGVAR(enabledForZeusUnits), "enabledForZeusUnits"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(autoAddEarplugsToUnits), "autoAddEarplugsToUnits"] call EFUNC(common,readSettingFromModule);
ACE_LOGINFO("Hearing Module Initialized.");
diff --git a/addons/hearing/functions/fnc_updateVolume.sqf b/addons/hearing/functions/fnc_updateVolume.sqf
index 5492dcd080..45e38aece9 100644
--- a/addons/hearing/functions/fnc_updateVolume.sqf
+++ b/addons/hearing/functions/fnc_updateVolume.sqf
@@ -16,54 +16,32 @@
*/
#include "script_component.hpp"
-//Only run if deafness or ear ringing is enabled:
-if ((!GVAR(enableCombatDeafness)) && GVAR(DisableEarRinging)) exitWith {};
+// Only run if combat deafness is enabled
+if (!GVAR(EnableCombatDeafness)) exitWith {};
(_this select 0) params ["_justUpdateVolume"];
GVAR(deafnessDV) = (GVAR(deafnessDV) min 20) max 0;
-GVAR(volume) = (1 - (GVAR(deafnessDV) / 20)) max 0;
+GVAR(volume) = (1 - (GVAR(deafnessDV) / 20)) max 0.05;
+player sideChat format ["Vol: %1, Def: %2, DeltaDef: %3", GVAR(volume), GVAR(deafnessDV), GVAR(deafnessDV) - GVAR(deafnessPrior)];
if (!_justUpdateVolume) then {
- //If we got a big increase in the last second:
- if ((GVAR(deafnessDV) - GVAR(deafnessPrior)) > 2) then {
- if (ACE_time > GVAR(time3)) then {
- GVAR(beep2) = false;
- };
- if ((!GVAR(DisableEarRinging)) && {!GVAR(beep2)}) then {
- playSound "ACE_Combat_Deafness";
- GVAR(beep2) = true;
- GVAR(time3) = ACE_time + 5;
+ // Ring if we got a big increase in the last second or enough accumulated damage
+ if (GVAR(deafnessDV) - GVAR(deafnessPrior) > 1 ||
+ GVAR(deafnessDV) > 10) then {
+
+ if (ACE_time - GVAR(time3) < 3) exitWith {};
+ GVAR(time3) = ACE_time;
+
+ if (GVAR(deafnessDV) > 19.75) then {
+ playSound (["ACE_Combat_Deafness_Heavy", "ACE_Combat_Deafness_Heavy_NoRing"] select GVAR(DisableEarRinging));
+ } else {
+ playSound (["ACE_Combat_Deafness_Medium", "ACE_Combat_Deafness_Medium_NoRing"] select GVAR(DisableEarRinging));
};
};
-
GVAR(deafnessPrior) = GVAR(deafnessDV);
- if (GVAR(deafnessDV) > 19.75) then {
- ACE_player setVariable [QGVAR(deaf), true];
- if ((!GVAR(DisableEarRinging)) && {ACE_time > GVAR(time4)}) then {
- playSound "ACE_Combat_Deafness";
- GVAR(beep2) = true;
- GVAR(time3) = ACE_time + 10;
- GVAR(time4) = ACE_time + 30;
- };
- } else {
- ACE_player setVariable [QGVAR(deaf), false];
- };
-
- if (GVAR(deafnessDV) > 10) then {
- //check if the ringing is already being played
- if (ACE_time > GVAR(time2)) then {
- GVAR(beep) = false;
- };
- if ((!GVAR(DisableEarRinging)) && {!GVAR(beep)}) then {
- playSound "ACE_Ring_Backblast";
- GVAR(time2) = ACE_time + 22;
- GVAR(beep) = true;
- };
- };
-
// Hearing takes longer to return to normal after it hits rock bottom
GVAR(deafnessDV) = (GVAR(deafnessDV) - (0.5 * (GVAR(volume) max 0.1))) max 0;
};
diff --git a/addons/hearing/sounds/deafness_noring.ogg b/addons/hearing/sounds/deafness_noring.ogg
new file mode 100644
index 0000000000..65977cb5a1
Binary files /dev/null and b/addons/hearing/sounds/deafness_noring.ogg differ
diff --git a/addons/hearing/stringtable.xml b/addons/hearing/stringtable.xml
index 7dbf70f7ed..85753ffbbd 100644
--- a/addons/hearing/stringtable.xml
+++ b/addons/hearing/stringtable.xml
@@ -97,7 +97,7 @@
Nincs több hely
Нет места в инвентаре
-
+
Disable ear ringing
Désactiver le bourdonnement
Desactivar zumbido de oídos
@@ -108,6 +108,8 @@
Fülcsengés letiltása
Disabilita i fischi nelle orecchie
Desabilitar zumbido de ouvidos
+
+ Remove tinnitus effect when the player takes hearing damage
Hearing
@@ -120,10 +122,10 @@
Hallás
Слух
-
- Combat Deafness
+
+ Enable Combat Deafness
Wł. głuchotę bojową
- ¿Habilitar sordera de combate?
+ Habilitar sordera de combate
Aktiviere Taubheit im Gefecht?
Povolit ztrátu sluchu?
Ativar surdez em combate?
@@ -131,7 +133,7 @@
Harci süketség engedélyezése?
Оглушение
-
+
Reduces the hearing ability as the player takes hearing damage
Możliwość chwilowej utraty słuchu przy głośnych wystrzałach i jednoczesnym braku włożonych stoperów
Habilita la sordera de combate