mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-19 20:30:58 +00:00
Adds safety check to SoundAsset's playSound so if we don't have a source, it doesn't crash
Adds logic to SoundAsset's load sound to 'nudge' the SFX system to load the required data for first use Shifts SimSoundAssetEvent constructor to utilize assetId instead of raw asset so we can safely fail if for whatever reason we end up default constructor'ing blanks Standardizes the shapeImage playList lookup a bit into a common function and ensures that on packet receive we force an update of the state's sound
This commit is contained in:
parent
956bd51d6d
commit
943cf8351b
6 changed files with 43 additions and 27 deletions
|
|
@ -1566,12 +1566,7 @@ void GameConnection::play2D(StringTableEntry assetId)
|
|||
{
|
||||
if (AssetDatabase.isDeclaredAsset(assetId))
|
||||
{
|
||||
|
||||
AssetPtr<SoundAsset> tempSoundAsset;
|
||||
tempSoundAsset = assetId;
|
||||
|
||||
postNetEvent(new SimSoundAssetEvent(tempSoundAsset));
|
||||
|
||||
postNetEvent(new SimSoundAssetEvent(assetId));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1587,7 +1582,7 @@ void GameConnection::play3D(StringTableEntry assetId, const MatrixF *transform)
|
|||
tempSoundAsset = assetId;
|
||||
|
||||
if (!mControlObject)
|
||||
postNetEvent(new SimSoundAssetEvent(tempSoundAsset, transform));
|
||||
postNetEvent(new SimSoundAssetEvent(assetId, *transform));
|
||||
else
|
||||
{
|
||||
// TODO: Maybe improve this to account for the duration
|
||||
|
|
@ -1601,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(tempSoundAsset, transform));
|
||||
postNetEvent(new SimSoundAssetEvent(assetId, *transform));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue