From 76addc52eb73fdb631380c27beb3e7a6f61f8e89 Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Tue, 28 Sep 2021 21:10:48 +0100 Subject: [PATCH] Checks for emptyString in preload Sound asset out for emptyString --- Engine/source/T3D/assets/SoundAsset.h | 2 ++ Engine/source/T3D/fx/explosion.cpp | 10 +++++++++- Engine/source/T3D/fx/lightning.cpp | 11 ++++++++--- Engine/source/T3D/fx/precipitation.cpp | 11 +++++++++-- Engine/source/T3D/fx/splash.cpp | 12 +++++++++--- Engine/source/T3D/projectile.cpp | 9 +++++++-- 6 files changed, 44 insertions(+), 11 deletions(-) diff --git a/Engine/source/T3D/assets/SoundAsset.h b/Engine/source/T3D/assets/SoundAsset.h index ca83e477b..502732fee 100644 --- a/Engine/source/T3D/assets/SoundAsset.h +++ b/Engine/source/T3D/assets/SoundAsset.h @@ -235,6 +235,8 @@ public: \ m##name = NULL;\ }\ \ + if(get##name() == StringTable->EmptyString())\ + return true;\ if (m##name##Asset.notNull() && m##name##Asset->getStatus() != SoundAsset::Ok)\ {\ Con::errorf("%s(%s)::_set%s() - sound asset failure\"%s\" due to [%s]", macroText(className), getName(), macroText(name), _in, SoundAsset::getAssetErrstrn(m##name##Asset->getStatus()).c_str());\ diff --git a/Engine/source/T3D/fx/explosion.cpp b/Engine/source/T3D/fx/explosion.cpp index d770e2f36..17aa6017c 100644 --- a/Engine/source/T3D/fx/explosion.cpp +++ b/Engine/source/T3D/fx/explosion.cpp @@ -864,7 +864,15 @@ bool ExplosionData::preload(bool server, String &errorStr) if( !server ) { - String sfxErrorStr; + + if (getSound() != StringTable->EmptyString()) + { + _setSound(getSound()); + + if (!getSoundProfile()) + Con::errorf(ConsoleLogEntry::General, "SplashData::preload: Cant get an sfxProfile for splash."); + } + if (!particleEmitter && particleEmitterId != 0) if (Sim::findObject(particleEmitterId, particleEmitter) == false) Con::errorf(ConsoleLogEntry::General, "Error, unable to load particle emitter for explosion datablock"); diff --git a/Engine/source/T3D/fx/lightning.cpp b/Engine/source/T3D/fx/lightning.cpp index 6726c5183..a53a1f540 100644 --- a/Engine/source/T3D/fx/lightning.cpp +++ b/Engine/source/T3D/fx/lightning.cpp @@ -296,7 +296,7 @@ bool LightningData::preload(bool server, String &errorStr) { for (S32 i = 0; i < MaxThunders; i++) { - if (getThunderSound(i)) + if (getThunderSound(i) != StringTable->EmptyString()) { _setThunderSound(getThunderSound(i), i); Con::printf("Thunder sound: %d %s", i, getThunderSound(i)); @@ -308,8 +308,13 @@ bool LightningData::preload(bool server, String &errorStr) } - if(getStrikeSound() && !getStrikeSoundProfile()) - Con::errorf(ConsoleLogEntry::General, "LightningData::preload: can't get sfxProfile from asset"); + if (getStrikeSound() != StringTable->EmptyString()) + { + _setStrikeSound(getStrikeSound()); + + if(!getStrikeSoundProfile()) + Con::errorf(ConsoleLogEntry::General, "LightningData::preload: can't get sfxProfile from strike sound."); + } mNumStrikeTextures = 0; for (U32 k = 0; k < MaxTextures; k++) diff --git a/Engine/source/T3D/fx/precipitation.cpp b/Engine/source/T3D/fx/precipitation.cpp index bf3246dc9..68880edf4 100644 --- a/Engine/source/T3D/fx/precipitation.cpp +++ b/Engine/source/T3D/fx/precipitation.cpp @@ -188,9 +188,16 @@ bool PrecipitationData::preload( bool server, String &errorStr ) { if( Parent::preload( server, errorStr) == false) return false; + if (!server) + { + if (getSound() != StringTable->EmptyString()) + { + _setSound(getSound()); - if (!server && !getSoundProfile()) - return false; + if (!getSoundProfile()) + Con::errorf(ConsoleLogEntry::General, "SplashData::preload: Cant get an sfxProfile for splash."); + } + } return true; } diff --git a/Engine/source/T3D/fx/splash.cpp b/Engine/source/T3D/fx/splash.cpp index d1230e5c5..38a4f4e89 100644 --- a/Engine/source/T3D/fx/splash.cpp +++ b/Engine/source/T3D/fx/splash.cpp @@ -276,11 +276,17 @@ bool SplashData::preload(bool server, String &errorStr) if (Parent::preload(server, errorStr) == false) return false; - if (!server && !getSoundProfile()) - return false; - if (!server) { + + if (getSound() != StringTable->EmptyString()) + { + _setSound(getSound()); + + if(!getSoundProfile()) + Con::errorf(ConsoleLogEntry::General, "SplashData::preload: Cant get an sfxProfile for splash."); + } + S32 i; for( i=0; iEmptyString()) + { + _setProjectileSound(getProjectileSound()); + + if (!getProjectileSoundProfile()) + Con::errorf(ConsoleLogEntry::General, "SplashData::preload: Cant get an sfxProfile for splash."); + } if (!lightDesc && lightDescId != 0) if (Sim::findObject(lightDescId, lightDesc) == false)