This commit is contained in:
Charles 2001-05-21 21:16:42 +00:00
parent 57e198f7eb
commit 67839d076f
12 changed files with 212 additions and 35 deletions

View File

@ -166,11 +166,16 @@ void CNpcAnemone1Enemy::processClose( int _frames )
withinRange = true;
}
m_heading += moveDist;
if ( moveDist )
{
m_heading += moveDist;
m_heading &= 4095;
m_heading &= 4095;
m_drawRotation = m_heading + 1024;
m_drawRotation = m_heading + 1024;
CSoundMediator::playSfx( CSoundMediator::SFX_ANEMONE_MOVE );
}
if ( withinRange )
{
@ -205,6 +210,8 @@ 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 );
CProjectile *projectile;
projectile = new( "test projectile" ) CProjectile;
projectile->init( Pos, m_heading );
@ -232,6 +239,8 @@ void CNpcAnemone2Enemy::postInit()
m_scaleX = ONE;
m_scaleY = ONE;
m_radius = 0;
m_spriteBank=new ("projectile sprites") SpriteBank();
m_spriteBank->load(SPRITES_SPRITES_SPR);
}
@ -305,6 +314,11 @@ void CNpcAnemone2Enemy::processShot( int _frames )
m_frame = 0;
m_state = NPC_GENERIC_HIT_DEATH_END;
if ( m_data[m_type].deathSfx < CSoundMediator::NUM_SFXIDS )
{
CSoundMediator::playSfx( m_data[m_type].deathSfx );
}
deleteAllChild();
m_isDying = true;
m_speed = -5;
@ -371,6 +385,7 @@ void CNpcAnemone2Enemy::processClose( int _frames )
}
else
{
CSoundMediator::playSfx( CSoundMediator::SFX_ANEMONE_ATTACK_LEVEL2 );
CProjectile *projectile;
s16 heading;
@ -548,6 +563,8 @@ void CNpcAnemone3Enemy::processClose( int _frames )
}
else if ( !m_animPlaying )
{
CSoundMediator::playSfx( CSoundMediator::SFX_ANEMONE_ATTACK_LEVEL3 );
CProjectile *projectile;
u8 lifetime = 8;

View File

@ -77,6 +77,8 @@ bool CNpcClamEnemy::processSensor()
m_movementTimer = GameState::getOneSecondInFrames() >> 3;
m_velocity = ( getRnd() % 6 ) + 1;
CSoundMediator::playSfx( CSoundMediator::SFX_CLAM_MOVE );
return( true );
}
else
@ -168,7 +170,6 @@ void CNpcStaticClamEnemy::postInit()
CNpcClamEnemy::postInit();
m_isStunned = false;
m_isAnimating = false;
// create platform in same place
@ -178,8 +179,9 @@ void CNpcStaticClamEnemy::postInit()
platform->setGraphic( (u8) 0 );
platform->init( Pos );
platform->setTiltable( false );
//platform->setBBox();
platform->postInit();
m_animPlaying = false;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -190,15 +192,9 @@ void CNpcStaticClamEnemy::processClose( int _frames )
{
m_animPlaying = true;
m_animNo = ANIM_CLAM_SIDESNAP;
m_frame = 0;
}
/*else if ( !m_animPlaying )
{
m_controlFunc = NPC_CONTROL_MOVEMENT;
m_animNo = m_data[m_type].initAnim;
m_frame = 0;
m_isAnimating = false;
}*/
}
if ( m_isStunned )
{
@ -218,8 +214,12 @@ void CNpcStaticClamEnemy::collidedWith( CThing *_thisThing )
{
if ( m_frame < ( 5 << 8 ) )
{
m_animNo = ANIM_CLAM_SIDESNAP;
m_frame = 0;
if ( m_frame != 0 )
{
m_frame = 0;
CSoundMediator::playSfx( CSoundMediator::SFX_CLAM_ATTACK );
}
m_isStunned = true;
m_animPlaying = false;
}
@ -263,3 +263,28 @@ s32 CNpcStaticClamEnemy::getFrameShift( int _frames )
{
return( ( _frames << 8 ) >> 2 );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcStaticClamEnemy::processAnimFrames( int _frames )
{
if ( m_animPlaying && !m_isDying )
{
s32 frameCount;
frameCount = getFrameCount();
s32 frameShift = getFrameShift( _frames );
if ( ( frameCount << 8 ) - m_frame > frameShift )
{
m_frame += frameShift;
}
else
{
m_frame = 0;
m_animPlaying = false;
CSoundMediator::playSfx( CSoundMediator::SFX_CLAM_ATTACK );
}
}
}

View File

@ -42,9 +42,9 @@ protected:
virtual void collidedWith(CThing *_thisThing);
virtual void processClose( int _frames );
virtual void processCollision();
virtual void processAnimFrames( int _frames );
u8 m_isStunned;
u8 m_isAnimating;
};
#endif

View File

@ -117,6 +117,10 @@ CThing *Next=getNext();
{
projectile->setMovementType( CProjectile::PROJECTILE_USER_SEEK );
projectile->setState( CProjectile::PROJECTILE_ATTACK );
// sound
CSoundMediator::playSfx( CSoundMediator::SFX_EYEBALL_SENTRY_ATTACK );
}
}
else
@ -134,6 +138,10 @@ CThing *Next=getNext();
projectile->setState( CProjectile::PROJECTILE_ATTACK );
addChild( projectile );
// sound
CSoundMediator::playSfx( CSoundMediator::SFX_EYEBALL_SENTRY_ATTACK );
}
}

