From e9d0f68b55a08e8036c1f858265ed3eb88891714 Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Mon, 20 Sep 2021 17:05:11 +0100 Subject: [PATCH] Preload all soundAsset -Fixed: Preloads need to preload all soundAssets not just the ones it was preloading before. --- Engine/source/T3D/fx/lightning.cpp | 26 ++++++++++---------- Engine/source/T3D/rigidShape.cpp | 11 +++++++++ Engine/source/T3D/vehicles/flyingVehicle.cpp | 3 ++- Engine/source/T3D/vehicles/hoverVehicle.cpp | 1 + Engine/source/T3D/vehicles/vehicle.cpp | 10 ++++++++ 5 files changed, 37 insertions(+), 14 deletions(-) diff --git a/Engine/source/T3D/fx/lightning.cpp b/Engine/source/T3D/fx/lightning.cpp index 73a63550e..7586602d4 100644 --- a/Engine/source/T3D/fx/lightning.cpp +++ b/Engine/source/T3D/fx/lightning.cpp @@ -289,18 +289,18 @@ bool LightningData::preload(bool server, String &errorStr) //dQsort(thunderSounds, MaxThunders, sizeof(SFXTrack*), cmpSounds); - for (S32 i = 0; i < MaxThunders; i++) { - if (mThunderSound[i]) - { - _setThunderSound(getThunderSound(i), i); - } - } - + if (server == false) { - String sfxErrorStr; - for (U32 i = 0; i < MaxThunders; i++) { - if (!getThunderProfile(i)) + for (S32 i = 0; i < MaxThunders; i++) { + if (mThunderSound[i]) + { + _setThunderSound(getThunderSound(i), i); + } + } + + for (U32 j = 0; j < MaxThunders; j++) { + if (!getThunderProfile(j)) Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Cant get an sfxProfile for thunder."); } @@ -308,11 +308,11 @@ bool LightningData::preload(bool server, String &errorStr) Con::errorf(ConsoleLogEntry::General, "LightningData::preload: can't get sfxProfile from asset"); mNumStrikeTextures = 0; - for (U32 i = 0; i < MaxTextures; i++) + for (U32 k = 0; k < MaxTextures; k++) { - if (strikeTextureNames[i][0]) + if (strikeTextureNames[k][0]) { - strikeTextures[i] = GFXTexHandle(strikeTextureNames[i], &GFXStaticTextureProfile, avar("%s() - strikeTextures[%d] (line %d)", __FUNCTION__, i, __LINE__)); + strikeTextures[k] = GFXTexHandle(strikeTextureNames[i], &GFXStaticTextureProfile, avar("%s() - strikeTextures[%d] (line %d)", __FUNCTION__, k, __LINE__)); mNumStrikeTextures++; } } diff --git a/Engine/source/T3D/rigidShape.cpp b/Engine/source/T3D/rigidShape.cpp index 73c8925cf..475854bbb 100644 --- a/Engine/source/T3D/rigidShape.cpp +++ b/Engine/source/T3D/rigidShape.cpp @@ -300,10 +300,21 @@ bool RigidShapeData::preload(bool server, String &errorStr) // Resolve objects transmitted from server if (!server) { for (S32 i = 0; i < Body::MaxSounds; i++) + { if (mBodySounds[i]) { _setBodySounds(getBodySounds(i), i); } + } + + for (S32 j = 0; j < Sounds::MaxSounds; j++) + { + if (mWaterSounds[j]) + { + _setWaterSounds(getWaterSounds(j), j); + } + } + } if( !dustEmitter && dustID != 0 ) diff --git a/Engine/source/T3D/vehicles/flyingVehicle.cpp b/Engine/source/T3D/vehicles/flyingVehicle.cpp index 64ec41fd6..dcc1f8dd2 100644 --- a/Engine/source/T3D/vehicles/flyingVehicle.cpp +++ b/Engine/source/T3D/vehicles/flyingVehicle.cpp @@ -131,11 +131,12 @@ bool FlyingVehicleData::preload(bool server, String &errorStr) // Resolve objects transmitted from server if (!server) { for (S32 i = 0; i < MaxSounds; i++) + { if (mFlyingSounds[i]) { _setFlyingSounds(getFlyingSounds(i), i); } - + } for (S32 j = 0; j < MaxJetEmitters; j++) if (jetEmitter[j]) Sim::findObject(SimObjectId((uintptr_t)jetEmitter[j]),jetEmitter[j]); diff --git a/Engine/source/T3D/vehicles/hoverVehicle.cpp b/Engine/source/T3D/vehicles/hoverVehicle.cpp index 404f54506..0cddc2c72 100644 --- a/Engine/source/T3D/vehicles/hoverVehicle.cpp +++ b/Engine/source/T3D/vehicles/hoverVehicle.cpp @@ -305,6 +305,7 @@ bool HoverVehicleData::preload(bool server, String &errorStr) // Resolve objects transmitted from server if (!server) { + for (S32 i = 0; i < MaxSounds; i++) if (mHoverSounds[i]) { diff --git a/Engine/source/T3D/vehicles/vehicle.cpp b/Engine/source/T3D/vehicles/vehicle.cpp index 3aaac0646..b773dd58f 100644 --- a/Engine/source/T3D/vehicles/vehicle.cpp +++ b/Engine/source/T3D/vehicles/vehicle.cpp @@ -218,10 +218,20 @@ bool VehicleData::preload(bool server, String &errorStr) // Resolve objects transmitted from server if (!server) { for (S32 i = 0; i < Body::MaxSounds; i++) + { if (mVehicleBodySounds[i]) { _setVehicleBodySounds(getVehicleBodySounds(i), i); } + } + + for (S32 j = 0; j < Sounds::MaxSounds; j++) + { + if (mVehicleWaterSounds[j]) + { + _setVehicleWaterSounds(getVehicleWaterSounds(j), j); + } + } } if( !dustEmitter && dustID != 0 )