diff --git a/Engine/source/T3D/shapeBase.h b/Engine/source/T3D/shapeBase.h index bdfb68e4f..a2696819e 100644 --- a/Engine/source/T3D/shapeBase.h +++ b/Engine/source/T3D/shapeBase.h @@ -264,7 +264,7 @@ struct ShapeBaseImageData: public GameBaseData { //SFXTrack* sound; F32 emitterTime; ///< S32 emitterNode[MaxShapes]; ///< Node ID on the shape to emit from - //DECLARE_SOUNDASSET(StateData, Sound); + SoundAsset* sound; }; /// @name State Data /// Individual state data used to initialize struct array @@ -1075,8 +1075,6 @@ protected: /// @param imageSlot Image slot id /// @param state State id /// @param force Force image to state or let it finish then change - - U32 prevState = 0; void setImageState(U32 imageSlot, U32 state, bool force = false); void updateAnimThread(U32 imageSlot, S32 imageShapeIndex, ShapeBaseImageData::StateData* lastState=NULL); diff --git a/Engine/source/T3D/shapeImage.cpp b/Engine/source/T3D/shapeImage.cpp index b60105329..ab43a0ba3 100644 --- a/Engine/source/T3D/shapeImage.cpp +++ b/Engine/source/T3D/shapeImage.cpp @@ -132,7 +132,7 @@ ShapeBaseImageData::StateData::StateData() loaded = IgnoreLoaded; spin = IgnoreSpin; recoil = NoRecoil; - //sound = 0; + sound = NULL; emitter = NULL; shapeSequence = NULL; shapeSequenceScale = true; @@ -156,6 +156,7 @@ ShapeBaseImageData::StateData::StateData() flashSequence[i] = false; emitterNode[i] = -1; } + } static ShapeBaseImageData::StateData gDefaultStateData; @@ -369,7 +370,8 @@ bool ShapeBaseImageData::onAdd() s.shapeSequence = stateShapeSequence[i]; s.shapeSequenceScale = stateScaleShapeSequence[i]; - _setstateSound(getstateSound(i),i); + //_setstateSound(getstateSound(i),i); + s.sound = getstateSoundAsset(i); s.script = stateScript[i]; s.emitter = stateEmitter[i]; s.emitterTime = stateEmitterTime[i]; @@ -2761,7 +2763,7 @@ void ShapeBase::setImageState(U32 imageSlot, U32 newState,bool force) // Delete any loooping sounds that were in the previous state. // this is the crazy bit =/ needs to know prev state in order to stop sounds. // lastState does not return an id for the prev state so we keep track of it. - if (image.dataBlock->getstateSound(prevState) && image.dataBlock->getstateSoundProfile(prevState)->getDescription()->mIsLooping) + if (lastState->sound && lastState->sound->getSfxProfile()->getDescription()->mIsLooping) { for(Vector::iterator i = image.mSoundSources.begin(); i != image.mSoundSources.end(); i++) SFX_DELETE((*i)); @@ -2770,15 +2772,12 @@ void ShapeBase::setImageState(U32 imageSlot, U32 newState,bool force) } // Play sound - if( image.dataBlock->getstateSound(newState) && isGhost() ) + if( stateData.sound && isGhost() ) { const Point3F& velocity = getVelocity(); - image.addSoundSource(SFX->createSource(image.dataBlock->getstateSoundProfile(newState), &getRenderTransform(), &velocity )); + image.addSoundSource(SFX->createSource(stateData.sound->getSfxProfile(), &getRenderTransform(), &velocity )); } - /// update our prevState. - prevState = newState; - // Play animation updateAnimThread(imageSlot, imageShapeIndex, lastState); for (U32 i=0; i