View File

@ -221,6 +221,10 @@ void CNpcHermitCrabEnemy::processClose( int _frames )
Pos.vx = newX;
Pos.vy += moveY;
// sound
CSoundMediator::playSfx( CSoundMediator::SFX_HERMIT_CRAB_ATTACK );
}
}
}
@ -252,4 +256,8 @@ void CNpcHermitCrabEnemy::processMovementModifier( int _frames, s32 distX, s32 d
s16 heading = ratan2( yDist, xDist );
m_drawRotation = heading;
// sound
CSoundMediator::playSfx( CSoundMediator::SFX_HERMIT_CRAB_MOVE );
}

View File

@ -41,4 +41,8 @@ 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 );
}

View File

@ -714,6 +714,30 @@ s32 CNpcEnemy::getFrameShift( int _frames )
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEnemy::processAnimFrames( int _frames )
{
if ( m_animPlaying && !m_isDying )
{
s32 frameCount;
frameCount = getFrameCount();
s32 frameShift = getFrameShift( _frames );
if ( ( frameCount << 8 ) - m_frame > frameShift )
{
m_frame += frameShift;
}
else
{
m_frame = ( frameCount - 1 ) << 8;
m_animPlaying = false;
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEnemy::think(int _frames)
{
int moveFrames = _frames;
@ -739,24 +763,7 @@ void CNpcEnemy::think(int _frames)
{
if ( m_isActive )
{
if ( m_animPlaying && !m_isDying )
{
s32 frameCount;
frameCount = getFrameCount();
s32 frameShift = getFrameShift( moveFrames );
if ( ( frameCount << 8 ) - m_frame > frameShift )
{
m_frame += frameShift;
}
else
{
m_frame = ( frameCount - 1 ) << 8;
m_animPlaying = false;
}
}
processAnimFrames( moveFrames );
switch ( this->m_controlFunc )
{
@ -1046,6 +1053,11 @@ void CNpcEnemy::processMovement(int _frames)
s32 moveVel = 0;
s32 moveDist = 0;
if ( m_data[m_type].moveSfx < CSoundMediator::NUM_SFXIDS )
{
CSoundMediator::playSfx( m_data[m_type].moveSfx );
}
switch( m_movementFunc )
{
case NPC_MOVEMENT_STATIC:
@ -1181,6 +1193,11 @@ void CNpcEnemy::processShot( int _frames )
m_frame = 0;
m_state = NPC_GENERIC_HIT_DEATH_END;
if ( m_data[m_type].deathSfx < CSoundMediator::NUM_SFXIDS )
{
CSoundMediator::playSfx( m_data[m_type].deathSfx );
}
m_isDying = true;
m_speed = -5;

View File

@ -228,6 +228,8 @@ protected:
u8 respawning;
u8 canBeSuckedUp;
u8 canCollideWithEnemy;
CSoundMediator::SFXID deathSfx;
CSoundMediator::SFXID moveSfx;
}
NPC_DATA;
@ -243,6 +245,7 @@ protected:
virtual void processCollision();
virtual void processAttackCollision();
virtual void processGraphicFlipping();
virtual void processAnimFrames( int _frames );
void processTimer( int _frames );
bool isCollisionWithGround();

View File

@ -130,6 +130,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
true,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_SMALL_JELLYFISH_1
@ -153,6 +155,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
true,
false,
false,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_SMALL_JELLYFISH_2
@ -176,6 +180,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
true,
false,
false,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_ANEMONE_1
@ -199,6 +205,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
false,
CSoundMediator::SFX_ANEMONE_DEFEATED_LEVEL1,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_ANEMONE_2
@ -222,6 +230,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
false,
CSoundMediator::SFX_ANEMONE_DEFEATED_LEVEL2,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_ANEMONE_3
@ -245,6 +255,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
false,
CSoundMediator::SFX_ANEMONE_DEFEATED_LEVEL3,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_SKELETAL_FISH
@ -268,6 +280,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
true,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_CLAM_JUMP
@ -291,6 +305,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
false,
CSoundMediator::SFX_CLAM_DEFEATED,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_CLAM_STATIC
@ -314,6 +330,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
false,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_SQUID_DART
@ -337,6 +355,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
false,
CSoundMediator::SFX_SQUIDDART_DEFEATED,
CSoundMediator::SFX_SQUIDDART_MOVE,
},
{ // NPC_FISH_FOLK
@ -360,6 +380,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
true,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_PRICKLY_BUG
@ -383,6 +405,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
true,
CSoundMediator::SFX_PRICKLY_BUG_DEFEATED,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_SEA_SNAKE
@ -406,6 +430,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
true,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_PUFFA_FISH
@ -429,6 +455,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
true,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_ANGLER_FISH
@ -452,6 +480,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
true,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_HERMIT_CRAB
@ -475,6 +505,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
true,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_MINE
@ -498,6 +530,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
true,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_BOOGER_MONSTER
@ -521,6 +555,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
true,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_SPIDER_CRAB
@ -544,6 +580,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
true,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::SFX_SPIDERCRAB_MOVE,
},
{ // NPC_SPIDER_CRAB_SPAWNER
@ -567,6 +605,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
false,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_EYEBALL
@ -590,6 +630,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
false,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_BABY_OCTOPUS
@ -613,6 +655,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
true,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_ZOMBIE_FISH_FOLK
@ -636,6 +680,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
true,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_NINJA_STARFISH
@ -659,6 +705,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
true,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_GHOST
@ -682,6 +730,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
true,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_GHOST_PIRATE
@ -705,6 +755,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
true,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_FLAMING_SKULL
@ -728,6 +780,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
true,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_SHARK_MAN
@ -751,6 +805,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
true,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_OIL_BLOB
@ -774,6 +830,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
true,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_SKULL_STOMPER
@ -797,6 +855,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
false,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_MOTHER_JELLYFISH
@ -820,6 +880,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
false,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_SUB_SHARK
@ -843,6 +905,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
false,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_PARASITIC_WORM
@ -866,6 +930,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
false,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_FLYING_DUTCHMAN
@ -889,6 +955,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
false,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_IRON_DOGFISH
@ -912,6 +980,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
false,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_PARASITIC_WORM_SEGMENT
@ -935,6 +1005,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
false,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_BALL_BLOB
@ -958,6 +1030,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
true,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_SHELL
@ -981,6 +1055,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
true,
true,
false,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_PROJECTILE_JELLYFISH
@ -1004,6 +1080,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
true,
false,
false,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_MOTHER_JELLYFISH_BACKGROUND
@ -1027,6 +1105,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
false,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_SMALL_JELLYFISH_BACKGROUND
@ -1050,6 +1130,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
false,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_SMALL_JELLYFISH_2_BACKGROUND
@ -1073,6 +1155,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
false,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
{ // NPC_BUTTERFLY_BACKGROUND
@ -1096,6 +1180,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
false,
false,
false,
CSoundMediator::NUM_SFXIDS,
CSoundMediator::NUM_SFXIDS,
},
};

View File

@ -97,6 +97,10 @@ bool CNpcSpiderCrabEnemy::processSensor()
m_velocity = 5;
m_base = Pos;
// sound
CSoundMediator::playSfx( CSoundMediator::SFX_SPIDERCRAB_ATTACK );
return( true );
}
else

View File

@ -147,6 +147,10 @@ bool CNpcSquidDartEnemy::processSensor()
m_angularDistance = 0;
// sound
CSoundMediator::playSfx( CSoundMediator::SFX_SQUIDDART_ATTACK );
return( true );
}
else
@ -186,5 +190,4 @@ void CNpcSquidDartEnemy::processClose( int _frames )
m_animNo = m_data[m_type].moveAnim;
m_animPlaying = true;
}
}

View File

@ -57,6 +57,8 @@ void CNpcFishHookPlatform::processMovement( int _frames )
{
if ( m_isMoving )
{
CSoundMediator::playSfx( CSoundMediator::SFX_FISH_HOOK_MOVE );
if ( m_isResetting )
{
Pos.vy += 2 * _frames;