This commit is contained in:
Charles 2001-04-04 19:55:49 +00:00
parent 851263ff5c
commit 056511ac63
6 changed files with 118 additions and 44 deletions

View File

@ -27,9 +27,19 @@
#include "projectl\projectl.h"
#endif
#ifndef __ANIM_FLYINGDUTCHMAN_HEADER__
#include <ACTOR_FLYINGDUTCHMAN_ANIM.h>
#endif
void CNpcEnemy::processFlyingDutchmanMovement( int _frames )
{
if ( !m_animPlaying )
{
m_animPlaying = true;
m_animNo = m_data[m_type].moveAnim;
m_frame = 0;
}
if ( m_movementTimer > 0 )
{
m_movementTimer -= _frames;
@ -77,6 +87,15 @@ void CNpcEnemy::processFlyingDutchmanMovement( int _frames )
{
m_controlFunc = NPC_CONTROL_CLOSE;
}
if ( playerXDist > 0 )
{
m_heading = 0;
}
else
{
m_heading = 2048;
}
}
void CNpcEnemy::processCloseFlyingDutchmanAttack( int _frames )
@ -92,6 +111,13 @@ void CNpcEnemy::processCloseFlyingDutchmanAttack( int _frames )
if ( playerYDistSqr > 100 )
{
if ( !m_animPlaying )
{
m_animPlaying = true;
m_animNo = m_data[m_type].moveAnim;
m_frame = 0;
}
processGenericGotoTarget( _frames, 0, playerYDist, m_data[m_type].speed );
}
else
@ -101,33 +127,49 @@ void CNpcEnemy::processCloseFlyingDutchmanAttack( int _frames )
case FLYING_DUTCHMAN_ATTACK_PLAYER_1:
case FLYING_DUTCHMAN_ATTACK_PLAYER_2:
{
// fire at player
s16 heading;
if ( playerXDist > 0 )
if ( m_animNo != ANIM_FLYINGDUTCHMAN_FIREATTACK )
{
heading = 0;
m_animNo = ANIM_FLYINGDUTCHMAN_FIREATTACK;
m_animPlaying = true;
m_frame = 0;
}
else
else if ( !m_animPlaying )
{
heading = 2048;
// fire at player
s16 heading;
if ( playerXDist > 0 )
{
heading = 0;
}
else
{
heading = 2048;
}
CProjectile *projectile;
projectile = new( "test projectile" ) CProjectile;
projectile->init( Pos, heading );
m_controlFunc = NPC_CONTROL_MOVEMENT;
m_movementTimer = GameState::getOneSecondInFrames() * 3;
m_state++;
}
CProjectile *projectile;
projectile = new( "test projectile" ) CProjectile;
projectile->init( Pos, heading );
m_controlFunc = NPC_CONTROL_MOVEMENT;
m_movementTimer = GameState::getOneSecondInFrames() * 3;
m_state++;
break;
}
default:
{
if ( !m_animPlaying )
{
m_animPlaying = true;
m_animNo = m_data[m_type].moveAnim;
m_frame = 0;
}
// charge player
if ( playerXDistSqr + playerYDistSqr > 100 )
@ -154,4 +196,13 @@ void CNpcEnemy::processCloseFlyingDutchmanAttack( int _frames )
}
}
}
if ( playerXDist > 0 )
{
m_heading = 0;
}
else
{
m_heading = 2048;
}
}

View File

@ -23,7 +23,7 @@
void CNpcFriend::processGaryMovement( int _frames )
{
s8 multiplier = -1 + ( 2 * m_extension );
s32 maxHeight = 10;
s32 maxHeight = 20;
s32 fallSpeed = 3;
s8 yMovement = fallSpeed * _frames;
s8 groundHeight;

View File

@ -228,9 +228,9 @@ void CNpcEnemy::processGenericFixedPathMove( int _frames, s32 *moveX, s32 *moveY
void CNpcEnemy::processGenericFixedPathWalk( int _frames, s32 *moveX, s32 *moveY )
{
s32 maxHeight = 10;
s32 maxHeight = 20;
s32 distX, distY;
s32 fallSpeed = 2;
s32 fallSpeed = 3;
s8 yMovement = fallSpeed * _frames;
s32 groundHeight;

View File

@ -117,7 +117,7 @@ void CNpcEnemy::processCloseHermitCrabAttack( int _frames )
s32 moveX = 0, moveY = 0;
s32 groundHeight;
s32 fallSpeed = 2;
s32 fallSpeed = 3;
s8 yMovement = fallSpeed * _frames;
moveX = 6 * _frames;
@ -154,6 +154,12 @@ void CNpcEnemy::processCloseHermitCrabAttack( int _frames )
moveY = groundHeight;
}
else
{
// fall
moveY = yMovement;
}
Pos.vx = newX;
Pos.vy += moveY;

View File

@ -44,38 +44,42 @@ void CNpcEnemy::processCloseSpiderCrabAttack( int _frames )
if ( m_extendDir == EXTEND_RIGHT )
{
newPos.vx += velocity;
m_extension += velocity;
m_heading = 0;
}
else
{
newPos.vx -= velocity;
m_extension -= velocity;
m_heading = 2048;
}
s32 horizontalExtension = abs( newPos.vx - m_base.vx );
bool completed = false;
if ( horizontalExtension > 128 )
if ( m_extension > 128 )
{
if ( m_extendDir == EXTEND_RIGHT )
{
newPos.vx = m_base.vx + 128;
}
else
{
newPos.vx = m_base.vx - 128;
}
newPos.vy = m_base.vy;
m_controlFunc = NPC_CONTROL_MOVEMENT;
m_timerFunc = NPC_TIMER_ATTACK_DONE;
m_timerTimer = GameState::getOneSecondInFrames();
m_sensorFunc = NPC_SENSOR_NONE;
m_extension = 128;
completed = true;
}
else
else if ( m_extension < -128 )
{
newPos.vy = m_base.vy - ( ( 20 * rsin( horizontalExtension << 4 ) ) >> 12 );
m_extension = -128;
completed = true;
}
newPos.vx = m_base.vx + m_extension;
newPos.vy = m_base.vy - ( ( 20 * rsin( abs( m_extension ) << 4 ) ) >> 12 );
s32 minX, maxX;
m_npcPath.getPathXExtents( &minX, &maxX );
if ( newPos.vx < minX )
{
newPos.vx = minX;
}
else if ( newPos.vx > maxX )
{
newPos.vx = maxX;
}
// check for collision with ground
@ -88,9 +92,22 @@ void CNpcEnemy::processCloseSpiderCrabAttack( int _frames )
m_timerFunc = NPC_TIMER_ATTACK_DONE;
m_timerTimer = GameState::getOneSecondInFrames();
m_sensorFunc = NPC_SENSOR_NONE;
m_extension = 0;
completed = false;
}
else
{
Pos = newPos;
}
if ( completed )
{
m_controlFunc = NPC_CONTROL_MOVEMENT;
m_timerFunc = NPC_TIMER_ATTACK_DONE;
m_timerTimer = GameState::getOneSecondInFrames();
m_sensorFunc = NPC_SENSOR_NONE;
m_extension = 0;
}
}

View File

@ -119,8 +119,8 @@ void CNpcEnemy::processCloseSharkManAttack( int _frames )
s32 groundHeight;
s16 decDir, incDir, moveDist;
s32 direction;
s32 maxHeight = 10;
s32 fallSpeed = 2;
s32 maxHeight = 20;
s32 fallSpeed = 3;
s8 yMovement = fallSpeed * _frames;
s16 headingToPlayer = ratan2( playerYDist, playerXDist );