This commit is contained in:
Charles 2001-04-26 21:29:44 +00:00
parent 8744b10af4
commit 7fa8e5a852
10 changed files with 81 additions and 10 deletions

View File

@ -39,6 +39,12 @@
#include <ACTOR_SPIKEYANENOME_ANIM.h> #include <ACTOR_SPIKEYANENOME_ANIM.h>
#endif #endif
void CNpcAnemoneEnemy::postInit()
{
CNpcEnemy::postInit();
m_drawRotation = m_heading + 1024;
}
void CNpcAnemoneEnemy::processEnemyCollision( CThing *thisThing ) void CNpcAnemoneEnemy::processEnemyCollision( CThing *thisThing )
{ {
// do nothing // do nothing
@ -207,6 +213,10 @@ void CNpcAnemone2Enemy::postInit()
heading &= 4095; heading &= 4095;
spikePos = Pos; spikePos = Pos;
spikePos.vx += ( 10 * rcos( m_heading ) ) >> 12;
spikePos.vy += ( 10 * rsin( m_heading ) ) >> 12;
spikePos.vx += ( 40 * rcos( heading ) ) >> 12; spikePos.vx += ( 40 * rcos( heading ) ) >> 12;
spikePos.vy += ( 40 * rsin( heading ) ) >> 12; spikePos.vy += ( 40 * rsin( heading ) ) >> 12;
@ -216,6 +226,14 @@ void CNpcAnemone2Enemy::postInit()
addChild( projectile ); addChild( projectile );
} }
m_drawRotation = m_heading + 1024;
}
void CNpcAnemone2Enemy::shutdown()
{
deleteAllChild();
CNpcEnemy::shutdown();
} }
void CNpcAnemone2Enemy::processClose( int _frames ) void CNpcAnemone2Enemy::processClose( int _frames )
@ -267,6 +285,10 @@ void CNpcAnemone2Enemy::processClose( int _frames )
heading &= 4095; heading &= 4095;
spikePos = Pos; spikePos = Pos;
spikePos.vx += ( 10 * rcos( m_heading ) ) >> 12;
spikePos.vy += ( 10 * rsin( m_heading ) ) >> 12;
spikePos.vx += ( 40 * rcos( heading ) ) >> 12; spikePos.vx += ( 40 * rcos( heading ) ) >> 12;
spikePos.vy += ( 40 * rsin( heading ) ) >> 12; spikePos.vy += ( 40 * rsin( heading ) ) >> 12;

View File

@ -20,6 +20,8 @@
class CNpcAnemoneEnemy : public CNpcEnemy class CNpcAnemoneEnemy : public CNpcEnemy
{ {
public:
virtual void postInit();
protected: protected:
virtual void processEnemyCollision( CThing *thisThing ); virtual void processEnemyCollision( CThing *thisThing );
virtual bool processSensor(); virtual bool processSensor();
@ -35,6 +37,7 @@ class CNpcAnemone2Enemy : public CNpcAnemoneEnemy
{ {
public: public:
virtual void postInit(); virtual void postInit();
virtual void shutdown();
protected: protected:
virtual void processClose( int _frames ); virtual void processClose( int _frames );
}; };

View File

@ -29,6 +29,14 @@
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEnemyGenerator::shutdown()
{
deleteAllChild();
CNpcEnemy::shutdown();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcEnemyGenerator::think(int _frames) void CNpcEnemyGenerator::think(int _frames)
{ {
if ( getNumChildren() < 3 ) if ( getNumChildren() < 3 )

View File

@ -21,9 +21,11 @@
class CNpcEnemyGenerator : public CNpcEnemy class CNpcEnemyGenerator : public CNpcEnemy
{ {
public: public:
virtual void shutdown();
virtual void processEnemyCollision( CThing *thisThing ); virtual void processEnemyCollision( CThing *thisThing );
void render(); void render();
void think(int _frames); void think(int _frames);
virtual u8 canCollideWithEnemy() {return( false );}
}; };
#endif #endif

View File

@ -804,8 +804,6 @@ void CNpcEnemy::shutdown()
if (m_actorGfx) delete m_actorGfx; if (m_actorGfx) delete m_actorGfx;
deleteAllChild();
CEnemyThing::shutdown(); CEnemyThing::shutdown();
} }
@ -984,8 +982,13 @@ void CNpcEnemy::collidedWith( CThing *_thisThing )
} }
case TYPE_ENEMY: case TYPE_ENEMY:
{
CNpcEnemy *enemy = (CNpcEnemy *) _thisThing;
if ( enemy->canCollideWithEnemy() )
{ {
processEnemyCollision( _thisThing ); processEnemyCollision( _thisThing );
}
break; break;
} }
@ -1517,11 +1520,11 @@ void CNpcEnemy::processEnemyCollision( CThing *thisThing )
if ( yDist > 0 ) if ( yDist > 0 )
{ {
Pos.vy += 6; Pos.vy += 3;
} }
else else
{ {
Pos.vy -= 6; Pos.vy -= 3;
} }
Pos.vx += otherDelta.vx; Pos.vx += otherDelta.vx;

View File

@ -160,12 +160,14 @@ public:
void init(); void init();
virtual void postInit(); virtual void postInit();
void shutdown(); virtual void shutdown();
virtual u8 canCollideWithEnemy() {return( true );}
virtual void think(int _frames); virtual void think(int _frames);
virtual void render(); virtual void render();
void processEvent( GAME_EVENT evt, CThing *sourceThing ); void processEvent( GAME_EVENT evt, CThing *sourceThing );
void setLayerCollision( class CLayerCollision *_layer ) {m_layerCollision=_layer;} void setLayerCollision( class CLayerCollision *_layer ) {m_layerCollision=_layer;}
void setType( NPC_UNIT_TYPE newType ) {m_type = newType;} void setType( NPC_UNIT_TYPE newType ) {m_type = newType;}
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 ); void setHeading( s32 xPos, s32 yPos );

