Merge pull request #345 from lioncash/desig

CSfxManager: Make use of designated initializers
This commit is contained in:
LC 2020-07-31 23:29:34 -04:00 committed by GitHub
commit b158659d9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 22 deletions

View File

@ -393,33 +393,35 @@ void CSfxManager::UpdateEmitter(const CSfxHandle& handle, const zeus::CVector3f&
CSfxHandle CSfxManager::AddEmitter(u16 id, const zeus::CVector3f& pos, const zeus::CVector3f& dir, bool useAcoustics, CSfxHandle CSfxManager::AddEmitter(u16 id, const zeus::CVector3f& pos, const zeus::CVector3f& dir, bool useAcoustics,
bool looped, s16 prio, s32 areaId) { bool looped, s16 prio, s32 areaId) {
CAudioSys::C3DEmitterParmData parmData; const CAudioSys::C3DEmitterParmData parmData{
parmData.x0_pos = pos; .x0_pos = pos,
parmData.xc_dir = dir; .xc_dir = dir,
parmData.x18_maxDist = 150.f; .x18_maxDist = 150.f,
parmData.x1c_distComp = 0.1f; .x1c_distComp = 0.1f,
parmData.x20_flags = 1; // Continuous parameter update .x20_flags = 1, // Continuous parameter update
parmData.x24_sfxId = id; .x24_sfxId = id,
parmData.x26_maxVol = 1.f; .x26_maxVol = 1.f,
parmData.x27_minVol = 0.165f; .x27_minVol = 0.165f,
parmData.x28_important = false; .x28_important = false,
parmData.x29_prio = 0x7f; .x29_prio = 0x7f,
};
return AddEmitter(parmData, useAcoustics, prio, looped, areaId); return AddEmitter(parmData, useAcoustics, prio, looped, areaId);
} }
CSfxHandle CSfxManager::AddEmitter(u16 id, const zeus::CVector3f& pos, const zeus::CVector3f& dir, float vol, CSfxHandle CSfxManager::AddEmitter(u16 id, const zeus::CVector3f& pos, const zeus::CVector3f& dir, float vol,
bool useAcoustics, bool looped, s16 prio, s32 areaId) { bool useAcoustics, bool looped, s16 prio, s32 areaId) {
CAudioSys::C3DEmitterParmData parmData; const CAudioSys::C3DEmitterParmData parmData{
parmData.x0_pos = pos; .x0_pos = pos,
parmData.xc_dir = dir; .xc_dir = dir,
parmData.x18_maxDist = 150.f; .x18_maxDist = 150.f,
parmData.x1c_distComp = 0.1f; .x1c_distComp = 0.1f,
parmData.x20_flags = 1; // Continuous parameter update .x20_flags = 1, // Continuous parameter update
parmData.x24_sfxId = id; .x24_sfxId = id,
parmData.x26_maxVol = std::max(vol, 0.165f); .x26_maxVol = std::max(vol, 0.165f),
parmData.x27_minVol = 0.165f; .x27_minVol = 0.165f,
parmData.x28_important = false; .x28_important = false,
parmData.x29_prio = 0x7f; .x29_prio = 0x7f,
};
return AddEmitter(parmData, useAcoustics, prio, looped, areaId); return AddEmitter(parmData, useAcoustics, prio, looped, areaId);
} }