From 82afdfce50d706f760bae070a682db6049777de3 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 29 Jun 2001 14:57:20 +0000 Subject: [PATCH] --- source/enemy/npc.cpp | 17 ----------------- source/enemy/npcpath.h | 1 - source/friend/fgary.cpp | 35 +++++++++++++++++++++++++++++++++-- source/friend/fgary.h | 2 ++ source/hazard/hazard.cpp | 3 --- source/platform/pfishhk.cpp | 1 - source/platform/pfishhk3.cpp | 1 - source/platform/platform.cpp | 3 --- source/platform/platform.h | 1 - source/projectl/projectl.cpp | 2 -- 10 files changed, 35 insertions(+), 31 deletions(-) diff --git a/source/enemy/npc.cpp b/source/enemy/npc.cpp index 66a28d588..bd4045b07 100644 --- a/source/enemy/npc.cpp +++ b/source/enemy/npc.cpp @@ -544,20 +544,6 @@ void CNpcEnemy::setThinkArea() //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/*void CNpcEnemy::addWaypoint( u16 *ptr ) -{ - m_npcPath.addWaypoint( ptr ); -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -void CNpcEnemy::addWaypoint( u16 *ptrX, u16 *ptrY ) -{ - m_npcPath.addWaypoint( ptrX, ptrY ); -}*/ - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - void CNpcEnemy::setStartPos( s32 xPos, s32 yPos ) { Pos.vx = ( xPos << 4 ) + 8; @@ -622,7 +608,6 @@ void CNpcEnemy::init() m_npcPath.initPath(); -// m_isShuttingDown = false; m_drawRotation = 0; m_isCaught = false; m_isBlowerOn = false; @@ -680,8 +665,6 @@ void CNpcEnemy::shutdown() CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId ); } - //m_npcPath.removeAllWaypoints(); - if (m_actorGfx) delete m_actorGfx; CEnemyThing::shutdown(); diff --git a/source/enemy/npcpath.h b/source/enemy/npcpath.h index 41c2a1e4d..4c8ad93c0 100644 --- a/source/enemy/npcpath.h +++ b/source/enemy/npcpath.h @@ -27,7 +27,6 @@ public: }; void initPath(); - void removeAllWaypoints(); void setPathType( u8 newPathType ); u8 getPathType(); bool incPath(); diff --git a/source/friend/fgary.cpp b/source/friend/fgary.cpp index d7663df12..37478ab65 100644 --- a/source/friend/fgary.cpp +++ b/source/friend/fgary.cpp @@ -45,12 +45,37 @@ void CNpcGaryFriend::postInit() m_started = false; m_fallDeath = false; m_drawRotation = 0; + + m_soundId = (int) NOT_PLAYING; +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcGaryFriend::shutdown() +{ + if ( m_soundId != NOT_PLAYING ) + { + CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId ); + } + + CNpcFriend::shutdown(); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void CNpcGaryFriend::think( int _frames ) { + if ( m_soundId != NOT_PLAYING ) + { + if( !CSoundMediator::isSfxStillPlaying( (xmPlayingId) m_soundId ) ) + { + // unlock sound if it has finished + + CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId ); + m_soundId = NOT_PLAYING; + } + } + if ( m_animPlaying ) { s32 frameCount; @@ -169,7 +194,10 @@ void CNpcGaryFriend::think( int _frames ) if ( m_started ) { - //CSoundMediator::playSfx( CSoundMediator::SFX_GARY_DE_SNAIL ); + if ( m_soundId == NOT_PLAYING ) + { + m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_GARY_DE_SNAIL, true ); + } Pos.vx += multiplier * 2 * _frames; } @@ -195,7 +223,10 @@ void CNpcGaryFriend::think( int _frames ) { if ( m_started ) { - //CSoundMediator::playSfx( CSoundMediator::SFX_GARY_DE_SNAIL ); + if ( m_soundId == NOT_PLAYING ) + { + m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_GARY_DE_SNAIL, true ); + } Pos.vx += multiplier * 2 * _frames; } diff --git a/source/friend/fgary.h b/source/friend/fgary.h index 8104a6329..2caba3794 100644 --- a/source/friend/fgary.h +++ b/source/friend/fgary.h @@ -22,6 +22,7 @@ class CNpcGaryFriend : public CNpcFriend { public: virtual void postInit(); + virtual void shutdown(); virtual void think( int _frames ); virtual void setupWaypoints( sThingActor *ThisActor ); bool alwaysThink() {return(true);} @@ -38,6 +39,7 @@ protected: u8 m_fallDeath; s16 m_speed; s16 m_drawRotation; + int m_soundId; }; #endif \ No newline at end of file diff --git a/source/hazard/hazard.cpp b/source/hazard/hazard.cpp index b99209270..02b225744 100644 --- a/source/hazard/hazard.cpp +++ b/source/hazard/hazard.cpp @@ -437,9 +437,6 @@ void CNpcHazard::shutdown() } delete m_modelGfx; - // remove waypoints - - //m_npcPath.removeAllWaypoints(); //if (m_actorGfx) delete m_actorGfx; diff --git a/source/platform/pfishhk.cpp b/source/platform/pfishhk.cpp index 30dbc2e8b..76b0e21fe 100644 --- a/source/platform/pfishhk.cpp +++ b/source/platform/pfishhk.cpp @@ -42,7 +42,6 @@ void CNpcFishHookPlatform::postInit() m_isMoving = false; m_isResetting = false; - m_isShuttingDown = false; m_lineBase.vx = Pos.vx; m_lineBase.vy = 0; m_bobTimer = 0; diff --git a/source/platform/pfishhk3.cpp b/source/platform/pfishhk3.cpp index a13084c33..93ec7557e 100644 --- a/source/platform/pfishhk3.cpp +++ b/source/platform/pfishhk3.cpp @@ -27,7 +27,6 @@ void CNpcFishHook3Platform::postInit() m_isMoving = false; m_isResetting = false; - m_isShuttingDown = false; m_lineBase.vx = Pos.vx; m_lineBase.vy = 0; } diff --git a/source/platform/platform.cpp b/source/platform/platform.cpp index e5af297c8..7237cdf05 100644 --- a/source/platform/platform.cpp +++ b/source/platform/platform.cpp @@ -611,8 +611,6 @@ void CNpcPlatform::init() m_lifetime = 0; m_lifetimeType = m_dataPtr->lifetimeType; - m_isShuttingDown = false; - m_npcPath.initPath(); m_speed = m_dataPtr->speed; @@ -699,7 +697,6 @@ void CNpcPlatform::shutdown() } delete m_modelGfx; - //m_npcPath.removeAllWaypoints(); // temporary CPlatformThing::shutdown(); diff --git a/source/platform/platform.h b/source/platform/platform.h index dd62ce996..90509532a 100644 --- a/source/platform/platform.h +++ b/source/platform/platform.h @@ -225,7 +225,6 @@ protected: s16 m_initRotation; CModelGfx *m_modelGfx; - u8 m_isShuttingDown; int m_graphicNum; diff --git a/source/projectl/projectl.cpp b/source/projectl/projectl.cpp index 4ad1f3623..63dadde2c 100644 --- a/source/projectl/projectl.cpp +++ b/source/projectl/projectl.cpp @@ -84,7 +84,6 @@ void CProjectile::init() m_state = PROJECTILE_ATTACK; m_turnSpeed = 256; m_extension = 0; -// m_isShuttingDown = false; m_ot = OTPOS__ACTOR_POS; m_speed = 3; updateCollisionArea(); @@ -502,7 +501,6 @@ void CPlayerProjectile::init() m_extension = 0; m_frame = 0; m_reversed = 0; -// m_isShuttingDown = false; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////