diff --git a/source/enemy/nanemone.cpp b/source/enemy/nanemone.cpp index decbf1ff9..2fdf70ae2 100644 --- a/source/enemy/nanemone.cpp +++ b/source/enemy/nanemone.cpp @@ -147,14 +147,9 @@ void CNpc::processCloseAnemone3Attack( int _frames ) CProjectile *projectile; u8 lifetime = 8; - DVECTOR newPos = Pos; - - newPos.vx += rcos( m_fireHeading ) >> 5; - newPos.vy += rsin( m_fireHeading ) >> 5; - projectile = new( "test projectile" ) CProjectile; - projectile->init( newPos, - m_heading, + projectile->init( Pos, + m_fireHeading, CProjectile::PROJECTILE_GAS_CLOUD, CProjectile::PROJECTILE_FINITE_LIFE, lifetime * GameState::getOneSecondInFrames() ); diff --git a/source/enemy/npc.cpp b/source/enemy/npc.cpp index 6b8858fe4..e60b8993d 100644 --- a/source/enemy/npc.cpp +++ b/source/enemy/npc.cpp @@ -62,6 +62,8 @@ void CNpc::init() m_velocity = 0; m_extension = 0; + m_fireHeading = 300; + Pos.vx = 100; Pos.vy = 100; diff --git a/source/projectl/projectl.cpp b/source/projectl/projectl.cpp index 74463e74b..d3d1018d6 100644 --- a/source/projectl/projectl.cpp +++ b/source/projectl/projectl.cpp @@ -57,6 +57,7 @@ void CProjectile::init() m_lifetimeType = PROJECTILE_FINITE_LIFE; m_state = PROJECTILE_ATTACK; m_turnSpeed = 256; + m_extension = 0; } void CProjectile::init( DVECTOR initPos, s16 initHeading ) @@ -64,7 +65,7 @@ void CProjectile::init( DVECTOR initPos, s16 initHeading ) init(); m_heading = initHeading; - Pos = initPos; + m_initPos = Pos = initPos; } void CProjectile::init( DVECTOR initPos, s16 initHeading, PROJECTILE_MOVEMENT_TYPE initMoveType, PROJECTILE_LIFETIME_TYPE initLifeType ) @@ -223,7 +224,20 @@ void CProjectile::think(int _frames) case PROJECTILE_GAS_CLOUD: { - // expand but don't move + u16 targetExtension = 100 << 8; + + if ( m_extension < targetExtension ) + { + m_extension += ( ( targetExtension - m_extension ) * _frames ) >> 8; + + Pos = m_initPos; + Pos.vx += ( m_extension * rcos( m_heading ) ) >> 20; + Pos.vy += ( m_extension * rsin( m_heading ) ) >> 20; + } + else + { + // expand + } break; } diff --git a/source/projectl/projectl.h b/source/projectl/projectl.h index 383684884..2e23faf4f 100644 --- a/source/projectl/projectl.h +++ b/source/projectl/projectl.h @@ -55,8 +55,10 @@ protected: bool processTargetSeek( int _frames, DVECTOR targetPos ); class SpriteBank *m_spriteBank; + DVECTOR m_initPos; s16 m_heading; s32 m_lifetime; + s32 m_extension; PROJECTILE_MOVEMENT_TYPE m_movementType; PROJECTILE_LIFETIME_TYPE m_lifetimeType; PROJECTILE_STATE m_state;