This commit is contained in:
Charles 2001-02-08 20:00:58 +00:00
parent 268b1c0645
commit 79aee886c6
4 changed files with 22 additions and 9 deletions

View File

@ -147,14 +147,9 @@ void CNpc::processCloseAnemone3Attack( int _frames )
CProjectile *projectile; CProjectile *projectile;
u8 lifetime = 8; u8 lifetime = 8;
DVECTOR newPos = Pos;
newPos.vx += rcos( m_fireHeading ) >> 5;
newPos.vy += rsin( m_fireHeading ) >> 5;
projectile = new( "test projectile" ) CProjectile; projectile = new( "test projectile" ) CProjectile;
projectile->init( newPos, projectile->init( Pos,
m_heading, m_fireHeading,
CProjectile::PROJECTILE_GAS_CLOUD, CProjectile::PROJECTILE_GAS_CLOUD,
CProjectile::PROJECTILE_FINITE_LIFE, CProjectile::PROJECTILE_FINITE_LIFE,
lifetime * GameState::getOneSecondInFrames() ); lifetime * GameState::getOneSecondInFrames() );

View File

@ -62,6 +62,8 @@ void CNpc::init()
m_velocity = 0; m_velocity = 0;
m_extension = 0; m_extension = 0;
m_fireHeading = 300;
Pos.vx = 100; Pos.vx = 100;
Pos.vy = 100; Pos.vy = 100;

View File

@ -57,6 +57,7 @@ void CProjectile::init()
m_lifetimeType = PROJECTILE_FINITE_LIFE; m_lifetimeType = PROJECTILE_FINITE_LIFE;
m_state = PROJECTILE_ATTACK; m_state = PROJECTILE_ATTACK;
m_turnSpeed = 256; m_turnSpeed = 256;
m_extension = 0;
} }
void CProjectile::init( DVECTOR initPos, s16 initHeading ) void CProjectile::init( DVECTOR initPos, s16 initHeading )
@ -64,7 +65,7 @@ void CProjectile::init( DVECTOR initPos, s16 initHeading )
init(); init();
m_heading = initHeading; m_heading = initHeading;
Pos = initPos; m_initPos = Pos = initPos;
} }
void CProjectile::init( DVECTOR initPos, s16 initHeading, PROJECTILE_MOVEMENT_TYPE initMoveType, PROJECTILE_LIFETIME_TYPE initLifeType ) 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: 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; break;
} }

View File

@ -55,8 +55,10 @@ protected:
bool processTargetSeek( int _frames, DVECTOR targetPos ); bool processTargetSeek( int _frames, DVECTOR targetPos );
class SpriteBank *m_spriteBank; class SpriteBank *m_spriteBank;
DVECTOR m_initPos;
s16 m_heading; s16 m_heading;
s32 m_lifetime; s32 m_lifetime;
s32 m_extension;
PROJECTILE_MOVEMENT_TYPE m_movementType; PROJECTILE_MOVEMENT_TYPE m_movementType;
PROJECTILE_LIFETIME_TYPE m_lifetimeType; PROJECTILE_LIFETIME_TYPE m_lifetimeType;
PROJECTILE_STATE m_state; PROJECTILE_STATE m_state;