diff --git a/source/enemy/nanemone.cpp b/source/enemy/nanemone.cpp index 14b7a446e..392905dca 100644 --- a/source/enemy/nanemone.cpp +++ b/source/enemy/nanemone.cpp @@ -229,6 +229,8 @@ void CNpcAnemone2Enemy::postInit() SetIdentNoTrans(&mtx ); RotMatrixZ( m_heading, &mtx ); + m_radius = 0; + for ( int fireLoop = 0 ; fireLoop < 5 ; fireLoop++ ) { DVECTOR spikePos; @@ -252,8 +254,8 @@ void CNpcAnemone2Enemy::postInit() // move appropriate to scaling (anemone origin is 90 degrees off, hence:) - xDiff = ( m_scaleY * SPIKE_RADIUS ) >> 12; - yDiff = ( m_scaleX * SPIKE_RADIUS ) >> 12; + xDiff = ( m_scaleY * m_radius ) >> 12; + yDiff = ( m_scaleX * m_radius ) >> 12; offset.vx = ( xDiff * rcos( relativeHeading ) ) >> 12; offset.vy = ( yDiff * rsin( relativeHeading ) ) >> 12; @@ -266,6 +268,7 @@ void CNpcAnemone2Enemy::postInit() projectile = new( "anemone lev2 projectile" ) CProjectile; projectile->init( spikePos, heading, CProjectile::PROJECTILE_FIXED, CProjectile::PROJECTILE_INFINITE_LIFE ); projectile->setLayerCollision( m_layerCollision ); + projectile->setOt( 15 ); addChild( projectile ); } @@ -429,6 +432,7 @@ void CNpcAnemone2Enemy::processClose( int _frames ) projectile->setMovementType( CProjectile::PROJECTILE_DUMBFIRE ); projectile->setLifeTime( CProjectile::PROJECTILE_FINITE_LIFE ); projectile->setState( CProjectile::PROJECTILE_ATTACK ); + projectile->setOt( 0 ); } nextThing = nextThing->getNext(); @@ -436,6 +440,8 @@ void CNpcAnemone2Enemy::processClose( int _frames ) removeAllChild(); + m_radius = 0; + // attach new spikes MATRIX mtx; @@ -465,8 +471,8 @@ void CNpcAnemone2Enemy::processClose( int _frames ) // move appropriate to scaling (anemone origin is 90 degrees off, hence:) - xDiff = ( m_scaleY * SPIKE_RADIUS ) >> 12; - yDiff = ( m_scaleX * SPIKE_RADIUS ) >> 12; + xDiff = ( m_scaleY * m_radius ) >> 12; + yDiff = ( m_scaleX * m_radius ) >> 12; offset.vx = ( xDiff * rcos( relativeHeading ) ) >> 12; offset.vy = ( yDiff * rsin( relativeHeading ) ) >> 12; @@ -479,6 +485,7 @@ void CNpcAnemone2Enemy::processClose( int _frames ) projectile = new( "anemone lev2 projectile" ) CProjectile; projectile->init( spikePos, heading, CProjectile::PROJECTILE_FIXED, CProjectile::PROJECTILE_INFINITE_LIFE ); projectile->setLayerCollision( m_layerCollision ); + projectile->setOt( 15 ); addChild( projectile ); } @@ -515,6 +522,11 @@ void CNpcAnemone2Enemy::processMovementModifier( int _frames, s32 distX, s32 dis SetIdentNoTrans(&mtx ); RotMatrixZ( m_heading, &mtx ); + if ( m_radius < SPIKE_RADIUS ) + { + m_radius++; + } + for ( int fireLoop = 0 ; fireLoop < 5 ; fireLoop++ ) { DVECTOR spikePos; @@ -537,8 +549,8 @@ void CNpcAnemone2Enemy::processMovementModifier( int _frames, s32 distX, s32 dis // move appropriate to scaling (anemone origin is 90 degrees off, hence:) - xDiff = ( m_scaleY * SPIKE_RADIUS ) >> 12; - yDiff = ( m_scaleX * SPIKE_RADIUS ) >> 12; + xDiff = ( m_scaleY * m_radius ) >> 12; + yDiff = ( m_scaleX * m_radius ) >> 12; offset.vx = ( xDiff * rcos( relativeHeading ) ) >> 12; offset.vy = ( yDiff * rsin( relativeHeading ) ) >> 12; diff --git a/source/enemy/nanemone.h b/source/enemy/nanemone.h index 79da3711c..27835d664 100644 --- a/source/enemy/nanemone.h +++ b/source/enemy/nanemone.h @@ -46,6 +46,8 @@ protected: u16 m_scaleX, m_scaleY; + u8 m_radius; + enum { SPIKE_RADIUS = 20, diff --git a/source/projectl/projectl.cpp b/source/projectl/projectl.cpp index 01ad4d014..5eea17be9 100644 --- a/source/projectl/projectl.cpp +++ b/source/projectl/projectl.cpp @@ -65,6 +65,7 @@ void CProjectile::init() m_turnSpeed = 256; m_extension = 0; m_isShuttingDown = false; + m_ot = 0; updateCollisionArea(); } @@ -357,7 +358,7 @@ void CProjectile::render() frameHdr = m_spriteBank->getFrameHeader(FRM__SPIKE); - m_spriteBank->printRotatedScaledSprite( frameHdr, x, y, 4096, 4096, m_heading, 0 ); + m_spriteBank->printRotatedScaledSprite( frameHdr, x, y, 4096, 4096, m_heading, m_ot ); } DVECTOR CProjectile::getScreenOffset() diff --git a/source/projectl/projectl.h b/source/projectl/projectl.h index 4651b0d81..b727b66ee 100644 --- a/source/projectl/projectl.h +++ b/source/projectl/projectl.h @@ -60,6 +60,7 @@ public: void setLifeTime( PROJECTILE_LIFETIME_TYPE lifeType ); void setPosition( DVECTOR newPos ); void setLayerCollision( class CLayerCollision *_layer ) {m_layerCollision=_layer;} + void setOt( u8 newOt ) {m_ot=newOt;} private: class CLayerCollision *m_layerCollision; @@ -79,6 +80,7 @@ protected: PROJECTILE_STATE m_state; u16 m_turnSpeed; u8 m_isShuttingDown; + u8 m_ot; }; /*****************************************************************************/