mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Add function to allow using playSound3D on CfgSounds classes
This commit is contained in:
parent
30532983a1
commit
34654fffb7
@ -127,6 +127,7 @@ PREP(numberToString);
|
||||
PREP(onAnswerRequest);
|
||||
PREP(owned);
|
||||
PREP(parseList);
|
||||
PREP(playConfigSound3D);
|
||||
PREP(player);
|
||||
PREP(playerSide);
|
||||
PREP(positionToASL);
|
||||
|
35
addons/common/functions/fnc_playConfigSound3D.sqf
Normal file
35
addons/common/functions/fnc_playConfigSound3D.sqf
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
* Plays a sound defined in CfgSounds using playSound3D, with global effect
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Sound class <STRING>
|
||||
* 1: Position ASL <ARRAY>
|
||||
* 2: Volume <NUMBER>
|
||||
* 3: Distance <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_soundClass", "_posASL", "_volume", "_distance"];
|
||||
|
||||
private _cfgSound = configFile >> "CfgSounds" >> _soundClass;
|
||||
|
||||
if (!isClass _cfgSound) exitWith {
|
||||
ACE_LOGERROR_1("CfgSounds class [%1] does not exist", _soundClass);
|
||||
};
|
||||
|
||||
private _args = getArray (_cfgSound >> "sound");
|
||||
TRACE_1("playConfigSound3D args", _args);
|
||||
private _pitch = (_args select 2);
|
||||
// Strip the first \ from the filename
|
||||
private _fileName = _args select 0;
|
||||
_fileName = _fileName select [1, count _fileName - 1];
|
||||
TRACE_1("playConfigSound3D filename", _fileName);
|
||||
|
||||
playSound3D [_fileName, objNull, false, _posASL, _volume, _pitch, _distance];
|
Loading…
Reference in New Issue
Block a user