This commit is contained in:
Charles 2001-06-04 20:02:27 +00:00
parent a13c8a4e19
commit a64602405b
3 changed files with 36 additions and 3 deletions

View File

@ -62,6 +62,26 @@ void CNpcAnemoneEnemy::postInit()
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcAnemoneEnemy::setHeading( s32 xPos, s32 yPos )
{
m_heading = ( ratan2( ( ( yPos << 4 ) + 16 ) - Pos.vy, ( ( xPos << 4 ) + 8 ) - Pos.vx ) ) & 4095;
int newHeading = ( m_heading - 1024 ) & 4095;
Pos.vy -= 8;
int offset = 8; // initial y offset
DVECTOR adjust;
adjust.vx = ( offset * rsin( newHeading ) ) >> 12;
adjust.vy = -( offset * rcos( newHeading ) ) >> 12;
Pos.vx += adjust.vx;
Pos.vy += adjust.vy;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcAnemoneEnemy::processEnemyCollision( CThing *thisThing ) void CNpcAnemoneEnemy::processEnemyCollision( CThing *thisThing )
{ {
// do nothing // do nothing
@ -212,9 +232,15 @@ void CNpcAnemone1Enemy::processClose( int _frames )
CSoundMediator::playSfx( CSoundMediator::SFX_ANEMONE_ATTACK_LEVEL1 ); CSoundMediator::playSfx( CSoundMediator::SFX_ANEMONE_ATTACK_LEVEL1 );
DVECTOR projPos;
projPos = Pos;
projPos.vx += rcos( m_heading ) >> 9;
projPos.vy += rsin( m_heading ) >> 9;
CProjectile *projectile; CProjectile *projectile;
projectile = new( "test projectile" ) CProjectile; projectile = new( "test projectile" ) CProjectile;
projectile->init( Pos, m_heading ); projectile->init( projPos, m_heading );
m_controlFunc = NPC_CONTROL_MOVEMENT; m_controlFunc = NPC_CONTROL_MOVEMENT;
m_timerTimer = GameState::getOneSecondInFrames(); m_timerTimer = GameState::getOneSecondInFrames();
@ -560,8 +586,14 @@ void CNpcAnemone3Enemy::processClose( int _frames )
m_fireHeading = m_heading & 4095; m_fireHeading = m_heading & 4095;
DVECTOR projPos;
projPos = Pos;
projPos.vx += rcos( m_heading ) >> 9;
projPos.vy += rsin( m_heading ) >> 9;
projectile = new( "test projectile" ) CProjectile; projectile = new( "test projectile" ) CProjectile;
projectile->init( Pos, projectile->init( projPos,
m_fireHeading, m_fireHeading,
CProjectile::PROJECTILE_GAS_CLOUD, CProjectile::PROJECTILE_GAS_CLOUD,
CProjectile::PROJECTILE_FINITE_LIFE, CProjectile::PROJECTILE_FINITE_LIFE,

View File

@ -22,6 +22,7 @@ class CNpcAnemoneEnemy : public CNpcEnemy
{ {
public: public:
virtual void postInit(); virtual void postInit();
virtual void setHeading( s32 xPos, s32 yPos );
protected: protected:
virtual void processEnemyCollision( CThing *thisThing ); virtual void processEnemyCollision( CThing *thisThing );
virtual bool processSensor(); virtual bool processSensor();

View File

@ -103,7 +103,7 @@ public:
NPC_UNIT_TYPE getType() {return( m_type );} NPC_UNIT_TYPE getType() {return( m_type );}
static NPC_UNIT_TYPE getTypeFromMapEdit( u16 newType ); static NPC_UNIT_TYPE getTypeFromMapEdit( u16 newType );
void setHeading( s32 newHeading ) {m_heading = newHeading;} void setHeading( s32 newHeading ) {m_heading = newHeading;}
void setHeading( s32 xPos, s32 yPos ); virtual void setHeading( s32 xPos, s32 yPos );
//void addWaypoint( u16 *ptr ); //void addWaypoint( u16 *ptr );
//void addWaypoint( u16 *ptrX, u16 *ptrY ); //void addWaypoint( u16 *ptrX, u16 *ptrY );
void setWaypointPtr( u16 *newPtr ) {m_npcPath.setWaypointPtr( newPtr );} void setWaypointPtr( u16 *newPtr ) {m_npcPath.setWaypointPtr( newPtr );}