This commit is contained in:
Charles 2001-05-14 19:48:27 +00:00
parent 488c311c93
commit e505d2ba5f
5 changed files with 57 additions and 13 deletions

View File

@ -65,7 +65,21 @@ void CNpcHermitCrabEnemy::processClose( int _frames )
{
if ( m_state == HERMIT_CRAB_NO_ATTACK )
{
m_state = ( getRnd() % 2 ) + 1;
//m_state = ( getRnd() % 2 ) + 1;
m_state = HERMIT_CRAB_ROLL_ATTACK_JUMP1;
m_movementTimer = 0;
m_jumpBase = Pos.vy;
if ( playerXDist > 0 )
{
m_extendDir = EXTEND_RIGHT;
m_heading = 0;
}
else
{
m_extendDir = EXTEND_LEFT;
m_heading = 2048;
}
}
switch( m_state )
@ -90,7 +104,26 @@ void CNpcHermitCrabEnemy::processClose( int _frames )
break;
}
case HERMIT_CRAB_ROLL_ATTACK:
case HERMIT_CRAB_ROLL_ATTACK_JUMP1:
case HERMIT_CRAB_ROLL_ATTACK_JUMP2:
{
s16 sineVal = ( m_movementTimer << 11 ) / ( GameState::getOneSecondInFrames() >> 3 );
Pos.vy = m_jumpBase - ( ( 10 * rsin( sineVal ) ) >> 12 );
if ( m_movementTimer < ( GameState::getOneSecondInFrames() >> 3 ) )
{
m_movementTimer++;
}
else
{
m_state++;
m_movementTimer = 0;
}
break;
}
case HERMIT_CRAB_ROLL_ATTACK_ROLL:
{
if ( !m_animPlaying || m_animNo == m_data[m_type].moveAnim )
{
@ -102,15 +135,6 @@ void CNpcHermitCrabEnemy::processClose( int _frames )
m_animNo = ANIM_HERMITCRAB_ROLLATTACK;
m_frame = 0;
if ( playerXDist > 0 )
{
m_extendDir = EXTEND_RIGHT;
}
else
{
m_extendDir = EXTEND_LEFT;
}
break;
}

View File

@ -27,11 +27,15 @@ protected:
virtual bool processSensor();
virtual void processClose( int _frames );
s32 m_jumpBase;
enum NPC_HERMIT_CRAB_STATE
{
HERMIT_CRAB_NO_ATTACK = 0,
HERMIT_CRAB_PUNCH_ATTACK = 1,
HERMIT_CRAB_ROLL_ATTACK,
HERMIT_CRAB_ROLL_ATTACK_JUMP1,
HERMIT_CRAB_ROLL_ATTACK_JUMP2,
HERMIT_CRAB_ROLL_ATTACK_ROLL,
};
};

View File

@ -1456,6 +1456,21 @@ void CNpcEnemy::processEnemyCollision( CThing *thisThing )
Pos.vx += otherDelta.vx;
if ( m_npcPath.getWaypointCount() )
{
s32 minX, maxX;
m_npcPath.getPathXExtents( &minX, &maxX );
if ( Pos.vx < minX )
{
Pos.vx = minX;
}
else if ( Pos.vx > maxX )
{
Pos.vx = maxX;
}
}
s32 groundHeight = m_layerCollision->getHeightFromGround( Pos.vx, Pos.vy, 16 );
if ( groundHeight < 8 )

View File

@ -50,6 +50,7 @@ public:
bool getDistToNextWaypoint( DVECTOR currentPos, s32 *distX, s32 *distY );
void getPathXExtents( s32 *minExtent, s32 *maxExtent );
void getPathYExtents( s32 *minExtent, s32 *maxExtent );
u8 getWaypointCount() { return( waypointCount ); }
CNpcWaypoint *getWaypointList();
private:

View File

@ -26,7 +26,7 @@ class CNpcSmallJellyfishEnemy : public CNpcEnemy
{
public:
virtual void render();
virtual int getFrameCount() {return( FRM_JELLYFISH1_SWIM6 - FRM_JELLYFISH1_SWIM1 + 1 );}
virtual int getFrameCount() {return( FRM_JELLYFISH1_SWIM7 - FRM_JELLYFISH1_SWIM1 + 1 );}
virtual u8 canCollideWithEnemy() {return( false );}
protected:
virtual bool processSensor();