Browse Source

Working thunder. These changes may need to be applied to other sound arrays or image arrays.

marauder2k7 3 years ago
parent
commit
8a1d3f2021
2 changed files with 11 additions and 5 deletions
  1. 5 5
      Engine/source/T3D/assets/SoundAsset.cpp
  2. 6 0
      Engine/source/T3D/fx/lightning.cpp

+ 5 - 5
Engine/source/T3D/assets/SoundAsset.cpp

@@ -279,18 +279,18 @@ StringTableEntry SoundAsset::getAssetIdByFileName(StringTableEntry fileName)
    return materialAssetId;
    return materialAssetId;
 }
 }
 
 
-U32 SoundAsset::getAssetById(StringTableEntry assetId, AssetPtr<SoundAsset>* materialAsset)
+U32 SoundAsset::getAssetById(StringTableEntry assetId, AssetPtr<SoundAsset>* soundAsset)
 {
 {
-   (*materialAsset) = assetId;
+   (*soundAsset) = assetId;
 
 
-   if (materialAsset->notNull())
+   if (soundAsset->notNull())
    {
    {
-      return (*materialAsset)->mLoadedState;
+      return (*soundAsset)->mLoadedState;
    }
    }
    else
    else
    {
    {
       //Well that's bad, loading the fallback failed.
       //Well that's bad, loading the fallback failed.
-      Con::warnf("MaterialAsset::getAssetById - Finding of asset with id %s failed with no fallback asset", assetId);
+      Con::warnf("SoundAsset::getAssetById - Finding of asset with id %s failed with no fallback asset", assetId);
       return AssetErrCode::Failed;
       return AssetErrCode::Failed;
    }
    }
 }
 }

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

@@ -265,7 +265,9 @@ void LightningData::initPersistFields()
 
 
    INITPERSISTFIELD_SOUNDASSET(StrikeSound, LightningData, "Sound to play when lightning STRIKES!");
    INITPERSISTFIELD_SOUNDASSET(StrikeSound, LightningData, "Sound to play when lightning STRIKES!");
 
 
+   addArray("Thunders", MaxThunders);
    INITPERSISTFIELD_SOUNDASSET_ARRAY(ThunderSound, MaxThunders, LightningData, "Sounds for thunder.");
    INITPERSISTFIELD_SOUNDASSET_ARRAY(ThunderSound, MaxThunders, LightningData, "Sounds for thunder.");
+   endArray("Thunders");
 
 
    addField( "strikeTextures", TypeString, Offset(strikeTextureNames, LightningData), MaxTextures,
    addField( "strikeTextures", TypeString, Offset(strikeTextureNames, LightningData), MaxTextures,
       "List of textures to use to render lightning strikes." );
       "List of textures to use to render lightning strikes." );
@@ -299,9 +301,13 @@ bool LightningData::preload(bool server, String &errorStr)
          if (getThunderSound(i))
          if (getThunderSound(i))
          {
          {
             _setThunderSound(getThunderSound(i), i);
             _setThunderSound(getThunderSound(i), i);
+            Con::printf("Thunder sound: %d %s", i, getThunderSound(i));
+
             if (!getThunderSoundProfile(i))
             if (!getThunderSoundProfile(i))
                Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Cant get an sfxProfile for thunder.");
                Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Cant get an sfxProfile for thunder.");
+
          }
          }
+
       }
       }
 
 
       if(getStrikeSound() && !getStrikeSoundProfile())
       if(getStrikeSound() && !getStrikeSoundProfile())