From 2f844060ec4e00c718a8812c4b8ff1c2d369a8de Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Wed, 20 Jul 2016 17:36:40 -0400 Subject: [PATCH] Add handling of other fadeSound events in player_toggleMuteSound Fixes icon staying up after fadeSound to 1 by unconscious and low blood events. --- SQF/dayz_code/compile/fn_buildCamera.sqf | 2 ++ SQF/dayz_code/compile/fn_unconscious.sqf | 1 + SQF/dayz_code/compile/player_death.sqf | 1 + SQF/dayz_code/compile/player_toggleSoundMute.sqf | 2 +- SQF/dayz_code/medical/init_medical.sqf | 5 ++++- SQF/dayz_code/medical/setup_functions_med.sqf | 6 +++++- 6 files changed, 14 insertions(+), 3 deletions(-) diff --git a/SQF/dayz_code/compile/fn_buildCamera.sqf b/SQF/dayz_code/compile/fn_buildCamera.sqf index e1c327aac..e39773714 100644 --- a/SQF/dayz_code/compile/fn_buildCamera.sqf +++ b/SQF/dayz_code/compile/fn_buildCamera.sqf @@ -1,5 +1,7 @@ if (0 != count Dayz_constructionContext) then { + if (dayz_soundMuted) then {call player_toggleSoundMute;}; // disable before fadeSound + if (!(Dayz_constructionContext select 3)) then { _ghost = Dayz_constructionContext select 0; if (abs(([_ghost, player] call BIS_fnc_distance2D) - (1 + (sizeOf (typeOf _ghost)) * 0.5)) < 1) then { diff --git a/SQF/dayz_code/compile/fn_unconscious.sqf b/SQF/dayz_code/compile/fn_unconscious.sqf index fc5c748db..b050de17c 100644 --- a/SQF/dayz_code/compile/fn_unconscious.sqf +++ b/SQF/dayz_code/compile/fn_unconscious.sqf @@ -27,6 +27,7 @@ autoRunActive = false; player playAction "CanNotMove"; "dynamicBlur" ppEffectEnable true;"dynamicBlur" ppEffectAdjust [2]; "dynamicBlur" ppEffectCommit 0; "colorCorrections" ppEffectEnable true;"colorCorrections" ppEffectEnable true;"colorCorrections" ppEffectAdjust [1, 1, 0, [1, 1, 1, 0.0], [1, 1, 1, 0.1], [1, 1, 1, 0.0]];"colorCorrections" ppEffectCommit 0; +if (dayz_soundMuted) then {call player_toggleSoundMute;}; // hide icon before fadeSound 0 fadeSound 0.05; while { (diag_tickTime - _start) < _timeout and r_player_unconscious and alive player } do { diff --git a/SQF/dayz_code/compile/player_death.sqf b/SQF/dayz_code/compile/player_death.sqf index 7879f47b0..e58bad2dd 100644 --- a/SQF/dayz_code/compile/player_death.sqf +++ b/SQF/dayz_code/compile/player_death.sqf @@ -56,6 +56,7 @@ publicVariableServer "PVDZ_plr_Death"; _id = [player,20,true,getPosATL player] call player_alertZombies; uiSleep 0.5; player setDamage 1; +if (dayz_soundMuted) then {call player_toggleSoundMute;}; // hide icon before fadeSound 0.1 fadeSound 0; player setVariable ["NORRN_unconscious", false, true]; diff --git a/SQF/dayz_code/compile/player_toggleSoundMute.sqf b/SQF/dayz_code/compile/player_toggleSoundMute.sqf index 99c395f51..8f2398b61 100644 --- a/SQF/dayz_code/compile/player_toggleSoundMute.sqf +++ b/SQF/dayz_code/compile/player_toggleSoundMute.sqf @@ -9,7 +9,7 @@ if (!isNil "_display") then { if (dayz_soundMuted) then { dayz_soundMuted = false; - 1 fadeSound 1; + if (!r_player_unconscious && !deathHandled && !r_pitchWhine) then {1 fadeSound 1;}; _background ctrlShow false; _icon ctrlShow false; } else { diff --git a/SQF/dayz_code/medical/init_medical.sqf b/SQF/dayz_code/medical/init_medical.sqf index f36fc086e..9cf34f47a 100644 --- a/SQF/dayz_code/medical/init_medical.sqf +++ b/SQF/dayz_code/medical/init_medical.sqf @@ -8,7 +8,10 @@ while {1==1} do { playSound "heartbeat_1"; addCamShake [2, 0.5, 25]; if (r_player_lowblood) then { - 0 fadeSound ((r_player_blood/r_player_bloodTotal) + 0.5); + if (!dayz_soundMuted) then { + // muted is 0.25, so this is always higher + 0 fadeSound ((r_player_blood/r_player_bloodTotal) + 0.5); + }; "dynamicBlur" ppEffectEnable true;"dynamicBlur" ppEffectAdjust [4]; "dynamicBlur" ppEffectCommit 0.2; }; uiSleep 0.5; diff --git a/SQF/dayz_code/medical/setup_functions_med.sqf b/SQF/dayz_code/medical/setup_functions_med.sqf index 3131b5858..27dd63255 100644 --- a/SQF/dayz_code/medical/setup_functions_med.sqf +++ b/SQF/dayz_code/medical/setup_functions_med.sqf @@ -19,7 +19,11 @@ fnc_usec_pitchWhine = { playMusic ["PitchWhine",0]; if (!r_player_unconscious) then { _visual call fnc_usec_bulletHit; - _sound fadeSound 1; + if (dayz_soundMuted) then { + _sound fadeSound 0.25; + } else { + _sound fadeSound 1; + }; }; r_pitchWhine = true; [] spawn {