2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-09-19 18:55:35 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Handle set volume calls. Will use the lowest available volume setting.
|
2015-01-16 23:21:47 +00:00
|
|
|
*
|
2015-09-19 18:55:35 +00:00
|
|
|
* Arguments:
|
2018-04-10 01:55:28 +00:00
|
|
|
* 0: ID <STRING>
|
|
|
|
* 1: Settings <NUMBER>
|
|
|
|
* 2: Add (true) or remove (false) <BOOL> (default: true)
|
2015-09-19 18:55:35 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
2016-05-20 16:23:14 +00:00
|
|
|
* Example:
|
|
|
|
* ["earwax", 0.5, true] call ace_common_fnc_setHearingCapability
|
2015-09-20 13:52:40 +00:00
|
|
|
*
|
2016-05-20 16:23:14 +00:00
|
|
|
* Public: Yes
|
2015-01-16 23:21:47 +00:00
|
|
|
*/
|
|
|
|
|
2016-05-20 16:23:14 +00:00
|
|
|
params ["_id", "_setting", ["_add", true]];
|
2015-01-16 23:21:47 +00:00
|
|
|
|
2015-12-14 12:08:19 +00:00
|
|
|
private _exists = false;
|
2016-05-20 16:23:14 +00:00
|
|
|
private _lowestVolume = 1;
|
2015-01-16 23:21:47 +00:00
|
|
|
|
2016-05-20 16:23:14 +00:00
|
|
|
GVAR(setHearingCapabilityMap) = GVAR(setHearingCapabilityMap) select {
|
|
|
|
_x params ["_xID", "_xSetting"];
|
|
|
|
if (_id == _xID) then {
|
2015-01-18 19:09:19 +00:00
|
|
|
_exists = true;
|
|
|
|
if (_add) then {
|
2016-05-20 16:23:14 +00:00
|
|
|
_x set [1, _setting];
|
|
|
|
_lowestVolume = _lowestVolume min _setting;
|
|
|
|
true
|
2015-01-18 19:09:19 +00:00
|
|
|
} else {
|
2016-05-20 16:23:14 +00:00
|
|
|
false
|
2015-01-18 19:09:19 +00:00
|
|
|
};
|
2016-05-20 16:23:14 +00:00
|
|
|
} else {
|
|
|
|
_lowestVolume = _lowestVolume min _xSetting;
|
|
|
|
true
|
2015-01-18 19:09:19 +00:00
|
|
|
};
|
2016-05-20 16:23:14 +00:00
|
|
|
};
|
2015-01-16 23:21:47 +00:00
|
|
|
|
|
|
|
if (!_exists && _add) then {
|
2016-05-20 16:23:14 +00:00
|
|
|
_lowestVolume = _lowestVolume min _setting;
|
|
|
|
GVAR(setHearingCapabilityMap) pushBack [_id, _setting];
|
2015-01-16 23:21:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// in game sounds
|
|
|
|
0 fadeSound _lowestVolume;
|
|
|
|
0 fadeRadio _lowestVolume;
|
2018-01-02 13:57:19 +00:00
|
|
|
if (GVAR(allowFadeMusic)) then {
|
2017-06-29 14:04:32 +00:00
|
|
|
0 fadeMusic _lowestVolume;
|
|
|
|
};
|
2015-01-16 23:21:47 +00:00
|
|
|
|
|
|
|
// Set Radio mod variables.
|
2016-05-07 20:27:33 +00:00
|
|
|
ACE_player setVariable ["tf_globalVolume", _lowestVolume];
|
2015-04-14 21:58:19 +00:00
|
|
|
if (!isNil "acre_api_fnc_setGlobalVolume") then { [_lowestVolume^0.33] call acre_api_fnc_setGlobalVolume; };
|