sound safeties and future notes

This commit is contained in:
AzaezelX 2023-02-26 17:26:43 -06:00
parent 39b9b47caf
commit c4ae6258cc
15 changed files with 39 additions and 48 deletions

View file

@ -264,7 +264,7 @@ public: \
return m##name##Desc;}\ return m##name##Desc;}\
return NULL;\ return NULL;\
}\ }\
bool is##name##Valid() { return (get##name() != StringTable->EmptyString() && m##name##Asset->getStatus() == AssetBase::Ok); } bool is##name##Valid() { return (get##name() != StringTable->EmptyString() && m##name##Asset && m##name##Asset->getStatus() == AssetBase::Ok); }
#ifdef TORQUE_SHOW_LEGACY_FILE_FIELDS #ifdef TORQUE_SHOW_LEGACY_FILE_FIELDS
@ -449,7 +449,7 @@ public: \
return m##name##Asset[id]->getSfxProfile();\ return m##name##Asset[id]->getSfxProfile();\
return NULL;\ return NULL;\
}\ }\
bool is##name##Valid(const U32& id) {return (get##name(id) != StringTable->EmptyString() && m##name##Asset[id]->getStatus() == AssetBase::Ok); } bool is##name##Valid(const U32& id) {return (get##name(id) != StringTable->EmptyString() && m##name##Asset[id] && m##name##Asset[id]->getStatus() == AssetBase::Ok); }
#ifdef TORQUE_SHOW_LEGACY_FILE_FIELDS #ifdef TORQUE_SHOW_LEGACY_FILE_FIELDS

View file

