ACE3/addons/common/functions/fnc_setVolume_f.sqf

47 lines
1.2 KiB
Plaintext
Raw Normal View History

2015-01-16 23:21:47 +00:00
/**
* fn_setVolume_f.sqf
* @Descr: Sets the volume of the game, including third party radio modifications such as TFAR and ACRE.
* @Author: Glowbal
*
* @Arguments: [setVolume BOOL]
* @Return: void
* @PublicAPI: true
*/
#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
private ["_setVolume"];
_setVolume = [_this, 0, false, [false]] call BIS_fnc_Param;
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
player setVariable ["acre_sys_core_globalVolume", NORMAL_LEVEL];
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
player setVariable ["acre_sys_core_globalVolume", MUTED_LEVEL];
player setVariable ["acre_sys_core_isDisabled", true, true];
2015-01-16 23:21:47 +00:00
};