From 08027943d1204a2263ba6470350283d698ef2982 Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 12 Jul 2001 18:53:06 +0000 Subject: [PATCH] --- source/enemy/nsstomp.cpp | 7 +++++++ source/platform/pcbubble.cpp | 5 +++++ source/platform/pgbubble.cpp | 10 ++++++++++ source/platform/pplayer.cpp | 5 +++++ source/player/pmjelly.cpp | 2 ++ source/triggers/tsemit.cpp | 33 +++++++++++++++++++++++++++++++++ source/triggers/tsemit.h | 4 ++++ 7 files changed, 66 insertions(+) diff --git a/source/enemy/nsstomp.cpp b/source/enemy/nsstomp.cpp index 0c668c6b4..b867f2afc 100644 --- a/source/enemy/nsstomp.cpp +++ b/source/enemy/nsstomp.cpp @@ -115,6 +115,13 @@ void CNpcSkullStomperEnemy::processClose( int _frames ) { // colliding with ground + if( m_soundId != NOT_PLAYING ) + { + CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId ); + } + + m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_HAZARD__FALLING_ROCK_LAND, true ); + Pos.vy += groundHeight; // pause and change direction diff --git a/source/platform/pcbubble.cpp b/source/platform/pcbubble.cpp index 436ae3612..d358e79bc 100644 --- a/source/platform/pcbubble.cpp +++ b/source/platform/pcbubble.cpp @@ -91,6 +91,11 @@ void CNpcCollapsingBubblePlatform::processLifetime( int _frames ) { m_lifetime = GameState::getOneSecondInFrames() >> 2; m_pop = true; + + if ( m_soundId == NOT_PLAYING ) + { + m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_BALLOON_POP, true ); + } } else if ( m_lifetime <= ( GameState::getOneSecondInFrames() >> 1 ) ) { diff --git a/source/platform/pgbubble.cpp b/source/platform/pgbubble.cpp index 3d1d3d6b2..8bb6a2376 100644 --- a/source/platform/pgbubble.cpp +++ b/source/platform/pgbubble.cpp @@ -59,6 +59,11 @@ void CNpcGeyserBubblePlatform::processMovement( int _frames ) { m_lifetime = GameState::getOneSecondInFrames() >> 2; m_pop = true; + + if ( m_soundId == NOT_PLAYING ) + { + m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_BALLOON_POP, true ); + } } } else @@ -67,6 +72,11 @@ void CNpcGeyserBubblePlatform::processMovement( int _frames ) { m_lifetime = GameState::getOneSecondInFrames() >> 2; m_pop = true; + + if ( m_soundId == NOT_PLAYING ) + { + m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_BALLOON_POP, true ); + } } } diff --git a/source/platform/pplayer.cpp b/source/platform/pplayer.cpp index 2a7bab8ad..1dd0a0431 100644 --- a/source/platform/pplayer.cpp +++ b/source/platform/pplayer.cpp @@ -43,6 +43,11 @@ void CNpcPlayerBubblePlatform::processLifetime( int _frames ) { m_pop = true; + if ( m_soundId == NOT_PLAYING ) + { + m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_BALLOON_POP, true ); + } + m_lifetime = GameState::getOneSecondInFrames() >> 2; } else if ( m_lifetime <= ( GameState::getOneSecondInFrames() >> 1 ) ) diff --git a/source/player/pmjelly.cpp b/source/player/pmjelly.cpp index 8fa897330..2b0f4afb3 100644 --- a/source/player/pmjelly.cpp +++ b/source/player/pmjelly.cpp @@ -379,6 +379,8 @@ void CPlayerModeJellyLauncher::launchProjectile() int fireHeading; CPlayerProjectile *projectile; + CSoundMediator::playSfx(CSoundMediator::SFX_JELLY_LAUNCHER); + playerFacing=m_player->getFacing(); launchPos=getPlayerPos(); launchPos.vx+=playerFacing*jellyLaunchPos.vx; diff --git a/source/triggers/tsemit.cpp b/source/triggers/tsemit.cpp index bdaf4f20a..8094260e8 100644 --- a/source/triggers/tsemit.cpp +++ b/source/triggers/tsemit.cpp @@ -22,6 +22,39 @@ #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 ); + } + + 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 411fa9b6d..e56e2f44d 100644 --- a/source/triggers/tsemit.h +++ b/source/triggers/tsemit.h @@ -43,9 +43,13 @@ 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; + int m_soundId; }; /*----------------------------------------------------------------------