2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-09-19 22:55:58 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Sets the volume of the game, including third party radio modifications such as TFAR and ACRE.
|
2015-01-16 23:21:47 +00:00
|
|
|
*
|
2015-09-19 22:55:58 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: setVolume (default: false) <BOOL>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* [true] call ace_common_fnc_setVolume
|
|
|
|
*
|
2015-09-19 22:55:58 +00:00
|
|
|
* Public: Yes
|
|
|
|
*
|
|
|
|
* Note: Uses player
|
2015-01-16 23:21:47 +00:00
|
|
|
*/
|
|
|
|
|
2020-02-22 20:24:47 +00:00
|
|
|
#define MUTED_LEVEL 0.2
|
2015-01-16 23:21:47 +00:00
|
|
|
#define NORMAL_LEVEL 1
|
2020-02-22 20:24:47 +00:00
|
|
|
#define NO_SOUND 0
|
2015-01-16 23:21:47 +00:00
|
|
|
|
2020-02-22 20:24:47 +00:00
|
|
|
params [
|
|
|
|
["_setVolume", false],
|
|
|
|
["_unit", player]
|
|
|
|
];
|
2015-01-16 23:21:47 +00:00
|
|
|
|
|
|
|
if (_setVolume) then {
|
2015-01-18 19:09:19 +00:00
|
|
|
// Vanilla Game
|
|
|
|
2 fadeSound NORMAL_LEVEL;
|
2015-01-16 23:21:47 +00:00
|
|
|
|
2015-01-18 19:09:19 +00:00
|
|
|
// TFAR
|
2020-02-22 20:24:47 +00:00
|
|
|
_unit setVariable ["tf_globalVolume", NORMAL_LEVEL];
|
2015-01-16 23:21:47 +00:00
|
|
|
|
2015-01-18 19:09:19 +00:00
|
|
|
// ACRE2
|
2015-04-14 21:45:21 +00:00
|
|
|
if (!isNil "acre_api_fnc_setGlobalVolume") then { [NORMAL_LEVEL^0.33] call acre_api_fnc_setGlobalVolume; };
|
2015-01-16 23:21:47 +00:00
|
|
|
|
|
|
|
} else {
|
2015-01-18 19:09:19 +00:00
|
|
|
// Vanilla Game
|
|
|
|
2 fadeSound MUTED_LEVEL;
|
2015-01-16 23:21:47 +00:00
|
|
|
|
2015-01-18 19:09:19 +00:00
|
|
|
// TFAR
|
2020-02-22 20:24:47 +00:00
|
|
|
_unit setVariable ["tf_globalVolume", MUTED_LEVEL];
|
2015-01-16 23:21:47 +00:00
|
|
|
|
2015-01-18 19:09:19 +00:00
|
|
|
// ACRE2
|
2015-04-14 21:45:21 +00:00
|
|
|
if (!isNil "acre_api_fnc_setGlobalVolume") then { [MUTED_LEVEL^0.33] call acre_api_fnc_setGlobalVolume; };
|
2015-01-16 23:21:47 +00:00
|
|
|
};
|