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" #include "projectl\projectl.h"
#endif #endif
#ifndef __ANIM_FLYINGDUTCHMAN_HEADER__
#include <ACTOR_FLYINGDUTCHMAN_ANIM.h>
#endif
void CNpcEnemy::processFlyingDutchmanMovement( int _frames ) 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 ) if ( m_movementTimer > 0 )
{ {
m_movementTimer -= _frames; m_movementTimer -= _frames;
@ -77,6 +87,15 @@ void CNpcEnemy::processFlyingDutchmanMovement( int _frames )
{ {
m_controlFunc = NPC_CONTROL_CLOSE; m_controlFunc = NPC_CONTROL_CLOSE;
} }
if ( playerXDist > 0 )
{
m_heading = 0;
}
else
{
m_heading = 2048;
}
} }
void CNpcEnemy::processCloseFlyingDutchmanAttack( int _frames ) void CNpcEnemy::processCloseFlyingDutchmanAttack( int _frames )
@ -92,6 +111,13 @@ void CNpcEnemy::processCloseFlyingDutchmanAttack( int _frames )
if ( playerYDistSqr > 100 ) 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 ); processGenericGotoTarget( _frames, 0, playerYDist, m_data[m_type].speed );
} }
else else
@ -100,6 +126,14 @@ void CNpcEnemy::processCloseFlyingDutchmanAttack( int _frames )
{ {
case FLYING_DUTCHMAN_ATTACK_PLAYER_1: case FLYING_DUTCHMAN_ATTACK_PLAYER_1:
case FLYING_DUTCHMAN_ATTACK_PLAYER_2: case FLYING_DUTCHMAN_ATTACK_PLAYER_2:
{
if ( m_animNo != ANIM_FLYINGDUTCHMAN_FIREATTACK )
{
m_animNo = ANIM_FLYINGDUTCHMAN_FIREATTACK;
m_animPlaying = true;
m_frame = 0;
}
else if ( !m_animPlaying )
{ {
// fire at player // fire at player
@ -122,12 +156,20 @@ void CNpcEnemy::processCloseFlyingDutchmanAttack( int _frames )
m_movementTimer = GameState::getOneSecondInFrames() * 3; m_movementTimer = GameState::getOneSecondInFrames() * 3;
m_state++; m_state++;
}
break; break;
} }
default: default:
{ {
if ( !m_animPlaying )
{
m_animPlaying = true;
m_animNo = m_data[m_type].moveAnim;
m_frame = 0;
}
// charge player // charge player
if ( playerXDistSqr + playerYDistSqr > 100 ) 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 ) void CNpcFriend::processGaryMovement( int _frames )
{ {
s8 multiplier = -1 + ( 2 * m_extension ); s8 multiplier = -1 + ( 2 * m_extension );
s32 maxHeight = 10; s32 maxHeight = 20;
s32 fallSpeed = 3; s32 fallSpeed = 3;
s8 yMovement = fallSpeed * _frames; s8 yMovement = fallSpeed * _frames;
s8 groundHeight; 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 ) void CNpcEnemy::processGenericFixedPathWalk( int _frames, s32 *moveX, s32 *moveY )
{ {
s32 maxHeight = 10; s32 maxHeight = 20;
s32 distX, distY; s32 distX, distY;
s32 fallSpeed = 2; s32 fallSpeed = 3;
s8 yMovement = fallSpeed * _frames; s8 yMovement = fallSpeed * _frames;
s32 groundHeight; s32 groundHeight;

View File

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

View File

@ -44,38 +44,42 @@ void CNpcEnemy::processCloseSpiderCrabAttack( int _frames )
if ( m_extendDir == EXTEND_RIGHT ) if ( m_extendDir == EXTEND_RIGHT )
{ {
newPos.vx += velocity; m_extension += velocity;
m_heading = 0; m_heading = 0;
} }
else else
{ {
newPos.vx -= velocity; m_extension -= velocity;
m_heading = 2048; 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 ) m_extension = 128;
{ completed = true;
newPos.vx = m_base.vx + 128;
} }
else else if ( m_extension < -128 )
{ {
newPos.vx = m_base.vx - 128; m_extension = -128;
completed = true;
} }
newPos.vy = m_base.vy; newPos.vx = m_base.vx + m_extension;
newPos.vy = m_base.vy - ( ( 20 * rsin( abs( m_extension ) << 4 ) ) >> 12 );
m_controlFunc = NPC_CONTROL_MOVEMENT; s32 minX, maxX;
m_timerFunc = NPC_TIMER_ATTACK_DONE;
m_timerTimer = GameState::getOneSecondInFrames(); m_npcPath.getPathXExtents( &minX, &maxX );
m_sensorFunc = NPC_SENSOR_NONE;
} if ( newPos.vx < minX )
else
{ {
newPos.vy = m_base.vy - ( ( 20 * rsin( horizontalExtension << 4 ) ) >> 12 ); newPos.vx = minX;
}
else if ( newPos.vx > maxX )
{
newPos.vx = maxX;
} }
// check for collision with ground // check for collision with ground
@ -88,9 +92,22 @@ void CNpcEnemy::processCloseSpiderCrabAttack( int _frames )
m_timerFunc = NPC_TIMER_ATTACK_DONE; m_timerFunc = NPC_TIMER_ATTACK_DONE;
m_timerTimer = GameState::getOneSecondInFrames(); m_timerTimer = GameState::getOneSecondInFrames();
m_sensorFunc = NPC_SENSOR_NONE; m_sensorFunc = NPC_SENSOR_NONE;
m_extension = 0;
completed = false;
} }
else else
{ {
Pos = newPos; 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; s32 groundHeight;
s16 decDir, incDir, moveDist; s16 decDir, incDir, moveDist;
s32 direction; s32 direction;
s32 maxHeight = 10; s32 maxHeight = 20;
s32 fallSpeed = 2; s32 fallSpeed = 3;
s8 yMovement = fallSpeed * _frames; s8 yMovement = fallSpeed * _frames;
s16 headingToPlayer = ratan2( playerYDist, playerXDist ); s16 headingToPlayer = ratan2( playerYDist, playerXDist );