mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-26 14:55:39 +00:00
Converts precipitationData to use sound asset macros
Adds handling for soundProfile fields and lookups of sound assets by SFXProfile name in project importer
This commit is contained in:
parent
328319b853
commit
17d1253ba2
4 changed files with 58 additions and 28 deletions
|
|
@ -127,7 +127,7 @@ ConsoleDocClass( PrecipitationData,
|
|||
//----------------------------------------------------------
|
||||
PrecipitationData::PrecipitationData()
|
||||
{
|
||||
soundProfile = NULL;
|
||||
INIT_SOUNDASSET(Sound);
|
||||
|
||||
INIT_IMAGEASSET(Drop);
|
||||
|
||||
|
|
@ -143,8 +143,7 @@ PrecipitationData::PrecipitationData()
|
|||
|
||||
void PrecipitationData::initPersistFields()
|
||||
{
|
||||
addField( "soundProfile", TYPEID< SFXTrack >(), Offset(soundProfile, PrecipitationData),
|
||||
"Looping SFXProfile effect to play while Precipitation is active." );
|
||||
INITPERSISTFIELD_SOUNDASSET(Sound, PrecipitationData, "Looping SFXProfile effect to play while Precipitation is active.");
|
||||
|
||||
addProtectedField( "dropTexture", TypeFilename, Offset(mDropName, PrecipitationData), &_setDropData, &defaultProtectedGetFn,
|
||||
"@brief Texture filename for drop particles.\n\n"
|
||||
|
|
@ -190,7 +189,7 @@ bool PrecipitationData::preload( bool server, String &errorStr )
|
|||
if( Parent::preload( server, errorStr) == false)
|
||||
return false;
|
||||
|
||||
if( !server && !sfxResolve( &soundProfile, errorStr ) )
|
||||
if (!server && (mSoundAsset.isNull() || !mSoundAsset->getSfxProfile()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
@ -200,7 +199,8 @@ void PrecipitationData::packData(BitStream* stream)
|
|||
{
|
||||
Parent::packData(stream);
|
||||
|
||||
sfxWrite( stream, soundProfile );
|
||||
PACKDATA_SOUNDASSET(Sound);
|
||||
//sfxWrite( stream, soundProfile );
|
||||
|
||||
PACKDATA_IMAGEASSET(Drop);
|
||||
|
||||
|
|
@ -217,7 +217,8 @@ void PrecipitationData::unpackData(BitStream* stream)
|
|||
{
|
||||
Parent::unpackData(stream);
|
||||
|
||||
sfxRead( stream, &soundProfile );
|
||||
UNPACKDATA_SOUNDASSET(Sound);
|
||||
//sfxRead( stream, &soundProfile );
|
||||
|
||||
UNPACKDATA_IMAGEASSET(Drop);
|
||||
|
||||
|
|
@ -598,9 +599,9 @@ bool Precipitation::onNewDataBlock( GameBaseData *dptr, bool reload )
|
|||
{
|
||||
SFX_DELETE( mAmbientSound );
|
||||
|
||||
if ( mDataBlock->soundProfile )
|
||||
if ( mDataBlock->mSoundAsset && mDataBlock->mSoundAsset->getSfxProfile() )
|
||||
{
|
||||
mAmbientSound = SFX->createSource( mDataBlock->soundProfile, &getTransform() );
|
||||
mAmbientSound = SFX->createSource(mDataBlock->mSoundAsset->getSfxProfile(), &getTransform() );
|
||||
if ( mAmbientSound )
|
||||
mAmbientSound->play();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue