hybridize suggested approaches with older code style, passing along either a matrix or a null.

for network transmission purposes, send which along as a bool
This commit is contained in:
AzaezelX 2024-02-03 22:35:41 -06:00
parent b12cd00b74
commit 846cec8dff
3 changed files with 52 additions and 70 deletions

View file

@ -1566,11 +1566,7 @@ void GameConnection::play2D(StringTableEntry assetId)
{
if (AssetDatabase.isDeclaredAsset(assetId))
{
AssetPtr<SoundAsset> tempSoundAsset = assetId;
if (tempSoundAsset && tempSoundAsset->is3D())
{
postNetEvent(new SimSoundAssetEvent(assetId, SFX->getListener(0).getTransform()));
}
postNetEvent(new SimSoundAssetEvent(assetId));
}
}
@ -1586,7 +1582,7 @@ void GameConnection::play3D(StringTableEntry assetId, const MatrixF *transform)
tempSoundAsset = assetId;
if (!mControlObject)
postNetEvent(new SimSoundAssetEvent(assetId, *transform));
postNetEvent(new SimSoundAssetEvent(assetId, transform));
else
{
// TODO: Maybe improve this to account for the duration
@ -1600,7 +1596,7 @@ void GameConnection::play3D(StringTableEntry assetId, const MatrixF *transform)
transform->getColumn(3, &pos);
mControlObject->getTransform().getColumn(3, &ear);
if ((ear - pos).len() < tempSoundAsset->getSfxDescription()->mMaxDistance)
postNetEvent(new SimSoundAssetEvent(assetId, *transform));
postNetEvent(new SimSoundAssetEvent(assetId, transform));
}
}