This commit is contained in:
Charles 2001-05-09 21:27:23 +00:00
parent 00e017b62d
commit 4c64c9ed4e
25 changed files with 58 additions and 40 deletions

View File

@ -115,11 +115,11 @@ void CNpcBallBlobEnemy::processMovement( int _frames )
if ( waypointHeading == 0 ) if ( waypointHeading == 0 )
{ {
moveX = m_data[m_type].speed * _frames; moveX = m_speed * _frames;
} }
else else
{ {
moveX = -m_data[m_type].speed * _frames; moveX = -m_speed * _frames;
} }
processMovementModifier( _frames, moveX, moveY, moveVel, moveDist ); processMovementModifier( _frames, moveX, moveY, moveVel, moveDist );

View File

@ -174,7 +174,7 @@ void CNpcIronDogfishEnemy::processStandardIronDogfishAttack( int _frames )
m_frame = 0; m_frame = 0;
} }
processWalkToUser( _frames, m_data[m_type].speed ); processWalkToUser( _frames, m_speed );
} }
else else
{ {
@ -235,7 +235,7 @@ void CNpcIronDogfishEnemy::processStandardIronDogfishAttack( int _frames )
m_frame = 0; m_frame = 0;
} }
processWalkToUser( _frames, m_data[m_type].speed ); processWalkToUser( _frames, m_speed );
} }
else else
{ {

View File

@ -91,7 +91,7 @@ void CNpcDustDevilEnemy::processMovement( int _frames )
distX = distX / abs( distX ); distX = distX / abs( distX );
if ( m_layerCollision->getHeightFromGround( Pos.vx + ( distX * m_data[m_type].speed * _frames ), Pos.vy ) < -maxHeight ) if ( m_layerCollision->getHeightFromGround( Pos.vx + ( distX * m_speed * _frames ), Pos.vy ) < -maxHeight )
{ {
// there is an obstacle in the way, increment the path point (hopefully this will resolve the problem) // there is an obstacle in the way, increment the path point (hopefully this will resolve the problem)
@ -107,7 +107,7 @@ void CNpcDustDevilEnemy::processMovement( int _frames )
{ {
// groundHeight <= yMovement indicates either just above ground or on or below ground // groundHeight <= yMovement indicates either just above ground or on or below ground
moveX = distX * m_data[m_type].speed * _frames; moveX = distX * m_speed * _frames;
moveY = groundHeight; moveY = groundHeight;
} }
else else

View File

@ -65,7 +65,7 @@ void CNpcFlyingDutchmanEnemy::processMovement( int _frames )
if ( xDistSqr > 100 ) if ( xDistSqr > 100 )
{ {
processGenericGotoTarget( _frames, xDist, 0, m_data[m_type].speed ); processGenericGotoTarget( _frames, xDist, 0, m_speed );
} }
else else
{ {
@ -76,7 +76,7 @@ void CNpcFlyingDutchmanEnemy::processMovement( int _frames )
if ( yDistSqr > 100 ) if ( yDistSqr > 100 )
{ {
processGenericGotoTarget( _frames, 0, yDist, m_data[m_type].speed ); processGenericGotoTarget( _frames, 0, yDist, m_speed );
} }
else else
{ {
@ -90,7 +90,7 @@ void CNpcFlyingDutchmanEnemy::processMovement( int _frames )
if ( yDistSqr > 100 ) if ( yDistSqr > 100 )
{ {
processGenericGotoTarget( _frames, 0, yDist, m_data[m_type].speed ); processGenericGotoTarget( _frames, 0, yDist, m_speed );
} }
else else
{ {
@ -134,7 +134,7 @@ void CNpcFlyingDutchmanEnemy::processClose( int _frames )
m_frame = 0; m_frame = 0;
} }
processGenericGotoTarget( _frames, 0, playerYDist, m_data[m_type].speed ); processGenericGotoTarget( _frames, 0, playerYDist, m_speed );
} }
else else
{ {

View File

@ -79,7 +79,7 @@ void CNpcFlamingSkullEnemy::processClose( int _frames )
} }
else else
{ {
processGenericGotoTarget( _frames, distX, distY, m_data[m_type].speed ); processGenericGotoTarget( _frames, distX, distY, m_speed );
} }
} }
else else
@ -102,7 +102,7 @@ void CNpcFlamingSkullEnemy::processClose( int _frames )
} }
else else
{ {
processGenericGotoTarget( _frames, distX, distY, m_data[m_type].speed ); processGenericGotoTarget( _frames, distX, distY, m_speed );
} }
} }
} }

View File

