Bläddra i källkod

sound safeties and future notes

AzaezelX 2 år sedan
förälder
incheckning
c4ae6258cc

+ 2 - 2
Engine/source/T3D/assets/SoundAsset.h

@@ -264,7 +264,7 @@ public: \
          return m##name##Desc;}\
       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
 
@@ -449,7 +449,7 @@ public: \
          return m##name##Asset[id]->getSfxProfile();\
       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

+ 2 - 3
Engine/source/T3D/fx/explosion.cpp

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

+ 4 - 6
Engine/source/T3D/fx/lightning.cpp

@@ -297,17 +297,15 @@ bool LightningData::preload(bool server, String &errorStr)
    {
       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;
+            //return false; -TODO: trigger asset download
          }
 
       }
-      if (getStrikeSound() != StringTable->EmptyString() && !isStrikeSoundValid())
+      if (!isStrikeSoundValid())
       {
-         Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Invalid StrikeSound asset.");
-         return false;
+         //return false; -TODO: trigger asset download
       }
 
       mNumStrikeTextures = 0;

+ 2 - 3
Engine/source/T3D/fx/precipitation.cpp

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

+ 2 - 2
Engine/source/T3D/fx/splash.cpp

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

+ 2 - 3
Engine/source/T3D/player.cpp

@@ -471,10 +471,9 @@ bool PlayerData::preload(bool server, String &errorStr)
    if (!server) {
       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;
+            //return false; -TODO: trigger asset download
          }
       }
    }

+ 2 - 3
Engine/source/T3D/projectile.cpp

@@ -368,10 +368,9 @@ 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);
 
-      if (getProjectileSound() != StringTable->EmptyString() && !isProjectileSoundValid())
+      if (!isProjectileSoundValid())
       {
-         Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid ProjectileSound asset.");
-         return false;
+         //return false; -TODO: trigger asset download
       }
 
       if (!lightDesc && lightDescId != 0)

+ 8 - 4
Engine/source/T3D/proximityMine.cpp

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

+ 4 - 6
Engine/source/T3D/rigidShape.cpp

@@ -318,19 +318,17 @@ bool RigidShapeData::preload(bool server, String &errorStr)
    if (!server) {
       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;
+            //return false; -TODO: trigger asset download
          }
       }
 
       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;
+            //return false; -TODO: trigger asset download
          }
       }
 

+ 2 - 3
Engine/source/T3D/shapeImage.cpp

@@ -422,10 +422,9 @@ 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() && !isstateSoundValid(i))
+         if (!isstateSoundValid(i))
          {
-            Con::errorf(ConsoleLogEntry::General, "ShapeBaseImageData::preload: Invalid stateSound asset %s on state %d", getstateSound(i), i);
-            return false;
+            //return false; -TODO: trigger asset download
          }
       }
    }

+ 1 - 1
Engine/source/T3D/vehicles/flyingVehicle.cpp

@@ -141,7 +141,7 @@ bool FlyingVehicleData::preload(bool server, String &errorStr)
    if (!server) {
       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.");
             return false;

+ 2 - 3
Engine/source/T3D/vehicles/hoverVehicle.cpp

@@ -315,10 +315,9 @@ bool HoverVehicleData::preload(bool server, String &errorStr)
 
       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;
+            //return false; -TODO: trigger asset download
          }
       }
       for (S32 j = 0; j < MaxJetEmitters; j++)

+ 2 - 3
Engine/source/T3D/vehicles/wheeledVehicle.cpp

@@ -348,10 +348,9 @@ bool WheeledVehicleData::preload(bool server, String &errorStr)
    if (!server) {
       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;
+            //return false; -TODO: trigger asset download
          }
       }
 

+ 2 - 3
Engine/source/afx/afxMagicMissile.cpp

@@ -517,10 +517,9 @@ bool afxMagicMissileData::preload(bool server, String &errorStr)
             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;
+         //return false; -TODO: trigger asset download
       }
 
       if (!lightDesc && lightDescId != 0)

+ 2 - 3
Engine/source/sfx/sfxAmbience.cpp

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