This commit is contained in:
parent
bd6fd54608
commit
16c576b885
34 changed files with 288 additions and 49 deletions
|
@ -193,7 +193,7 @@ PICKUP_GFX_IN := $(foreach FILE,$(PICKUP_GFX),$(PICKUP_GFX_DIR)/$(FILE).bmp)
|
|||
|
||||
INGAMEFX_GFX_DIR := $(GRAF_DIR)/ingamefx
|
||||
INGAMEFX_GFX_TRANS := +watermeter +waterhilight +netblob \
|
||||
+spike
|
||||
+spike +sharkmine
|
||||
INGAMEFX_GFX_TRANS_NONROT_NONCLIP := +bubble_1 +bubble_2 +bubble_3 \
|
||||
+water +aim_arrow
|
||||
|
||||
|
|
|
@ -194,7 +194,10 @@ void CNpcAnemone1Enemy::processClose( int _frames )
|
|||
|
||||
m_drawRotation = ( m_heading + 1024 ) & 4095;
|
||||
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_ANEMONE_MOVE );
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_ANEMONE_MOVE, true );
|
||||
}
|
||||
}
|
||||
|
||||
if ( withinRange )
|
||||
|
@ -230,7 +233,12 @@ void CNpcAnemone1Enemy::processClose( int _frames )
|
|||
{
|
||||
// if firing anim is complete and user is still in range, fire projectile
|
||||
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_ANEMONE_ATTACK_LEVEL1 );
|
||||
if( m_soundId != NOT_PLAYING )
|
||||
{
|
||||
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
|
||||
}
|
||||
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_ANEMONE_ATTACK_LEVEL1, true );
|
||||
|
||||
DVECTOR projPos;
|
||||
projPos = Pos;
|
||||
|
@ -331,7 +339,12 @@ void CNpcAnemone2Enemy::processShot( int _frames )
|
|||
|
||||
if ( m_data[m_type].deathSfx < CSoundMediator::NUM_SFXIDS )
|
||||
{
|
||||
CSoundMediator::playSfx( m_data[m_type].deathSfx );
|
||||
if( m_soundId != NOT_PLAYING )
|
||||
{
|
||||
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
|
||||
}
|
||||
|
||||
m_soundId = (int) CSoundMediator::playSfx( m_data[m_type].deathSfx, true );
|
||||
}
|
||||
|
||||
deleteAllChild();
|
||||
|
@ -402,7 +415,11 @@ void CNpcAnemone2Enemy::processClose( int _frames )
|
|||
}
|
||||
else
|
||||
{
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_ANEMONE_ATTACK_LEVEL2 );
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_ANEMONE_ATTACK_LEVEL2, true );
|
||||
}
|
||||
|
||||
CProjectile *projectile;
|
||||
s16 heading;
|
||||
|
||||
|
@ -579,7 +596,10 @@ void CNpcAnemone3Enemy::processClose( int _frames )
|
|||
}
|
||||
else if ( !m_animPlaying )
|
||||
{
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_ANEMONE_ATTACK_LEVEL3 );
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_ANEMONE_ATTACK_LEVEL3, true );
|
||||
}
|
||||
|
||||
CProjectile *projectile;
|
||||
u8 lifetime = 8;
|
||||
|
|
|
@ -86,7 +86,10 @@ void CNpcBallBlobEnemy::processMovement( int _frames )
|
|||
|
||||
if ( m_data[m_type].moveSfx < CSoundMediator::NUM_SFXIDS )
|
||||
{
|
||||
CSoundMediator::playSfx( m_data[m_type].moveSfx );
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( m_data[m_type].moveSfx, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,10 @@ bool CNpcClamEnemy::processSensor()
|
|||
m_extendDir = EXTEND_UP;
|
||||
m_extension = 0;
|
||||
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_CLAM_MOVE );
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_CLAM_MOVE, true );
|
||||
}
|
||||
|
||||
return( true );
|
||||
}
|
||||
|
@ -254,7 +257,11 @@ void CNpcStaticClamEnemy::collidedWith( CThing *_thisThing )
|
|||
if ( m_frame != 0 )
|
||||
{
|
||||
m_frame = 0;
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_CLAM_ATTACK );
|
||||
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_CLAM_ATTACK, true );
|
||||
}
|
||||
}
|
||||
|
||||
m_isStunned = 2 * GameState::getOneSecondInFrames();
|
||||
|
@ -321,7 +328,11 @@ void CNpcStaticClamEnemy::processAnimFrames( int _frames )
|
|||
{
|
||||
m_frame = 0;
|
||||
m_animPlaying = false;
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_CLAM_ATTACK );
|
||||
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_CLAM_ATTACK, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ void CNpcIronDogfishEnemy::postInit()
|
|||
|
||||
bool CNpcIronDogfishEnemy::processSensor()
|
||||
{
|
||||
/*switch( m_sensorFunc )
|
||||
switch( m_sensorFunc )
|
||||
{
|
||||
case NPC_SENSOR_NONE:
|
||||
return( false );
|
||||
|
@ -83,9 +83,7 @@ bool CNpcIronDogfishEnemy::processSensor()
|
|||
return( false );
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
return( false );
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -347,7 +345,9 @@ void CNpcIronDogfishEnemy::hasBeenSteamed( DVECTOR &steamPos )
|
|||
if ( m_steamTimer <= 0 )
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_MOVEMENT;
|
||||
m_vulnerableTimer = 2 * GameState::getOneSecondInFrames();
|
||||
|
||||
s16 second = GameState::getOneSecondInFrames();
|
||||
m_vulnerableTimer = ( 2 * second ) + ( 2 * second * ( ( m_data[m_type].initHealth - m_health ) / m_data[m_type].initHealth ) );
|
||||
|
||||
//hasBeenAttacked();
|
||||
m_steamTimer = 4 * GameState::getOneSecondInFrames();
|
||||
|
@ -425,7 +425,12 @@ void CNpcIronDogfishEnemy::processShot( int _frames )
|
|||
|
||||
if ( m_data[m_type].deathSfx < CSoundMediator::NUM_SFXIDS )
|
||||
{
|
||||
CSoundMediator::playSfx( m_data[m_type].deathSfx );
|
||||
if( m_soundId != NOT_PLAYING )
|
||||
{
|
||||
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
|
||||
}
|
||||
|
||||
m_soundId = (int) CSoundMediator::playSfx( m_data[m_type].deathSfx, true );
|
||||
}
|
||||
|
||||
m_speed = -5;
|
||||
|
|
|
@ -119,7 +119,10 @@ CThing *Next=getNext();
|
|||
|
||||
// sound
|
||||
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_EYEBALL_SENTRY_ATTACK );
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_EYEBALL_SENTRY_ATTACK, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -139,7 +142,10 @@ CThing *Next=getNext();
|
|||
|
||||
// sound
|
||||
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_EYEBALL_SENTRY_ATTACK );
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_EYEBALL_SENTRY_ATTACK, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -344,7 +344,12 @@ void CNpcFlyingDutchmanEnemy::processShot( int _frames )
|
|||
|
||||
if ( m_data[m_type].deathSfx < CSoundMediator::NUM_SFXIDS )
|
||||
{
|
||||
CSoundMediator::playSfx( m_data[m_type].deathSfx );
|
||||
if( m_soundId != NOT_PLAYING )
|
||||
{
|
||||
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
|
||||
}
|
||||
|
||||
m_soundId = (int) CSoundMediator::playSfx( m_data[m_type].deathSfx, true );
|
||||
}
|
||||
|
||||
m_speed = -5;
|
||||
|
|
|
@ -67,7 +67,10 @@ void CNpcFlamingSkullEnemy::processClose( int _frames )
|
|||
s32 distX, distY;
|
||||
s32 distXSqr, distYSqr;
|
||||
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_FLAMING_SKULL_ATTACK );
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_FLAMING_SKULL_ATTACK, true );
|
||||
}
|
||||
|
||||
if ( m_state == FLAMING_SKULL_ATTACK )
|
||||
{
|
||||
|
|
|
@ -60,6 +60,12 @@ bool CNpcHermitCrabEnemy::processSensor()
|
|||
{
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
|
||||
if( m_soundId != NOT_PLAYING )
|
||||
{
|
||||
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
|
||||
m_soundId = NOT_PLAYING;
|
||||
}
|
||||
|
||||
return( true );
|
||||
}
|
||||
else
|
||||
|
@ -235,7 +241,10 @@ void CNpcHermitCrabEnemy::processClose( int _frames )
|
|||
|
||||
// sound
|
||||
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_HERMIT_CRAB_ATTACK );
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_HERMIT_CRAB_ATTACK, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -272,5 +281,8 @@ void CNpcHermitCrabEnemy::processMovementModifier( int _frames, s32 distX, s32 d
|
|||
|
||||
// sound
|
||||
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_HERMIT_CRAB_MOVE );
|
||||
if( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_HERMIT_CRAB_MOVE, true );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,8 +50,4 @@ void CNpcPricklyBugEnemy::processMovementModifier( int _frames, s32 distX, s32 d
|
|||
s16 heading = ratan2( yDist, xDist );
|
||||
|
||||
m_drawRotation = heading;
|
||||
|
||||
// sound
|
||||
|
||||
//CSoundMediator::playSfx( CSoundMediator::SFX_PRICKLY_BUG_MOVE );
|
||||
}
|
||||
|
|
|
@ -599,6 +599,8 @@ void CNpcEnemy::init()
|
|||
m_heading = 0;
|
||||
m_RGB = 0;
|
||||
|
||||
m_soundId = (int) NOT_PLAYING;
|
||||
|
||||
updateCollisionArea();
|
||||
}
|
||||
|
||||
|
@ -642,6 +644,11 @@ void CNpcEnemy::reinit()
|
|||
|
||||
void CNpcEnemy::shutdown()
|
||||
{
|
||||
if ( m_soundId != NOT_PLAYING )
|
||||
{
|
||||
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
|
||||
}
|
||||
|
||||
//m_npcPath.removeAllWaypoints();
|
||||
|
||||
if (m_actorGfx) delete m_actorGfx;
|
||||
|
@ -651,6 +658,17 @@ void CNpcEnemy::shutdown()
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcEnemy::leftThinkZone(int _frames)
|
||||
{
|
||||
if ( m_soundId != NOT_PLAYING )
|
||||
{
|
||||
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
|
||||
m_soundId = NOT_PLAYING;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int CNpcEnemy::getFrameCount()
|
||||
{
|
||||
return( m_actorGfx->getFrameCount( m_animNo ) );
|
||||
|
@ -720,6 +738,17 @@ void CNpcEnemy::think(int _frames)
|
|||
playerXDistSqr = playerXDist * playerXDist;
|
||||
playerYDistSqr = playerYDist * playerYDist;
|
||||
|
||||
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_isCaught )
|
||||
{
|
||||
processCoralBlower( moveFrames );
|
||||
|
@ -1060,9 +1089,9 @@ void CNpcEnemy::processMovement(int _frames)
|
|||
s32 moveVel = 0;
|
||||
s32 moveDist = 0;
|
||||
|
||||
if ( m_data[m_type].moveSfx < CSoundMediator::NUM_SFXIDS )
|
||||
if ( m_soundId == NOT_PLAYING && m_data[m_type].moveSfx < CSoundMediator::NUM_SFXIDS )
|
||||
{
|
||||
CSoundMediator::playSfx( m_data[m_type].moveSfx );
|
||||
m_soundId = (int) CSoundMediator::playSfx( m_data[m_type].moveSfx, true );
|
||||
}
|
||||
|
||||
switch( m_movementFunc )
|
||||
|
@ -1201,7 +1230,12 @@ void CNpcEnemy::processShot( int _frames )
|
|||
|
||||
if ( m_data[m_type].deathSfx < CSoundMediator::NUM_SFXIDS )
|
||||
{
|
||||
CSoundMediator::playSfx( m_data[m_type].deathSfx );
|
||||
if( m_soundId != NOT_PLAYING )
|
||||
{
|
||||
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
|
||||
}
|
||||
|
||||
m_soundId = (int) CSoundMediator::playSfx( m_data[m_type].deathSfx, true );
|
||||
}
|
||||
|
||||
m_speed = -5;
|
||||
|
|
|
@ -118,6 +118,7 @@ public:
|
|||
virtual int getFrame() {return( m_frame );}
|
||||
void setSpeed( s16 newSpeed ) {m_speed = newSpeed;}
|
||||
virtual u32 getRGB() {return( m_RGB );}
|
||||
virtual void leftThinkZone(int _frames);
|
||||
|
||||
static CNpcEnemy *Create(int enemyType);
|
||||
static CNpcEnemy *Create(sThingActor *ThisActor);
|
||||
|
@ -311,6 +312,7 @@ protected:
|
|||
s16 m_speed;
|
||||
u8 m_isDying;
|
||||
u32 m_RGB;
|
||||
int m_soundId;
|
||||
|
||||
s32 m_frame;
|
||||
int m_animNo;
|
||||
|
|
|
@ -1008,7 +1008,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
|||
false,
|
||||
3,
|
||||
2048,
|
||||
DETECT_ALL_COLLISION,
|
||||
//DETECT_ALL_COLLISION,
|
||||
DETECT_ATTACK_COLLISION_GENERIC,
|
||||
DAMAGE__HIT_ENEMY,
|
||||
50,
|
||||
ANIM_IRONDOGFISH_WALK,
|
||||
|
|
|
@ -99,7 +99,12 @@ bool CNpcSpiderCrabEnemy::processSensor()
|
|||
|
||||
// sound
|
||||
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_SPIDERCRAB_ATTACK );
|
||||
if( m_soundId != NOT_PLAYING )
|
||||
{
|
||||
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
|
||||
}
|
||||
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_SPIDERCRAB_ATTACK, true );
|
||||
|
||||
return( true );
|
||||
}
|
||||
|
|
|
@ -138,7 +138,12 @@ bool CNpcSquidDartEnemy::processSensor()
|
|||
|
||||
// sound
|
||||
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_SQUIDDART_ATTACK );
|
||||
if( m_soundId != NOT_PLAYING )
|
||||
{
|
||||
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
|
||||
}
|
||||
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_SQUIDDART_ATTACK, true );
|
||||
|
||||
return( true );
|
||||
}
|
||||
|
|
|
@ -39,6 +39,10 @@
|
|||
#include "system\vid.h"
|
||||
#endif
|
||||
|
||||
#ifndef __SPR_SPRITES_H__
|
||||
#include <sprites.h>
|
||||
#endif
|
||||
|
||||
#include "fx\fx.h"
|
||||
#include "fx\fxnrgbar.h"
|
||||
|
||||
|
@ -89,6 +93,7 @@ void CNpcSubSharkEnemy::processMovement( int _frames )
|
|||
CProjectile *projectile;
|
||||
projectile = CProjectile::Create();
|
||||
projectile->init( Pos, 1024, CProjectile::PROJECTILE_MINE, CProjectile::PROJECTILE_FINITE_LIFE );
|
||||
projectile->setGraphic( FRM__SHARKMINE );
|
||||
|
||||
m_salvoCount--;
|
||||
|
||||
|
@ -358,7 +363,12 @@ void CNpcSubSharkEnemy::processShot( int _frames )
|
|||
|
||||
if ( m_data[m_type].deathSfx < CSoundMediator::NUM_SFXIDS )
|
||||
{
|
||||
CSoundMediator::playSfx( m_data[m_type].deathSfx );
|
||||
if( m_soundId != NOT_PLAYING )
|
||||
{
|
||||
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
|
||||
}
|
||||
|
||||
m_soundId = (int) CSoundMediator::playSfx( m_data[m_type].deathSfx, true );
|
||||
}
|
||||
|
||||
m_speed = -5;
|
||||
|
|
|
@ -261,7 +261,10 @@ void CNpcSeaSnakeEnemy::processMovement( int _frames )
|
|||
|
||||
if ( m_data[m_type].moveSfx < CSoundMediator::NUM_SFXIDS )
|
||||
{
|
||||
CSoundMediator::playSfx( m_data[m_type].moveSfx );
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( m_data[m_type].moveSfx, true );
|
||||
}
|
||||
}
|
||||
|
||||
processGenericFixedPathMove( _frames, &moveX, &moveY, &moveVel, &moveDist );
|
||||
|
|
|
@ -67,7 +67,13 @@ bool CNpcSkullStomperEnemy::processSensor()
|
|||
{
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
m_extendDir = EXTEND_DOWN;
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_SKULL_ATTACK );
|
||||
|
||||
if( m_soundId != NOT_PLAYING )
|
||||
{
|
||||
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
|
||||
}
|
||||
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_SKULL_ATTACK, true );
|
||||
|
||||
return( true );
|
||||
}
|
||||
|
|
|
@ -638,7 +638,12 @@ void CNpcParasiticWormEnemy::processShot( int _frames )
|
|||
|
||||
if ( m_data[m_type].deathSfx < CSoundMediator::NUM_SFXIDS )
|
||||
{
|
||||
CSoundMediator::playSfx( m_data[m_type].deathSfx );
|
||||
if( m_soundId != NOT_PLAYING )
|
||||
{
|
||||
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
|
||||
}
|
||||
|
||||
m_soundId = CSoundMediator::playSfx( m_data[m_type].deathSfx, true );
|
||||
}
|
||||
|
||||
m_isDying = true;
|
||||
|
|
|
@ -400,6 +400,8 @@ void CNpcHazard::init()
|
|||
m_extendDir = 0;
|
||||
m_heading = 0;
|
||||
|
||||
m_soundId = (int) NOT_PLAYING;
|
||||
|
||||
clearPlatform();
|
||||
}
|
||||
|
||||
|
@ -419,6 +421,11 @@ void CNpcHazard::setGraphic( sThingHazard *ThisHazard )
|
|||
|
||||
void CNpcHazard::shutdown()
|
||||
{
|
||||
if ( m_soundId != NOT_PLAYING )
|
||||
{
|
||||
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
|
||||
}
|
||||
|
||||
delete m_modelGfx;
|
||||
// remove waypoints
|
||||
|
||||
|
@ -431,8 +438,30 @@ void CNpcHazard::shutdown()
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcHazard::leftThinkZone(int _frames)
|
||||
{
|
||||
if ( m_soundId != NOT_PLAYING )
|
||||
{
|
||||
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
|
||||
m_soundId = NOT_PLAYING;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcHazard::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;
|
||||
}
|
||||
}
|
||||
|
||||
CHazardThing::think(_frames);
|
||||
|
||||
if ( m_isActive )
|
||||
|
|
|
@ -82,6 +82,7 @@ public:
|
|||
void setWaypointCount( u8 newCount ) {m_npcPath.setWaypointCount( newCount );}
|
||||
virtual void setRespawnRate( s16 newRespawnRate ) {m_respawnRate=newRespawnRate;}
|
||||
virtual void trigger() {}
|
||||
virtual void leftThinkZone(int _frames);
|
||||
|
||||
static NPC_HAZARD_UNIT_TYPE getTypeFromMapEdit( u16 newType );
|
||||
static CNpcHazard *Create(int Type);
|
||||
|
@ -116,6 +117,7 @@ protected:
|
|||
s32 m_heading;
|
||||
CModelGfx *m_modelGfx;
|
||||
s16 m_respawnRate;
|
||||
int m_soundId;
|
||||
|
||||
CThing *m_platform;
|
||||
|
||||
|
|
|
@ -39,7 +39,11 @@ void CNpcBigWheelHazard::processMovement( int _frames )
|
|||
{
|
||||
m_rotation += 5 * _frames;
|
||||
m_rotation &= 4095;
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_WORLD_OBJECT__BIG_WHEEL );
|
||||
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_WORLD_OBJECT__BIG_WHEEL, true );
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -40,7 +40,10 @@ void CNpcCircularSawHazard::processMovement( int _frames )
|
|||
m_rotation += 256 * _frames;
|
||||
m_rotation &= 4095;
|
||||
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_SAW );
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_SAW, true );
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -132,7 +132,10 @@ void CNpcFallingHazard::processMovement( int _frames )
|
|||
|
||||
if ( groundHeight < yMovement )
|
||||
{
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_HAZARD__ACORN_LAND );
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_HAZARD__ACORN_LAND, true );
|
||||
}
|
||||
|
||||
// colliding with ground
|
||||
|
||||
|
|
|
@ -106,7 +106,11 @@ void CNpcFireballHazard::processMovement( int _frames )
|
|||
m_isActive = false;
|
||||
m_timerActive = true;
|
||||
m_timer = ( m_respawnRate - 1 ) * GameState::getOneSecondInFrames();
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_HAZARD__FIREBALL_LAND );
|
||||
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = CSoundMediator::playSfx( CSoundMediator::SFX_HAZARD__FIREBALL_LAND, true );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -126,6 +130,9 @@ void CNpcFireballHazard::processTimer( int _frames )
|
|||
m_timerActive = false;
|
||||
m_isActive = true;
|
||||
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_HAZARD__FIREBALL_LAUNCH );
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = CSoundMediator::playSfx( CSoundMediator::SFX_HAZARD__FIREBALL_LAUNCH, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,10 @@ void CNpcMowerHazard::processMovement( int _frames )
|
|||
m_rotation += 256 * _frames;
|
||||
m_rotation &= 4095;
|
||||
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_SAW );
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_SAW, true );
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -58,7 +58,11 @@ void CNpcRockShardHazard::processMovement( int _frames )
|
|||
{
|
||||
Pos.vx = m_base.vx + ( -3 + ( getRnd() % 7 ) );
|
||||
Pos.vy = m_base.vy + ( -3 + ( getRnd() % 7 ) );
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_HAZARD__STALACTITE_RATTLE );
|
||||
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_HAZARD__STALACTITE_RATTLE, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -76,7 +80,11 @@ void CNpcRockShardHazard::processMovement( int _frames )
|
|||
m_isActive = false;
|
||||
m_timerActive = true;
|
||||
m_timer = ( m_respawnRate - 1 ) * GameState::getOneSecondInFrames();
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_HAZARD__STALACTITE_LAND );
|
||||
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_HAZARD__STALACTITE_LAND, true );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -66,7 +66,10 @@ void CNpcRollingRockHazard::processMovement( int _frames )
|
|||
{
|
||||
if ( !m_jump )
|
||||
{
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_ROLLING_ROCK );
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_ROLLING_ROCK, true );
|
||||
}
|
||||
}
|
||||
|
||||
if ( distX )
|
||||
|
|
|
@ -45,7 +45,10 @@ void CNpcSawbladeHazard::processMovement( int _frames )
|
|||
|
||||
s16 headingToTarget = m_npcPath.think( Pos, &pathComplete, &waypointChange, &xDist, &yDist );
|
||||
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_SAW );
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_SAW, true );
|
||||
}
|
||||
|
||||
if ( !pathComplete )
|
||||
{
|
||||
|
|
|
@ -64,7 +64,10 @@ void CNpcFishHookPlatform::processMovement( int _frames )
|
|||
{
|
||||
if ( m_isMoving )
|
||||
{
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_FISH_HOOK_MOVE );
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_FISH_HOOK_MOVE, true );
|
||||
}
|
||||
|
||||
if ( m_isResetting )
|
||||
{
|
||||
|
|
|
@ -141,7 +141,11 @@ void CNpcGeyserPlatform::processTimer( int _frames )
|
|||
m_isFiring = true;
|
||||
Pos = m_base;
|
||||
m_state = GEYSER_RISING;
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_WORLD_OBJECT__GEYSER );
|
||||
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_WORLD_OBJECT__GEYSER, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -607,6 +607,8 @@ void CNpcPlatform::init()
|
|||
m_npcPath.initPath();
|
||||
|
||||
m_speed = m_dataPtr->speed;
|
||||
|
||||
m_soundId = (int) NOT_PLAYING;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -682,6 +684,11 @@ void CNpcPlatform::postInit()
|
|||
|
||||
void CNpcPlatform::shutdown()
|
||||
{
|
||||
if ( m_soundId != NOT_PLAYING )
|
||||
{
|
||||
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
|
||||
}
|
||||
|
||||
delete m_modelGfx;
|
||||
//m_npcPath.removeAllWaypoints();
|
||||
|
||||
|
@ -691,6 +698,17 @@ void CNpcPlatform::shutdown()
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcPlatform::leftThinkZone(int _frames)
|
||||
{
|
||||
if ( m_soundId != NOT_PLAYING )
|
||||
{
|
||||
CSoundMediator::stopAndUnlockSfx( (xmPlayingId) m_soundId );
|
||||
m_soundId = NOT_PLAYING;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcPlatform::processLifetime( int _frames )
|
||||
{
|
||||
switch( m_lifetimeType )
|
||||
|
@ -747,6 +765,16 @@ void CNpcPlatform::processLifetime( int _frames )
|
|||
|
||||
void CNpcPlatform::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_isActive )
|
||||
{
|
||||
|
|
|
@ -123,6 +123,7 @@ public:
|
|||
virtual void trigger() {;}
|
||||
virtual u8 isCart() {return( false );}
|
||||
virtual void jump() {;}
|
||||
virtual void leftThinkZone(int _frames);
|
||||
s16 getCollisionAngle() {return m_collisionAngle;}
|
||||
|
||||
static NPC_PLATFORM_UNIT_TYPE getTypeFromMapEdit( u16 newType );
|
||||
|
@ -230,6 +231,8 @@ protected:
|
|||
sBBox m_nonRotatedCollisionArea;
|
||||
DVECTOR m_nonRotatedCollisionOffset;
|
||||
|
||||
int m_soundId;
|
||||
|
||||
virtual void collidedWith(CThing *_thisThing);
|
||||
|
||||
static NPC_PLATFORM_UNIT_TYPE mapEditConvertTable[NPC_PLATFORM_TYPE_MAX];
|
||||
|
|
|
@ -107,7 +107,11 @@ void CNpcSeesawPlatform::processMovement( int _frames )
|
|||
if ( m_currentAngle != newAngle )
|
||||
{
|
||||
m_currentAngle = newAngle;
|
||||
CSoundMediator::playSfx( CSoundMediator::SFX_WORLD_OBJECT__SEESAW );
|
||||
|
||||
if ( m_soundId == NOT_PLAYING )
|
||||
{
|
||||
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_WORLD_OBJECT__SEESAW, true );
|
||||
}
|
||||
}
|
||||
|
||||
setCollisionAngle( newAngle >> 8 );
|
||||
|
|
Loading…
Add table
Reference in a new issue