This commit is contained in:
parent
8744b10af4
commit
7fa8e5a852
@ -3,9 +3,9 @@
|
||||
nanemone.cpp
|
||||
|
||||
Author: CRB
|
||||
Created:
|
||||
Created:
|
||||
Project: Spongebob
|
||||
Purpose:
|
||||
Purpose:
|
||||
|
||||
Copyright (c) 2000 Climax Development Ltd
|
||||
|
||||
@ -39,6 +39,12 @@
|
||||
#include <ACTOR_SPIKEYANENOME_ANIM.h>
|
||||
#endif
|
||||
|
||||
void CNpcAnemoneEnemy::postInit()
|
||||
{
|
||||
CNpcEnemy::postInit();
|
||||
m_drawRotation = m_heading + 1024;
|
||||
}
|
||||
|
||||
void CNpcAnemoneEnemy::processEnemyCollision( CThing *thisThing )
|
||||
{
|
||||
// do nothing
|
||||
@ -207,6 +213,10 @@ void CNpcAnemone2Enemy::postInit()
|
||||
heading &= 4095;
|
||||
|
||||
spikePos = Pos;
|
||||
|
||||
spikePos.vx += ( 10 * rcos( m_heading ) ) >> 12;
|
||||
spikePos.vy += ( 10 * rsin( m_heading ) ) >> 12;
|
||||
|
||||
spikePos.vx += ( 40 * rcos( heading ) ) >> 12;
|
||||
spikePos.vy += ( 40 * rsin( heading ) ) >> 12;
|
||||
|
||||
@ -216,6 +226,14 @@ void CNpcAnemone2Enemy::postInit()
|
||||
|
||||
addChild( projectile );
|
||||
}
|
||||
|
||||
m_drawRotation = m_heading + 1024;
|
||||
}
|
||||
|
||||
void CNpcAnemone2Enemy::shutdown()
|
||||
{
|
||||
deleteAllChild();
|
||||
CNpcEnemy::shutdown();
|
||||
}
|
||||
|
||||
void CNpcAnemone2Enemy::processClose( int _frames )
|
||||
@ -267,6 +285,10 @@ void CNpcAnemone2Enemy::processClose( int _frames )
|
||||
heading &= 4095;
|
||||
|
||||
spikePos = Pos;
|
||||
|
||||
spikePos.vx += ( 10 * rcos( m_heading ) ) >> 12;
|
||||
spikePos.vy += ( 10 * rsin( m_heading ) ) >> 12;
|
||||
|
||||
spikePos.vx += ( 40 * rcos( heading ) ) >> 12;
|
||||
spikePos.vy += ( 40 * rsin( heading ) ) >> 12;
|
||||
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
class CNpcAnemoneEnemy : public CNpcEnemy
|
||||
{
|
||||
public:
|
||||
virtual void postInit();
|
||||
protected:
|
||||
virtual void processEnemyCollision( CThing *thisThing );
|
||||
virtual bool processSensor();
|
||||
@ -35,6 +37,7 @@ class CNpcAnemone2Enemy : public CNpcAnemoneEnemy
|
||||
{
|
||||
public:
|
||||
virtual void postInit();
|
||||
virtual void shutdown();
|
||||
protected:
|
||||
virtual void processClose( int _frames );
|
||||
};
|
||||
|
@ -29,6 +29,14 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcEnemyGenerator::shutdown()
|
||||
{
|
||||
deleteAllChild();
|
||||
CNpcEnemy::shutdown();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcEnemyGenerator::think(int _frames)
|
||||
{
|
||||
if ( getNumChildren() < 3 )
|
||||
|
@ -21,9 +21,11 @@
|
||||
class CNpcEnemyGenerator : public CNpcEnemy
|
||||
{
|
||||
public:
|
||||
virtual void shutdown();
|
||||
virtual void processEnemyCollision( CThing *thisThing );
|
||||
void render();
|
||||
void think(int _frames);
|
||||
virtual u8 canCollideWithEnemy() {return( false );}
|
||||
};
|
||||
|
||||
#endif
|
@ -804,8 +804,6 @@ void CNpcEnemy::shutdown()
|
||||
|
||||
if (m_actorGfx) delete m_actorGfx;
|
||||
|
||||
deleteAllChild();
|
||||
|
||||
CEnemyThing::shutdown();
|
||||
}
|
||||
|
||||
@ -985,7 +983,12 @@ void CNpcEnemy::collidedWith( CThing *_thisThing )
|
||||
|
||||
case TYPE_ENEMY:
|
||||
{
|
||||
processEnemyCollision( _thisThing );
|
||||
CNpcEnemy *enemy = (CNpcEnemy *) _thisThing;
|
||||
|
||||
if ( enemy->canCollideWithEnemy() )
|
||||
{
|
||||
processEnemyCollision( _thisThing );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@ -1517,11 +1520,11 @@ void CNpcEnemy::processEnemyCollision( CThing *thisThing )
|
||||
|
||||
if ( yDist > 0 )
|
||||
{
|
||||
Pos.vy += 6;
|
||||
Pos.vy += 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
Pos.vy -= 6;
|
||||
Pos.vy -= 3;
|
||||
}
|
||||
|
||||
Pos.vx += otherDelta.vx;
|
||||
|
@ -160,12 +160,14 @@ public:
|
||||
|
||||
void init();
|
||||
virtual void postInit();
|
||||
void shutdown();
|
||||
virtual void shutdown();
|
||||
virtual u8 canCollideWithEnemy() {return( true );}
|
||||
virtual void think(int _frames);
|
||||
virtual void render();
|
||||
void processEvent( GAME_EVENT evt, CThing *sourceThing );
|
||||
void setLayerCollision( class CLayerCollision *_layer ) {m_layerCollision=_layer;}
|
||||
void setType( NPC_UNIT_TYPE newType ) {m_type = newType;}
|
||||
NPC_UNIT_TYPE getType() {return( m_type );}
|
||||
static NPC_UNIT_TYPE getTypeFromMapEdit( u16 newType );
|
||||
void setHeading( s32 newHeading ) {m_heading = newHeading;}
|
||||
void setHeading( s32 xPos, s32 yPos );
|
||||
|
@ -38,7 +38,7 @@ void CNpcSpiderCrabEnemy::postInit()
|
||||
{
|
||||
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
|
||||
|
||||
@ -251,7 +251,7 @@ void CNpcSpiderCrabEnemy::processSpiderCrabInitJumpMovement( int _frames )
|
||||
|
||||
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
|
||||
|
||||
@ -262,6 +262,11 @@ void CNpcSpiderCrabEnemy::processSpiderCrabInitJumpMovement( int _frames )
|
||||
}
|
||||
|
||||
if ( completed || collision )
|
||||
{
|
||||
m_state = SPIDER_CRAB_DEFAULT;
|
||||
}*/
|
||||
|
||||
if ( m_extension > 64 )
|
||||
{
|
||||
m_state = SPIDER_CRAB_DEFAULT;
|
||||
}
|
||||
@ -319,3 +324,20 @@ void CNpcSpiderCrabEnemy::processMovementModifier( int _frames, s32 distX, s32 d
|
||||
|
||||
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 );
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ class CNpcSpiderCrabEnemy : public CNpcEnemy
|
||||
{
|
||||
public:
|
||||
virtual void postInit();
|
||||
virtual u8 canCollideWithEnemy();
|
||||
virtual void processEnemyCollision( CThing *thisThing );
|
||||
protected:
|
||||
virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange );
|
||||
virtual bool processSensor();
|
||||
|
@ -98,6 +98,12 @@ void CNpcParasiticWormEnemy::postInit()
|
||||
m_movementTimer = 2 * GameState::getOneSecondInFrames();
|
||||
}
|
||||
|
||||
void CNpcParasiticWormEnemy::shutdown()
|
||||
{
|
||||
deleteAllChild();
|
||||
CNpcEnemy::shutdown();
|
||||
}
|
||||
|
||||
void CNpcParasiticWormSegment::postInit()
|
||||
{
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ class CNpcParasiticWormEnemy : public CNpcEnemy
|
||||
{
|
||||
public:
|
||||
virtual void postInit();
|
||||
virtual void shutdown();
|
||||
protected:
|
||||
virtual bool processSensor();
|
||||
virtual void processClose( int _frames );
|
||||
|
Loading…
Reference in New Issue
Block a user