diff --git a/source/fx/fx.cpp b/source/fx/fx.cpp index c23020d72..84c8614a4 100644 --- a/source/fx/fx.cpp +++ b/source/fx/fx.cpp @@ -431,7 +431,7 @@ void CFX::killFX() } if (EndSnd) { - CSoundMediator::playSfx( (CSoundMediator::SFXID)EndSnd,false); + CSoundMediator::playSfx( (CSoundMediator::SFXID)EndSnd,false,true); } } diff --git a/source/fx/fxbaseanim.cpp b/source/fx/fxbaseanim.cpp index 7e99b3da2..2de14de37 100644 --- a/source/fx/fxbaseanim.cpp +++ b/source/fx/fxbaseanim.cpp @@ -44,9 +44,20 @@ void CFXBaseAnim::think(int _frames) MaxFrame=((BaseData->EndFrame-BaseData->StartFrame)<FrameShift)-1; Flags|=BaseData->Flags; renderFrame=BaseData->StartFrame; - if (BaseData->StartSnd) + if(m_soundId==NOT_PLAYING) { - CSoundMediator::playSfx((CSoundMediator::SFXID)BaseData->StartSnd,false); + if (BaseData->StartSnd) + { + m_soundId=CSoundMediator::playSfx((CSoundMediator::SFXID)BaseData->StartSnd,true,true); + } + } + else + { + if(!CSoundMediator::isSfxStillPlaying(m_soundId)) + { + CSoundMediator::stopAndUnlockSfx(m_soundId); + m_soundId=NOT_PLAYING; + } } EndSnd=BaseData->EndSnd; HasInit=true; diff --git a/source/fx/fxsteam.cpp b/source/fx/fxsteam.cpp index 3c48c0773..7f6fb80ae 100644 --- a/source/fx/fxsteam.cpp +++ b/source/fx/fxsteam.cpp @@ -119,7 +119,7 @@ int TotalLife=0; if(m_soundId==NOT_PLAYING) { - m_soundId=CSoundMediator::playSfx( CSoundMediator::SFX_HAZARD__STEAM,true); + m_soundId=CSoundMediator::playSfx( CSoundMediator::SFX_HAZARD__STEAM,true,true); } else { diff --git a/source/triggers/tsemit.cpp b/source/triggers/tsemit.cpp index 4ea83d55f..bdaf4f20a 100644 --- a/source/triggers/tsemit.cpp +++ b/source/triggers/tsemit.cpp @@ -22,49 +22,6 @@ #include "fx\fxsteam.h" -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -void CSteamEmitterTrigger::init() -{ - CTrigger::init(); - - m_soundId = (int) NOT_PLAYING; -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -void CSteamEmitterTrigger::think(int _frames) -{ - if ( m_soundId == NOT_PLAYING ) - { - m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_HAZARD__STEAM, true ); - } - else - { - if( !CSoundMediator::isSfxStillPlaying( (xmPlayingId) m_soundId ) ) - { - // unlock sound if it has finished - - CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId ); - m_soundId = NOT_PLAYING; - } - } - - CTrigger::think( _frames ); -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -void CSteamEmitterTrigger::shutdown() -{ - if ( m_soundId != NOT_PLAYING ) - { - CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId ); - } - - CTrigger::shutdown(); -} - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void CSteamEmitterTrigger::setPositionAndSize(int _x,int _y,int _w,int _h) diff --git a/source/triggers/tsemit.h b/source/triggers/tsemit.h index e56e2f44d..497a9629a 100644 --- a/source/triggers/tsemit.h +++ b/source/triggers/tsemit.h @@ -43,9 +43,6 @@ class CSteamEmitterTrigger : public CTrigger { public: - void init(); - void think(int _frames); - void shutdown(); virtual void setPositionAndSize(int _x,int _y,int _w,int _h); protected: CFX *m_effect;