View File

@ -38,7 +38,7 @@ void CNpcSpiderCrabEnemy::postInit()
{ {
m_npcPath.setPathType( CNpcPath::PONG_PATH ); m_npcPath.setPathType( CNpcPath::PONG_PATH );
if ( m_layerCollision->getHeightFromGround( Pos.vx, Pos.vy, 16 ) < 0 ) if ( m_layerCollision->getHeightFromGround( Pos.vx, Pos.vy - 8, 16 ) <= 0 )
{ {
// starting off below ground, jump initially // starting off below ground, jump initially
@ -251,7 +251,7 @@ void CNpcSpiderCrabEnemy::processSpiderCrabInitJumpMovement( int _frames )
Pos.vy = m_base.vy - ( ( 50 * rsin( abs( m_extension ) << 4 ) ) >> 12 ); Pos.vy = m_base.vy - ( ( 50 * rsin( abs( m_extension ) << 4 ) ) >> 12 );
if ( m_extension > 64 ) /*if ( m_extension > 64 )
{ {
// check for collision on the way back down // check for collision on the way back down
@ -262,6 +262,11 @@ void CNpcSpiderCrabEnemy::processSpiderCrabInitJumpMovement( int _frames )
} }
if ( completed || collision ) if ( completed || collision )
{
m_state = SPIDER_CRAB_DEFAULT;
}*/
if ( m_extension > 64 )
{ {
m_state = SPIDER_CRAB_DEFAULT; m_state = SPIDER_CRAB_DEFAULT;
} }
@ -319,3 +324,20 @@ void CNpcSpiderCrabEnemy::processMovementModifier( int _frames, s32 distX, s32 d
m_drawRotation = heading; m_drawRotation = heading;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcSpiderCrabEnemy::processEnemyCollision( CThing *thisThing )
{
if ( m_state != SPIDER_CRAB_INIT_JUMP )
{
CNpcEnemy::processEnemyCollision( thisThing );
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
u8 CNpcSpiderCrabEnemy::canCollideWithEnemy()
{
return( m_state != SPIDER_CRAB_INIT_JUMP );
}

View File

@ -22,6 +22,8 @@ class CNpcSpiderCrabEnemy : public CNpcEnemy
{ {
public: public:
virtual void postInit(); virtual void postInit();
virtual u8 canCollideWithEnemy();
virtual void processEnemyCollision( CThing *thisThing );
protected: protected:
virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange ); virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange );
virtual bool processSensor(); virtual bool processSensor();

View File

@ -98,6 +98,12 @@ void CNpcParasiticWormEnemy::postInit()
m_movementTimer = 2 * GameState::getOneSecondInFrames(); m_movementTimer = 2 * GameState::getOneSecondInFrames();
} }
void CNpcParasiticWormEnemy::shutdown()
{
deleteAllChild();
CNpcEnemy::shutdown();
}
void CNpcParasiticWormSegment::postInit() void CNpcParasiticWormSegment::postInit()
{ {
} }

View File

@ -18,6 +18,7 @@ class CNpcParasiticWormEnemy : public CNpcEnemy
{ {
public: public:
virtual void postInit(); virtual void postInit();
virtual void shutdown();
protected: protected:
virtual bool processSensor(); virtual bool processSensor();
virtual void processClose( int _frames ); virtual void processClose( int _frames );