ACE3/addons/common/functions/fnc_setVolume.sqf

53 lines
1.3 KiB
Plaintext
Raw Normal View History

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
*/
#include "script_component.hpp"
#define MUTED_LEVEL 0.2
#define NORMAL_LEVEL 1
2015-01-18 19:09:19 +00:00
#define NO_SOUND 0
2015-01-16 23:21:47 +00:00
2015-09-19 22:55:58 +00:00
params [["_setVolume", false]];
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
player setVariable ["tf_voiceVolume", NORMAL_LEVEL, true];
player setVariable ["tf_globalVolume", NORMAL_LEVEL];
player setVariable ["tf_unable_to_use_radio", false];
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; };
player setVariable ["acre_sys_core_isDisabled", false, true];
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
player setVariable ["tf_voiceVolume", NO_SOUND, true];
player setVariable ["tf_globalVolume", MUTED_LEVEL];
player setVariable ["tf_unable_to_use_radio", true];
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-18 19:09:19 +00:00
player setVariable ["acre_sys_core_isDisabled", true, true];
2015-01-16 23:21:47 +00:00
};