This commit is contained in:
parent
00e017b62d
commit
4c64c9ed4e
@ -115,11 +115,11 @@ void CNpcBallBlobEnemy::processMovement( int _frames )
|
||||
|
||||
if ( waypointHeading == 0 )
|
||||
{
|
||||
moveX = m_data[m_type].speed * _frames;
|
||||
moveX = m_speed * _frames;
|
||||
}
|
||||
else
|
||||
{
|
||||
moveX = -m_data[m_type].speed * _frames;
|
||||
moveX = -m_speed * _frames;
|
||||
}
|
||||
|
||||
processMovementModifier( _frames, moveX, moveY, moveVel, moveDist );
|
||||
|
@ -174,7 +174,7 @@ void CNpcIronDogfishEnemy::processStandardIronDogfishAttack( int _frames )
|
||||
m_frame = 0;
|
||||
}
|
||||
|
||||
processWalkToUser( _frames, m_data[m_type].speed );
|
||||
processWalkToUser( _frames, m_speed );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -235,7 +235,7 @@ void CNpcIronDogfishEnemy::processStandardIronDogfishAttack( int _frames )
|
||||
m_frame = 0;
|
||||
}
|
||||
|
||||
processWalkToUser( _frames, m_data[m_type].speed );
|
||||
processWalkToUser( _frames, m_speed );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ void CNpcDustDevilEnemy::processMovement( int _frames )
|
||||
|
||||
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)
|
||||
|
||||
@ -107,7 +107,7 @@ void CNpcDustDevilEnemy::processMovement( int _frames )
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
else
|
||||
|
@ -65,7 +65,7 @@ void CNpcFlyingDutchmanEnemy::processMovement( int _frames )
|
||||
|
||||
if ( xDistSqr > 100 )
|
||||
{
|
||||
processGenericGotoTarget( _frames, xDist, 0, m_data[m_type].speed );
|
||||
processGenericGotoTarget( _frames, xDist, 0, m_speed );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -76,7 +76,7 @@ void CNpcFlyingDutchmanEnemy::processMovement( int _frames )
|
||||
|
||||
if ( yDistSqr > 100 )
|
||||
{
|
||||
processGenericGotoTarget( _frames, 0, yDist, m_data[m_type].speed );
|
||||
processGenericGotoTarget( _frames, 0, yDist, m_speed );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -90,7 +90,7 @@ void CNpcFlyingDutchmanEnemy::processMovement( int _frames )
|
||||
|
||||
if ( yDistSqr > 100 )
|
||||
{
|
||||
processGenericGotoTarget( _frames, 0, yDist, m_data[m_type].speed );
|
||||
processGenericGotoTarget( _frames, 0, yDist, m_speed );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -134,7 +134,7 @@ void CNpcFlyingDutchmanEnemy::processClose( int _frames )
|
||||
m_frame = 0;
|
||||
}
|
||||
|
||||
processGenericGotoTarget( _frames, 0, playerYDist, m_data[m_type].speed );
|
||||
processGenericGotoTarget( _frames, 0, playerYDist, m_speed );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ void CNpcFlamingSkullEnemy::processClose( int _frames )
|
||||
}
|
||||
else
|
||||
{
|
||||
processGenericGotoTarget( _frames, distX, distY, m_data[m_type].speed );
|
||||
processGenericGotoTarget( _frames, distX, distY, m_speed );
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -102,7 +102,7 @@ void CNpcFlamingSkullEnemy::processClose( int _frames )
|
||||
}
|
||||
else
|
||||
{
|
||||
processGenericGotoTarget( _frames, distX, distY, m_data[m_type].speed );
|
||||
processGenericGotoTarget( _frames, distX, distY, m_speed );
|
||||
}
|
||||
}
|
||||
}
|
@ -245,8 +245,8 @@ void CNpcEnemy::processGenericFixedPathMove( int _frames, s32 *moveX, s32 *moveY
|
||||
m_heading += *moveDist;
|
||||
m_heading &= 4095;
|
||||
|
||||
s32 preShiftX = _frames * m_data[m_type].speed * rcos( m_heading );
|
||||
s32 preShiftY = _frames * m_data[m_type].speed * rsin( m_heading );
|
||||
s32 preShiftX = _frames * m_speed * rcos( m_heading );
|
||||
s32 preShiftY = _frames * m_speed * rsin( m_heading );
|
||||
|
||||
*moveX = preShiftX >> 12;
|
||||
if ( !(*moveX) && preShiftX )
|
||||
@ -298,7 +298,7 @@ void CNpcEnemy::processGenericFixedPathMove( int _frames, s32 *moveX, s32 *moveY
|
||||
*moveY = 0;
|
||||
}
|
||||
|
||||
*moveVel = ( _frames * m_data[m_type].speed ) << 8;
|
||||
*moveVel = ( _frames * m_speed ) << 8;
|
||||
|
||||
//processGroundCollisionReverse( moveX, moveY );
|
||||
}
|
||||
@ -346,7 +346,7 @@ void CNpcEnemy::processGenericFixedPathWalk( int _frames, s32 *moveX, s32 *moveY
|
||||
|
||||
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)
|
||||
|
||||
@ -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
|
||||
|
||||
*moveX = distX * m_data[m_type].speed * _frames;
|
||||
*moveX = distX * m_speed * _frames;
|
||||
*moveY = groundHeight;
|
||||
}
|
||||
else
|
||||
|
@ -79,7 +79,7 @@ void CNpcMotherJellyfishEnemy::processMovement( int _frames )
|
||||
|
||||
if ( xDistSqr + yDistSqr > 100 )
|
||||
{
|
||||
processGenericGotoTarget( _frames, xDist, yDist, m_data[m_type].speed );
|
||||
processGenericGotoTarget( _frames, xDist, yDist, m_speed );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -187,7 +187,7 @@ void CNpcMotherJellyfishEnemy::processClose( int _frames )
|
||||
|
||||
if ( xDistSqr + yDistSqr > 400 )
|
||||
{
|
||||
processGenericGotoTarget( _frames, xDist, yDist, m_data[m_type].speed );
|
||||
processGenericGotoTarget( _frames, xDist, yDist, m_speed );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -636,6 +636,7 @@ void CNpcEnemy::init()
|
||||
m_drawRotation = 0;
|
||||
m_isCaught = false;
|
||||
m_isBlowerOn = false;
|
||||
m_speed = m_data[m_type].speed;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -942,7 +943,7 @@ bool CNpcEnemy::processSensor()
|
||||
if ( playerXDistSqr + playerYDistSqr < 10000 )
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
m_velocity = m_data[m_type].speed;
|
||||
m_velocity = m_speed;
|
||||
|
||||
return( true );
|
||||
}
|
||||
@ -1241,7 +1242,7 @@ void CNpcEnemy::processClose(int _frames)
|
||||
{
|
||||
case NPC_CLOSE_GENERIC_USER_SEEK:
|
||||
{
|
||||
processGenericGotoTarget( _frames, playerXDist, playerYDist, m_data[m_type].speed );
|
||||
processGenericGotoTarget( _frames, playerXDist, playerYDist, m_speed );
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -105,6 +105,7 @@ public:
|
||||
bool canBeCaughtByNet();
|
||||
void caughtWithNet();
|
||||
virtual int getFrameCount();
|
||||
void setSpeed( s16 newSpeed ) {m_speed = newSpeed;}
|
||||
|
||||
static CNpcEnemy *Create(sThingActor *ThisActor);
|
||||
void setupWaypoints( sThingActor *ThisActor );
|
||||
@ -294,6 +295,7 @@ protected:
|
||||
u8 m_isCaught;
|
||||
u8 m_isBlowerOn;
|
||||
DVECTOR m_caughtPos;
|
||||
s16 m_speed;
|
||||
|
||||
s32 m_frame;
|
||||
int m_animNo;
|
||||
|
@ -117,7 +117,7 @@ void CNpcSubSharkEnemy::processMovement( int _frames )
|
||||
|
||||
if ( ( xDistSqr + yDistSqr ) > 100 )
|
||||
{
|
||||
processGenericGotoTarget( _frames, xDist, yDist, m_data[m_type].speed );
|
||||
processGenericGotoTarget( _frames, xDist, yDist, m_speed );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -138,7 +138,7 @@ void CNpcSubSharkEnemy::processMovement( int _frames )
|
||||
|
||||
if ( ( xDistSqr + yDistSqr ) > 100 )
|
||||
{
|
||||
processGenericGotoTarget( _frames, xDist, yDist, m_data[m_type].speed );
|
||||
processGenericGotoTarget( _frames, xDist, yDist, m_speed );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -178,7 +178,7 @@ void CNpcSubSharkEnemy::processClose( int _frames )
|
||||
m_frame = 0;
|
||||
}
|
||||
|
||||
processGenericGotoTarget( _frames, playerXDist, 0, m_data[m_type].speed );
|
||||
processGenericGotoTarget( _frames, playerXDist, 0, m_speed );
|
||||
|
||||
if ( playerXDistSqr < 100 )
|
||||
{
|
||||
|
@ -473,6 +473,11 @@ void CLevel::initThings(int _respawningLevel)
|
||||
enemy->setLayerCollision( getCollisionLayer() );
|
||||
enemy->setupWaypoints( ThisActor );
|
||||
enemy->postInit();
|
||||
|
||||
if ( ThisActor->Speed )
|
||||
{
|
||||
enemy->setSpeed( ThisActor->Speed );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -501,6 +506,11 @@ void CLevel::initThings(int _respawningLevel)
|
||||
platform = CNpcPlatform::Create( ThisPlatform );
|
||||
platform->setLayerCollision( getCollisionLayer() );
|
||||
platform->postInit();
|
||||
|
||||
if ( ThisPlatform->Speed )
|
||||
{
|
||||
platform->setSpeed( ThisPlatform->Speed );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
void CNpcBubblePlatform::processMovement( int _frames )
|
||||
{
|
||||
Pos.vy -= m_data[m_type].speed * _frames;
|
||||
Pos.vy -= m_speed * _frames;
|
||||
|
||||
if ( Pos.vy < 0 )
|
||||
{
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
void CNpcBigWheelPlatform::processMovement( int _frames )
|
||||
{
|
||||
m_rotation += m_data[m_type].speed * _frames;
|
||||
m_rotation += m_speed * _frames;
|
||||
m_rotation &= 4095;
|
||||
|
||||
Pos.vx = m_base.vx + ( ( m_extension * rcos( m_rotation ) ) >> 12 );
|
||||
|
@ -35,7 +35,7 @@ void CNpcCartPlatform::postInit()
|
||||
|
||||
m_npcPath.setPathType( CNpcPath::SINGLE_USE_PATH );
|
||||
|
||||
m_carSpeed = m_data[m_type].speed << 8;
|
||||
m_carSpeed = m_speed << 8;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -28,7 +28,7 @@ void CNpcCircularPlatform::postInit()
|
||||
|
||||
void CNpcCircularPlatform::processMovement( int _frames )
|
||||
{
|
||||
m_rotation += m_data[m_type].speed;
|
||||
m_rotation += m_speed;
|
||||
m_rotation &= 4095;
|
||||
|
||||
Pos.vx = m_base.vx + ( ( m_extension * rcos( m_rotation ) ) >> 12 );
|
||||
|
@ -55,7 +55,7 @@ void CNpcFallingPlatform::processMovement( int _frames )
|
||||
else
|
||||
{
|
||||
moveX = 0;
|
||||
moveY = m_data[m_type].speed * _frames;
|
||||
moveY = m_speed * _frames;
|
||||
|
||||
if ( heading == 3072 )
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ void CNpcFallingNoRespawnPlatform::processMovement( int _frames )
|
||||
else
|
||||
{
|
||||
moveX = 0;
|
||||
moveY = m_data[m_type].speed * _frames;
|
||||
moveY = m_speed * _frames;
|
||||
|
||||
if ( heading == 3072 )
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ void CNpcFishHookPlatform::processMovement( int _frames )
|
||||
{
|
||||
if ( m_isMoving )
|
||||
{
|
||||
Pos.vy -= m_data[m_type].speed * _frames;
|
||||
Pos.vy -= m_speed * _frames;
|
||||
|
||||
if ( Pos.vy < 0 )
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ void CNpcGeyserPlatform::processMovement( int _frames )
|
||||
}
|
||||
else
|
||||
{
|
||||
s32 moveY = m_data[m_type].speed * _frames;
|
||||
s32 moveY = m_speed * _frames;
|
||||
|
||||
if ( Pos.vy < ( minY + 64 ) )
|
||||
{
|
||||
@ -86,7 +86,7 @@ void CNpcGeyserPlatform::processMovement( int _frames )
|
||||
}
|
||||
else
|
||||
{
|
||||
s32 moveY = m_data[m_type].speed * _frames;
|
||||
s32 moveY = m_speed * _frames;
|
||||
|
||||
if ( Pos.vy < ( minY + 64 ) )
|
||||
{
|
||||
|
@ -428,6 +428,8 @@ void CNpcPlatform::init()
|
||||
m_isShuttingDown = false;
|
||||
|
||||
m_npcPath.initPath();
|
||||
|
||||
m_speed = m_data[m_type].speed;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -112,6 +112,8 @@ public:
|
||||
void setToShutdown();
|
||||
u8 isSetToShutdown() {return( m_isShuttingDown );}
|
||||
|
||||
void setSpeed( s16 newSpeed ) {m_speed = newSpeed;}
|
||||
|
||||
protected:
|
||||
// NPC data structure definitions //
|
||||
|
||||
@ -202,6 +204,7 @@ protected:
|
||||
s32 m_tiltAngle;
|
||||
s32 m_tiltVelocity;
|
||||
bool m_extendDir;
|
||||
s16 m_speed;
|
||||
|
||||
CModelGfx *m_modelGfx;
|
||||
u8 m_isShuttingDown;
|
||||
|
@ -59,7 +59,7 @@ void CNpcLeafPlatform::processMovement( int _frames )
|
||||
else
|
||||
{
|
||||
moveX = 0;
|
||||
moveY = m_data[m_type].speed * _frames;
|
||||
moveY = m_speed * _frames;
|
||||
|
||||
if ( heading == 3072 )
|
||||
{
|
||||
|
@ -77,8 +77,8 @@ void CNpcLinearPlatform::processMovement( int _frames )
|
||||
m_heading += moveDist;
|
||||
m_heading &= 4095;
|
||||
|
||||
s32 preShiftX = _frames * m_data[m_type].speed * rcos( m_heading );
|
||||
s32 preShiftY = _frames * m_data[m_type].speed * rsin( m_heading );
|
||||
s32 preShiftX = _frames * m_speed * rcos( m_heading );
|
||||
s32 preShiftY = _frames * m_speed * rsin( m_heading );
|
||||
|
||||
moveX = preShiftX >> 12;
|
||||
if ( !moveX && preShiftX )
|
||||
|
@ -89,7 +89,7 @@ void CNpcRaftPlatform::processMovement( int _frames )
|
||||
|
||||
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)
|
||||
|
||||
@ -105,7 +105,7 @@ void CNpcRaftPlatform::processMovement( int _frames )
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
else
|
||||
|
@ -63,11 +63,11 @@ void CNpcSteerableBarrelPlatform::processMovement( int _frames )
|
||||
{
|
||||
// roll barrel right
|
||||
|
||||
moveX = m_data[m_type].speed * _frames;
|
||||
moveX = m_speed * _frames;
|
||||
}
|
||||
else if ( playerX < -5 )
|
||||
{
|
||||
moveX = -m_data[m_type].speed * _frames;
|
||||
moveX = -m_speed * _frames;
|
||||
}
|
||||
|
||||
// check for collision
|
||||
|
Loading…
Reference in New Issue
Block a user