@ -877,10 +877,9 @@ bool ExplosionData::preload(bool server, String &errorStr)
if( !server ) if( !server )
{ {
if (getSound() != StringTable->EmptyString() && !isSoundValid()) if (!isSoundValid())
{ {
Con::errorf(ConsoleLogEntry::General, "ExplosionData::preload: Invalid Sound asset."); //return false; -TODO: trigger asset download
return false;
} }
if (!particleEmitter && particleEmitterId != 0) if (!particleEmitter && particleEmitterId != 0)

View file

@ -297,17 +297,15 @@ bool LightningData::preload(bool server, String &errorStr)
{ {
for (S32 i = 0; i < MaxThunders; i++) for (S32 i = 0; i < MaxThunders; i++)
{ {
if (getThunderSound(i) != StringTable->EmptyString() && !isThunderSoundValid(i)) if (!isThunderSoundValid(i))
{ {
Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Invalid ThunderSound asset."); //return false; -TODO: trigger asset download
return false;
} }
} }
if (getStrikeSound() != StringTable->EmptyString() && !isStrikeSoundValid()) if (!isStrikeSoundValid())
{ {
Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Invalid StrikeSound asset."); //return false; -TODO: trigger asset download
return false;
} }
mNumStrikeTextures = 0; mNumStrikeTextures = 0;

View file

@ -191,10 +191,9 @@ bool PrecipitationData::preload( bool server, String &errorStr )
return false; return false;
if (!server) if (!server)
{ {
if (getSound() != StringTable->EmptyString() && !isSoundValid()) if (!isSoundValid())
{ {
Con::errorf(ConsoleLogEntry::General, "PrecipitationData::preload: Invalid Sound asset."); //return false; -TODO: trigger asset download
return false;
} }
} }

View file

@ -279,10 +279,10 @@ bool SplashData::preload(bool server, String &errorStr)
if (!server) if (!server)
{ {
if (getSound() != StringTable->EmptyString() && !isSoundValid()) if (!isSoundValid())
{ {
Con::errorf(ConsoleLogEntry::General, "SplashData::preload: Invalid Sound asset."); Con::errorf(ConsoleLogEntry::General, "SplashData::preload: Invalid Sound asset.");
return false; //return false;
} }
S32 i; S32 i;

View file

@ -471,10 +471,9 @@ bool PlayerData::preload(bool server, String &errorStr)
if (!server) { if (!server) {
for (U32 i = 0; i < MaxSounds; ++i) for (U32 i = 0; i < MaxSounds; ++i)
{ {
if (getPlayerSound(i) != StringTable->EmptyString() && !isPlayerSoundValid(i)) if (!isPlayerSoundValid(i))
{ {
Con::errorf(ConsoleLogEntry::General, "ExplosionData::preload: Invalid PlayerSound asset."); //return false; -TODO: trigger asset download
return false;
} }
} }
} }

View file

@ -368,10 +368,9 @@ bool ProjectileData::preload(bool server, String &errorStr)
if (Sim::findObject(decalId, decal) == false) if (Sim::findObject(decalId, decal) == false)
Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId); Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId);
if (getProjectileSound() != StringTable->EmptyString() && !isProjectileSoundValid()) if (!isProjectileSoundValid())
{ {
Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid ProjectileSound asset."); //return false; -TODO: trigger asset download
return false;
} }
if (!lightDesc && lightDescId != 0) if (!lightDesc && lightDescId != 0)

View file

@ -134,10 +134,14 @@ bool ProximityMineData::preload( bool server, String& errorStr )
if ( !server ) if ( !server )
{ {
if( !getArmSound() ) if(!isArmSoundValid() )
Con::errorf( ConsoleLogEntry::General, "ProximityMineData::preload: Invalid arming sound." ); {
if( !getTriggerSound() ) //return false; -TODO: trigger asset download
Con::errorf( ConsoleLogEntry::General, "ProximityMineData::preload: Invalid trigger sound." ); }
if(!isTriggerSoundValid() )
{
//return false; -TODO: trigger asset download
}
} }
if ( mShape ) if ( mShape )

View file

@ -318,19 +318,17 @@ bool RigidShapeData::preload(bool server, String &errorStr)
if (!server) { if (!server) {
for (S32 i = 0; i < Body::MaxSounds; i++) for (S32 i = 0; i < Body::MaxSounds; i++)
{ {
if (getBodySounds(i) != StringTable->EmptyString() && !isBodySoundsValid(i)) if (!isBodySoundsValid(i))
{ {
Con::errorf(ConsoleLogEntry::General, "RigidShapeData::preload: Invalid BodySound asset."); //return false; -TODO: trigger asset download
return false;
} }
} }
for (S32 j = 0; j < Sounds::MaxSounds; j++) for (S32 j = 0; j < Sounds::MaxSounds; j++)
{ {
if (getWaterSounds(j) != StringTable->EmptyString() && !isWaterSoundsValid(j)) if (!isWaterSoundsValid(j))
{ {
Con::errorf(ConsoleLogEntry::General, "RigidShapeData::preload: Invalid WaterSound asset."); //return false; -TODO: trigger asset download
return false;
} }
} }

View file

@ -422,10 +422,9 @@ bool ShapeBaseImageData::preload(bool server, String &errorStr)
if (!Sim::findObject(SimObjectId((uintptr_t)state[i].emitter), state[i].emitter)) if (!Sim::findObject(SimObjectId((uintptr_t)state[i].emitter), state[i].emitter))
Con::errorf(ConsoleLogEntry::General, "Error, unable to load emitter for image datablock"); Con::errorf(ConsoleLogEntry::General, "Error, unable to load emitter for image datablock");
if (getstateSound(i) != StringTable->EmptyString() && !isstateSoundValid(i)) if (!isstateSoundValid(i))
{ {
Con::errorf(ConsoleLogEntry::General, "ShapeBaseImageData::preload: Invalid stateSound asset %s on state %d", getstateSound(i), i); //return false; -TODO: trigger asset download
return false;
} }
} }
} }

View file

@ -141,7 +141,7 @@ bool FlyingVehicleData::preload(bool server, String &errorStr)
if (!server) { if (!server) {
for (S32 i = 0; i < MaxSounds; i++) for (S32 i = 0; i < MaxSounds; i++)
{ {
if (getFlyingSounds(i) != StringTable->EmptyString() && !isFlyingSoundsValid(i)) if (!isFlyingSoundsValid(i))
{ {
Con::errorf(ConsoleLogEntry::General, "FlyingVehicleData::preload: Invalid FlyingSounds asset."); Con::errorf(ConsoleLogEntry::General, "FlyingVehicleData::preload: Invalid FlyingSounds asset.");
return false; return false;

View file

@ -315,10 +315,9 @@ bool HoverVehicleData::preload(bool server, String &errorStr)
for (S32 i = 0; i < MaxSounds; i++) for (S32 i = 0; i < MaxSounds; i++)
{ {
if (getHoverSounds(i) != StringTable->EmptyString() && !isHoverSoundsValid(i)) if (!isHoverSoundsValid(i))
{ {
Con::errorf(ConsoleLogEntry::General, "HoverVehicleData::preload: Invalid HoverSounds asset."); //return false; -TODO: trigger asset download
return false;
} }
} }
for (S32 j = 0; j < MaxJetEmitters; j++) for (S32 j = 0; j < MaxJetEmitters; j++)

View file

@ -348,10 +348,9 @@ bool WheeledVehicleData::preload(bool server, String &errorStr)
if (!server) { if (!server) {
for (S32 i = 0; i < MaxSounds; i++) for (S32 i = 0; i < MaxSounds; i++)
{ {
if (getWheeledVehicleSounds(i) != StringTable->EmptyString() && !isWheeledVehicleSoundsValid(i)) if (!isWheeledVehicleSoundsValid(i))
{ {
Con::errorf(ConsoleLogEntry::General, "HoverVehicleData::preload: Invalid WheeledVehicleSounds asset."); //return false; -TODO: trigger asset download
return false;
} }
} }

View file

@ -517,10 +517,9 @@ bool afxMagicMissileData::preload(bool server, String &errorStr)
Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId); Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId);
*/ */
if (getProjectileSound() != StringTable->EmptyString() && !isProjectileSoundValid()) if (!isProjectileSoundValid())
{ {
Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Invalid ProjectileSound asset."); //return false; -TODO: trigger asset download
return false;
} }
if (!lightDesc && lightDescId != 0) if (!lightDesc && lightDescId != 0)

View file

@ -153,10 +153,9 @@ bool SFXAmbience::preload( bool server, String& errorStr )
if( !sfxResolve( &mEnvironment, errorStr ) ) if( !sfxResolve( &mEnvironment, errorStr ) )
return false; return false;
if (getSoundTrack() != StringTable->EmptyString() && !isSoundTrackValid()) if (!isSoundTrackValid())
{ {
Con::errorf(ConsoleLogEntry::General, "SFXAmbience::preload: Invalid SoundTrack asset."); //return false; -TODO: trigger asset download
return false;
} }
for( U32 i = 0; i < MaxStates; ++ i ) for( U32 i = 0; i < MaxStates; ++ i )