diff --git a/source/fx/fxgeyser.cpp b/source/fx/fxgeyser.cpp index ed58201bf..555cfcb34 100644 --- a/source/fx/fxgeyser.cpp +++ b/source/fx/fxgeyser.cpp @@ -21,7 +21,18 @@ void CFXGeyser::init(DVECTOR const &_Pos) CFX::init(_Pos); Height=TargetHeight=8; currentFrame=FRM__GUSH000; -/* m_soundId=*/CSoundMediator::playSfx(CSoundMediator::SFX_WORLD_OBJECT__GEYSER,false); + SoundId = NOT_PLAYING; +} + +/*****************************************************************************/ +void CFXGeyser::shutdown() +{ + if ( SoundId != NOT_PLAYING ) + { + CSoundMediator::stopAndUnlockSfx( (xmPlayingId) SoundId ); + } + + CFX::shutdown(); } /*****************************************************************************/ @@ -50,6 +61,14 @@ CThing *Parent=getParent(); getFXRenderPos(RenderPos); if (!canRender() || Flags & FX_FLAG_HIDDEN) return; + if( SoundId != NOT_PLAYING && !CSoundMediator::isSfxStillPlaying( (xmPlayingId) SoundId ) ) + { + // unlock sound if it has finished + + CSoundMediator::stopAndUnlockSfx( (xmPlayingId) SoundId ); + SoundId = NOT_PLAYING; + } + // is it attached to a platform? if (Parent) { // yes, so get pos, and return @@ -63,6 +82,11 @@ CThing *Parent=getParent(); if ( Height > 10 ) { Flags |= FX_FLAG_INJURE_PLAYER; + + if ( SoundId == NOT_PLAYING ) + { + SoundId = (int) CSoundMediator::playSfx(CSoundMediator::SFX_WORLD_OBJECT__GEYSER,true); + } } else { diff --git a/source/fx/fxgeyser.h b/source/fx/fxgeyser.h index f6d11c03c..de8aaaccc 100644 --- a/source/fx/fxgeyser.h +++ b/source/fx/fxgeyser.h @@ -15,12 +15,14 @@ public: /*virtual */void init(DVECTOR const &Pos); /*virtual */void think(int Frames); /*virtual */void render(); + void shutdown(); void setHeight(int H) {TargetHeight=H;} protected: s16 TargetHeight,Height; u16 currentFrame; + int SoundId; }; #endif