ACE3/addons/common/functions/fnc_setVolume.sqf

49 lines
1000 B
Plaintext
Raw Normal View History

#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
*
* 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
*/
#define MUTED_LEVEL 0.2
2015-01-16 23:21:47 +00:00
#define NORMAL_LEVEL 1
#define NO_SOUND 0
2015-01-16 23:21: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
_unit setVariable ["tf_globalVolume", NORMAL_LEVEL];
2015-01-16 23:21:47 +00:00
2015-01-18 19:09:19 +00:00
// ACRE2
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
_unit setVariable ["tf_globalVolume", MUTED_LEVEL];
2015-01-16 23:21:47 +00:00
2015-01-18 19:09:19 +00:00
// ACRE2
if (!isNil "acre_api_fnc_setGlobalVolume") then { [MUTED_LEVEL^0.33] call acre_api_fnc_setGlobalVolume; };
2015-01-16 23:21:47 +00:00
};