@ -245,8 +245,8 @@ void CNpcEnemy::processGenericFixedPathMove( int _frames, s32 *moveX, s32 *moveY
m_heading += *moveDist; m_heading += *moveDist;
m_heading &= 4095; m_heading &= 4095;
s32 preShiftX = _frames * m_data[m_type].speed * rcos( m_heading ); s32 preShiftX = _frames * m_speed * rcos( m_heading );
s32 preShiftY = _frames * m_data[m_type].speed * rsin( m_heading ); s32 preShiftY = _frames * m_speed * rsin( m_heading );
*moveX = preShiftX >> 12; *moveX = preShiftX >> 12;
if ( !(*moveX) && preShiftX ) if ( !(*moveX) && preShiftX )
@ -298,7 +298,7 @@ void CNpcEnemy::processGenericFixedPathMove( int _frames, s32 *moveX, s32 *moveY
*moveY = 0; *moveY = 0;
} }
*moveVel = ( _frames * m_data[m_type].speed ) << 8; *moveVel = ( _frames * m_speed ) << 8;
//processGroundCollisionReverse( moveX, moveY ); //processGroundCollisionReverse( moveX, moveY );
} }
@ -346,7 +346,7 @@ void CNpcEnemy::processGenericFixedPathWalk( int _frames, s32 *moveX, s32 *moveY
distX = distX / abs( distX ); distX = distX / abs( distX );
if ( m_layerCollision->getHeightFromGround( Pos.vx + ( distX * m_data[m_type].speed * _frames ), Pos.vy ) < -maxHeight ) if ( m_layerCollision->getHeightFromGround( Pos.vx + ( distX * m_speed * _frames ), Pos.vy ) < -maxHeight )
{ {
// there is an obstacle in the way, increment the path point (hopefully this will resolve the problem) // there is an obstacle in the way, increment the path point (hopefully this will resolve the problem)
@ -362,7 +362,7 @@ void CNpcEnemy::processGenericFixedPathWalk( int _frames, s32 *moveX, s32 *moveY
{ {
// groundHeight <= yMovement indicates either just above ground or on or below ground // groundHeight <= yMovement indicates either just above ground or on or below ground
*moveX = distX * m_data[m_type].speed * _frames; *moveX = distX * m_speed * _frames;
*moveY = groundHeight; *moveY = groundHeight;
} }
else else

View File

@ -79,7 +79,7 @@ void CNpcMotherJellyfishEnemy::processMovement( int _frames )
if ( xDistSqr + yDistSqr > 100 ) if ( xDistSqr + yDistSqr > 100 )
{ {
processGenericGotoTarget( _frames, xDist, yDist, m_data[m_type].speed ); processGenericGotoTarget( _frames, xDist, yDist, m_speed );
} }
else else
{ {
@ -187,7 +187,7 @@ void CNpcMotherJellyfishEnemy::processClose( int _frames )
if ( xDistSqr + yDistSqr > 400 ) if ( xDistSqr + yDistSqr > 400 )
{ {
processGenericGotoTarget( _frames, xDist, yDist, m_data[m_type].speed ); processGenericGotoTarget( _frames, xDist, yDist, m_speed );
} }
else else
{ {

View File

@ -636,6 +636,7 @@ void CNpcEnemy::init()
m_drawRotation = 0; m_drawRotation = 0;
m_isCaught = false; m_isCaught = false;
m_isBlowerOn = false; m_isBlowerOn = false;
m_speed = m_data[m_type].speed;
} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -942,7 +943,7 @@ bool CNpcEnemy::processSensor()
if ( playerXDistSqr + playerYDistSqr < 10000 ) if ( playerXDistSqr + playerYDistSqr < 10000 )
{ {
m_controlFunc = NPC_CONTROL_CLOSE; m_controlFunc = NPC_CONTROL_CLOSE;
m_velocity = m_data[m_type].speed; m_velocity = m_speed;
return( true ); return( true );
} }
@ -1241,7 +1242,7 @@ void CNpcEnemy::processClose(int _frames)
{ {
case NPC_CLOSE_GENERIC_USER_SEEK: case NPC_CLOSE_GENERIC_USER_SEEK:
{ {
processGenericGotoTarget( _frames, playerXDist, playerYDist, m_data[m_type].speed ); processGenericGotoTarget( _frames, playerXDist, playerYDist, m_speed );
break; break;
} }

View File

@ -105,6 +105,7 @@ public:
bool canBeCaughtByNet(); bool canBeCaughtByNet();
void caughtWithNet(); void caughtWithNet();
virtual int getFrameCount(); virtual int getFrameCount();
void setSpeed( s16 newSpeed ) {m_speed = newSpeed;}
static CNpcEnemy *Create(sThingActor *ThisActor); static CNpcEnemy *Create(sThingActor *ThisActor);
void setupWaypoints( sThingActor *ThisActor ); void setupWaypoints( sThingActor *ThisActor );
@ -294,6 +295,7 @@ protected:
u8 m_isCaught; u8 m_isCaught;
u8 m_isBlowerOn; u8 m_isBlowerOn;
DVECTOR m_caughtPos; DVECTOR m_caughtPos;
s16 m_speed;
s32 m_frame; s32 m_frame;
int m_animNo; int m_animNo;

View File

@ -117,7 +117,7 @@ void CNpcSubSharkEnemy::processMovement( int _frames )
if ( ( xDistSqr + yDistSqr ) > 100 ) if ( ( xDistSqr + yDistSqr ) > 100 )
{ {
processGenericGotoTarget( _frames, xDist, yDist, m_data[m_type].speed ); processGenericGotoTarget( _frames, xDist, yDist, m_speed );
} }
else else
{ {
@ -138,7 +138,7 @@ void CNpcSubSharkEnemy::processMovement( int _frames )
if ( ( xDistSqr + yDistSqr ) > 100 ) if ( ( xDistSqr + yDistSqr ) > 100 )
{ {
processGenericGotoTarget( _frames, xDist, yDist, m_data[m_type].speed ); processGenericGotoTarget( _frames, xDist, yDist, m_speed );
} }
else else
{ {
@ -178,7 +178,7 @@ void CNpcSubSharkEnemy::processClose( int _frames )
m_frame = 0; m_frame = 0;
} }
processGenericGotoTarget( _frames, playerXDist, 0, m_data[m_type].speed ); processGenericGotoTarget( _frames, playerXDist, 0, m_speed );
if ( playerXDistSqr < 100 ) if ( playerXDistSqr < 100 )
{ {

View File

@ -473,6 +473,11 @@ void CLevel::initThings(int _respawningLevel)
enemy->setLayerCollision( getCollisionLayer() ); enemy->setLayerCollision( getCollisionLayer() );
enemy->setupWaypoints( ThisActor ); enemy->setupWaypoints( ThisActor );
enemy->postInit(); enemy->postInit();
if ( ThisActor->Speed )
{
enemy->setSpeed( ThisActor->Speed );
}
} }
break; break;
@ -501,6 +506,11 @@ void CLevel::initThings(int _respawningLevel)
platform = CNpcPlatform::Create( ThisPlatform ); platform = CNpcPlatform::Create( ThisPlatform );
platform->setLayerCollision( getCollisionLayer() ); platform->setLayerCollision( getCollisionLayer() );
platform->postInit(); platform->postInit();
if ( ThisPlatform->Speed )
{
platform->setSpeed( ThisPlatform->Speed );
}
} }
} }

View File

@ -19,7 +19,7 @@
void CNpcBubblePlatform::processMovement( int _frames ) void CNpcBubblePlatform::processMovement( int _frames )
{ {
Pos.vy -= m_data[m_type].speed * _frames; Pos.vy -= m_speed * _frames;
if ( Pos.vy < 0 ) if ( Pos.vy < 0 )
{ {

View File

@ -24,7 +24,7 @@
void CNpcBigWheelPlatform::processMovement( int _frames ) void CNpcBigWheelPlatform::processMovement( int _frames )
{ {
m_rotation += m_data[m_type].speed * _frames; m_rotation += m_speed * _frames;
m_rotation &= 4095; m_rotation &= 4095;
Pos.vx = m_base.vx + ( ( m_extension * rcos( m_rotation ) ) >> 12 ); Pos.vx = m_base.vx + ( ( m_extension * rcos( m_rotation ) ) >> 12 );

View File

@ -35,7 +35,7 @@ void CNpcCartPlatform::postInit()
m_npcPath.setPathType( CNpcPath::SINGLE_USE_PATH ); m_npcPath.setPathType( CNpcPath::SINGLE_USE_PATH );
m_carSpeed = m_data[m_type].speed << 8; m_carSpeed = m_speed << 8;
} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -28,7 +28,7 @@ void CNpcCircularPlatform::postInit()
void CNpcCircularPlatform::processMovement( int _frames ) void CNpcCircularPlatform::processMovement( int _frames )
{ {
m_rotation += m_data[m_type].speed; m_rotation += m_speed;
m_rotation &= 4095; m_rotation &= 4095;
Pos.vx = m_base.vx + ( ( m_extension * rcos( m_rotation ) ) >> 12 ); Pos.vx = m_base.vx + ( ( m_extension * rcos( m_rotation ) ) >> 12 );

View File

@ -55,7 +55,7 @@ void CNpcFallingPlatform::processMovement( int _frames )
else else
{ {
moveX = 0; moveX = 0;
moveY = m_data[m_type].speed * _frames; moveY = m_speed * _frames;
if ( heading == 3072 ) if ( heading == 3072 )
{ {

View File

@ -49,7 +49,7 @@ void CNpcFallingNoRespawnPlatform::processMovement( int _frames )
else else
{ {
moveX = 0; moveX = 0;
moveY = m_data[m_type].speed * _frames; moveY = m_speed * _frames;
if ( heading == 3072 ) if ( heading == 3072 )
{ {

View File

@ -59,7 +59,7 @@ void CNpcFishHookPlatform::processMovement( int _frames )
{ {
if ( m_isMoving ) if ( m_isMoving )
{ {
Pos.vy -= m_data[m_type].speed * _frames; Pos.vy -= m_speed * _frames;
if ( Pos.vy < 0 ) if ( Pos.vy < 0 )
{ {

View File

@ -52,7 +52,7 @@ void CNpcGeyserPlatform::processMovement( int _frames )
} }
else else
{ {
s32 moveY = m_data[m_type].speed * _frames; s32 moveY = m_speed * _frames;
if ( Pos.vy < ( minY + 64 ) ) if ( Pos.vy < ( minY + 64 ) )
{ {
@ -86,7 +86,7 @@ void CNpcGeyserPlatform::processMovement( int _frames )
} }
else else
{ {
s32 moveY = m_data[m_type].speed * _frames; s32 moveY = m_speed * _frames;
if ( Pos.vy < ( minY + 64 ) ) if ( Pos.vy < ( minY + 64 ) )
{ {

View File

@ -428,6 +428,8 @@ void CNpcPlatform::init()
m_isShuttingDown = false; m_isShuttingDown = false;
m_npcPath.initPath(); m_npcPath.initPath();
m_speed = m_data[m_type].speed;
} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -112,6 +112,8 @@ public:
void setToShutdown(); void setToShutdown();
u8 isSetToShutdown() {return( m_isShuttingDown );} u8 isSetToShutdown() {return( m_isShuttingDown );}
void setSpeed( s16 newSpeed ) {m_speed = newSpeed;}
protected: protected:
// NPC data structure definitions // // NPC data structure definitions //
@ -202,6 +204,7 @@ protected:
s32 m_tiltAngle; s32 m_tiltAngle;
s32 m_tiltVelocity; s32 m_tiltVelocity;
bool m_extendDir; bool m_extendDir;
s16 m_speed;
CModelGfx *m_modelGfx; CModelGfx *m_modelGfx;
u8 m_isShuttingDown; u8 m_isShuttingDown;

View File

@ -59,7 +59,7 @@ void CNpcLeafPlatform::processMovement( int _frames )
else else
{ {
moveX = 0; moveX = 0;
moveY = m_data[m_type].speed * _frames; moveY = m_speed * _frames;
if ( heading == 3072 ) if ( heading == 3072 )
{ {

View File

@ -77,8 +77,8 @@ void CNpcLinearPlatform::processMovement( int _frames )
m_heading += moveDist; m_heading += moveDist;
m_heading &= 4095; m_heading &= 4095;
s32 preShiftX = _frames * m_data[m_type].speed * rcos( m_heading ); s32 preShiftX = _frames * m_speed * rcos( m_heading );
s32 preShiftY = _frames * m_data[m_type].speed * rsin( m_heading ); s32 preShiftY = _frames * m_speed * rsin( m_heading );
moveX = preShiftX >> 12; moveX = preShiftX >> 12;
if ( !moveX && preShiftX ) if ( !moveX && preShiftX )

View File

@ -89,7 +89,7 @@ void CNpcRaftPlatform::processMovement( int _frames )
distX = distX / abs( distX ); distX = distX / abs( distX );
if ( m_layerCollision->getHeightFromGround( Pos.vx + ( distX * m_data[m_type].speed * _frames ), Pos.vy ) < -maxHeight ) if ( m_layerCollision->getHeightFromGround( Pos.vx + ( distX * m_speed * _frames ), Pos.vy ) < -maxHeight )
{ {
// there is an obstacle in the way, increment the path point (hopefully this will resolve the problem) // there is an obstacle in the way, increment the path point (hopefully this will resolve the problem)
@ -105,7 +105,7 @@ void CNpcRaftPlatform::processMovement( int _frames )
{ {
// groundHeight <= yMovement indicates either just above ground or on or below ground // groundHeight <= yMovement indicates either just above ground or on or below ground
moveX = distX * m_data[m_type].speed * _frames; moveX = distX * m_speed * _frames;
moveY = groundHeight; moveY = groundHeight;
} }
else else

View File

@ -63,11 +63,11 @@ void CNpcSteerableBarrelPlatform::processMovement( int _frames )
{ {
// roll barrel right // roll barrel right
moveX = m_data[m_type].speed * _frames; moveX = m_speed * _frames;
} }
else if ( playerX < -5 ) else if ( playerX < -5 )
{ {
moveX = -m_data[m_type].speed * _frames; moveX = -m_speed * _frames;
} }
// check for collision // check for collision