mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-06 21:11:01 +00:00
Merge pull request #967 from Azaezel/alpha41/audiopreloadFixes
standardize soundasset preloading for datablocks
This commit is contained in:
commit
ae72247be2
|
|
@ -877,15 +877,10 @@ bool ExplosionData::preload(bool server, String &errorStr)
|
|||
if( !server )
|
||||
{
|
||||
|
||||
if (getSound() != StringTable->EmptyString())
|
||||
if (getSound() != StringTable->EmptyString() && !isSoundValid())
|
||||
{
|
||||
_setSound(getSound());
|
||||
|
||||
if (!getSoundProfile())
|
||||
{
|
||||
Con::errorf(ConsoleLogEntry::General, "SplashData::preload: Cant get an sfxProfile for splash.");
|
||||
return false;
|
||||
}
|
||||
Con::errorf(ConsoleLogEntry::General, "ExplosionData::preload: Invalid Sound asset.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!particleEmitter && particleEmitterId != 0)
|
||||
|
|
|
|||
|
|
@ -297,19 +297,17 @@ bool LightningData::preload(bool server, String &errorStr)
|
|||
{
|
||||
for (S32 i = 0; i < MaxThunders; i++)
|
||||
{
|
||||
_setThunderSound(getThunderSound(i), i);
|
||||
if (isThunderSoundValid(i) && !getThunderSoundProfile(i))
|
||||
if (getThunderSound(i) != StringTable->EmptyString() && !isThunderSoundValid(i))
|
||||
{
|
||||
Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Cant get an sfxProfile for thunder.");
|
||||
|
||||
Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Invalid ThunderSound asset.");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_setStrikeSound(getStrikeSound());
|
||||
if (isStrikeSoundValid() && !getStrikeSoundProfile())
|
||||
if (getStrikeSound() != StringTable->EmptyString() && !isStrikeSoundValid())
|
||||
{
|
||||
Con::errorf(ConsoleLogEntry::General, "LightningData::preload: can't get sfxProfile from strike sound.");
|
||||
Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Invalid StrikeSound asset.");
|
||||
return false;
|
||||
}
|
||||
|
||||
mNumStrikeTextures = 0;
|
||||
|
|
|
|||
|
|
@ -191,12 +191,10 @@ bool PrecipitationData::preload( bool server, String &errorStr )
|
|||
return false;
|
||||
if (!server)
|
||||
{
|
||||
if (getSound() != StringTable->EmptyString())
|
||||
if (getSound() != StringTable->EmptyString() && !isSoundValid())
|
||||
{
|
||||
_setSound(getSound());
|
||||
|
||||
if (!getSoundProfile())
|
||||
Con::errorf(ConsoleLogEntry::General, "SplashData::preload: Cant get an sfxProfile for splash.");
|
||||
Con::errorf(ConsoleLogEntry::General, "PrecipitationData::preload: Invalid Sound asset.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -279,13 +279,10 @@ bool SplashData::preload(bool server, String &errorStr)
|
|||
|
||||
if (!server)
|
||||
{
|
||||
|
||||
if (getSound() != StringTable->EmptyString())
|
||||
if (getSound() != StringTable->EmptyString() && !isSoundValid())
|
||||
{
|
||||
_setSound(getSound());
|
||||
|
||||
if(!getSoundProfile())
|
||||
Con::errorf(ConsoleLogEntry::General, "SplashData::preload: Cant get an sfxProfile for splash.");
|
||||
Con::errorf(ConsoleLogEntry::General, "SplashData::preload: Invalid Sound asset.");
|
||||
return false;
|
||||
}
|
||||
|
||||
S32 i;
|
||||
|
|
|
|||
|
|
@ -471,11 +471,10 @@ bool PlayerData::preload(bool server, String &errorStr)
|
|||
if (!server) {
|
||||
for (U32 i = 0; i < MaxSounds; ++i)
|
||||
{
|
||||
_setPlayerSound(getPlayerSound(i), i);
|
||||
if (getPlayerSound(i) != StringTable->EmptyString())
|
||||
if (getPlayerSound(i) != StringTable->EmptyString() && !isPlayerSoundValid(i))
|
||||
{
|
||||
if (!getPlayerSoundProfile(i))
|
||||
Con::errorf("PlayerData::Preload() - unable to find sfxProfile for asset %d %s", i, mPlayerSoundAssetId[i]);
|
||||
Con::errorf(ConsoleLogEntry::General, "ExplosionData::preload: Invalid PlayerSound asset.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -368,11 +368,10 @@ bool ProjectileData::preload(bool server, String &errorStr)
|
|||
if (Sim::findObject(decalId, decal) == false)
|
||||
Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId);
|
||||
|
||||
_setProjectileSound(getProjectileSound());
|
||||
if (getProjectileSound() != StringTable->EmptyString())
|
||||
if (getProjectileSound() != StringTable->EmptyString() && !isProjectileSoundValid())
|
||||
{
|
||||
if (!getProjectileSoundProfile())
|
||||
Con::errorf(ConsoleLogEntry::General, "SplashData::preload: Cant get an sfxProfile for splash.");
|
||||
Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid ProjectileSound asset.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!lightDesc && lightDescId != 0)
|
||||
|
|
|
|||
|
|
@ -318,17 +318,19 @@ bool RigidShapeData::preload(bool server, String &errorStr)
|
|||
if (!server) {
|
||||
for (S32 i = 0; i < Body::MaxSounds; i++)
|
||||
{
|
||||
if (getBodySounds(i) != StringTable->EmptyString())
|
||||
if (getBodySounds(i) != StringTable->EmptyString() && !isBodySoundsValid(i))
|
||||
{
|
||||
_setBodySounds(getBodySounds(i), i);
|
||||
Con::errorf(ConsoleLogEntry::General, "RigidShapeData::preload: Invalid BodySound asset.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (S32 j = 0; j < Sounds::MaxSounds; j++)
|
||||
{
|
||||
if (getWaterSounds(j) != StringTable->EmptyString())
|
||||
if (getWaterSounds(j) != StringTable->EmptyString() && !isWaterSoundsValid(j))
|
||||
{
|
||||
_setWaterSounds(getWaterSounds(j), j);
|
||||
Con::errorf(ConsoleLogEntry::General, "RigidShapeData::preload: Invalid WaterSound asset.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -422,13 +422,11 @@ bool ShapeBaseImageData::preload(bool server, String &errorStr)
|
|||
if (!Sim::findObject(SimObjectId((uintptr_t)state[i].emitter), state[i].emitter))
|
||||
Con::errorf(ConsoleLogEntry::General, "Error, unable to load emitter for image datablock");
|
||||
|
||||
if (getstateSound(i) != StringTable->EmptyString())
|
||||
if (getstateSound(i) != StringTable->EmptyString() && !isstateSoundValid(i))
|
||||
{
|
||||
_setstateSound(getstateSound(i), i);
|
||||
if (!getstateSoundProfile(i))
|
||||
Con::errorf("ShapeBaseImageData::preload() - Could not find profile for asset %s on state %d", getstateSound(i), i);
|
||||
Con::errorf(ConsoleLogEntry::General, "ShapeBaseImageData::preload: Invalid stateSound asset %s on state %d", getstateSound(i), i);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -141,9 +141,10 @@ bool FlyingVehicleData::preload(bool server, String &errorStr)
|
|||
if (!server) {
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
{
|
||||
if (mFlyingSounds[i])
|
||||
if (getFlyingSounds(i) != StringTable->EmptyString() && !isFlyingSoundsValid(i))
|
||||
{
|
||||
_setFlyingSounds(getFlyingSounds(i), i);
|
||||
Con::errorf(ConsoleLogEntry::General, "FlyingVehicleData::preload: Invalid FlyingSounds asset.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (S32 j = 0; j < MaxJetEmitters; j++)
|
||||
|
|
|
|||
|
|
@ -314,11 +314,13 @@ bool HoverVehicleData::preload(bool server, String &errorStr)
|
|||
if (!server) {
|
||||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
if (getHoverSounds(i) != StringTable->EmptyString())
|
||||
{
|
||||
if (getHoverSounds(i) != StringTable->EmptyString() && !isHoverSoundsValid(i))
|
||||
{
|
||||
_setHoverSounds(getHoverSounds(i), i);
|
||||
Con::errorf(ConsoleLogEntry::General, "HoverVehicleData::preload: Invalid HoverSounds asset.");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
for (S32 j = 0; j < MaxJetEmitters; j++)
|
||||
if (jetEmitter[j])
|
||||
Sim::findObject(SimObjectId((uintptr_t)jetEmitter[j]),jetEmitter[j]);
|
||||
|
|
|
|||
|
|
@ -348,9 +348,10 @@ bool WheeledVehicleData::preload(bool server, String &errorStr)
|
|||
if (!server) {
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
{
|
||||
if (getWheeledVehicleSounds(i) != StringTable->EmptyString())
|
||||
if (getWheeledVehicleSounds(i) != StringTable->EmptyString() && !isWheeledVehicleSoundsValid(i))
|
||||
{
|
||||
_setWheeledVehicleSounds(getWheeledVehicleSounds(i), i);
|
||||
Con::errorf(ConsoleLogEntry::General, "HoverVehicleData::preload: Invalid WheeledVehicleSounds asset.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -517,11 +517,10 @@ bool afxMagicMissileData::preload(bool server, String &errorStr)
|
|||
Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId);
|
||||
*/
|
||||
|
||||
_setProjectileSound(getProjectileSound());
|
||||
if (getProjectileSound() != StringTable->EmptyString())
|
||||
if (getProjectileSound() != StringTable->EmptyString() && !isProjectileSoundValid())
|
||||
{
|
||||
if (!getProjectileSoundProfile())
|
||||
Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Cant get an sfxProfile for afxMagicMissileData.");
|
||||
Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Invalid ProjectileSound asset.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!lightDesc && lightDescId != 0)
|
||||
|
|
|
|||
|
|
@ -153,10 +153,9 @@ bool SFXAmbience::preload( bool server, String& errorStr )
|
|||
if( !sfxResolve( &mEnvironment, errorStr ) )
|
||||
return false;
|
||||
|
||||
_setSoundTrack(getSoundTrack());
|
||||
if (!getSoundTrackProfile())
|
||||
if (getSoundTrack() != StringTable->EmptyString() && !isSoundTrackValid())
|
||||
{
|
||||
Con::errorf("SFXAmbience::Preload() - unable to find sfxProfile for asset %s", mSoundTrackAssetId);
|
||||
Con::errorf(ConsoleLogEntry::General, "SFXAmbience::preload: Invalid SoundTrack asset.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue