Refactor of sound asset

Refactored to match image asset.
This commit is contained in:
marauder2k7 2026-04-05 14:17:17 +01:00
parent 5796f0ea07
commit 71273e63c9
46 changed files with 639 additions and 775 deletions

View file

@ -230,9 +230,6 @@ ExplosionData::ExplosionData()
faceViewer = false;
INIT_ASSET(Sound);
//soundProfile = NULL;
particleEmitter = NULL;
particleEmitterId = 0;
@ -310,7 +307,7 @@ ExplosionData::ExplosionData(const ExplosionData& other, bool temp_clone) : Game
faceViewer = other.faceViewer;
particleDensity = other.particleDensity;
particleRadius = other.particleRadius;
CLONE_ASSET(Sound);
mSoundAsset = other.mSoundAsset;
particleEmitter = other.particleEmitter;
particleEmitterId = other.particleEmitterId; // -- for pack/unpack of particleEmitter ptr
explosionScale = other.explosionScale;
@ -674,9 +671,7 @@ void ExplosionData::packData(BitStream* stream)
Parent::packData(stream);
PACKDATA_ASSET_REFACTOR(ExplosionShape);
//PACKDATA_SOUNDASSET(Sound);
PACKDATA_ASSET(Sound);
PACKDATA_ASSET_REFACTOR(Sound);
if (stream->writeFlag(particleEmitter))
stream->writeRangedU32(particleEmitter->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
@ -779,8 +774,7 @@ void ExplosionData::unpackData(BitStream* stream)
Parent::unpackData(stream);
UNPACKDATA_ASSET_REFACTOR(ExplosionShape);
UNPACKDATA_ASSET(Sound);
UNPACKDATA_ASSET_REFACTOR(Sound);
if (stream->readFlag())
particleEmitterId = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast);
@ -886,7 +880,7 @@ bool ExplosionData::preload(bool server, String &errorStr)
if (!server)
{
if (!isSoundValid())
if (!getSoundSFXTrack())
{
//return false; -TODO: trigger asset download
}
@ -1432,7 +1426,7 @@ bool Explosion::explode()
resetWorldBox();
}
SFXProfile* sound_prof = static_cast<SFXProfile*>(mDataBlock->getSoundProfile());
SFXProfile* sound_prof = static_cast<SFXProfile*>(mDataBlock->getSoundSFXTrack().getPointer());
if (sound_prof)
{
soundProfile_clone = sound_prof->cloneAndPerformSubstitutions(ss_object, ss_index);