This commit is contained in:
parent
f311dad304
commit
c210b4b263
2 changed files with 81 additions and 1 deletions
|
@ -32,11 +32,66 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
bool CNpcSkeletalFishEnemy::processSensor()
|
||||||
|
{
|
||||||
|
switch( m_sensorFunc )
|
||||||
|
{
|
||||||
|
case NPC_SENSOR_NONE:
|
||||||
|
return( false );
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
if ( playerXDistSqr + playerYDistSqr < 10000 )
|
||||||
|
{
|
||||||
|
s32 xDistWaypoint, yDistWaypoint;
|
||||||
|
|
||||||
|
m_npcPath.getDistToNextWaypoint( Pos, &xDistWaypoint, &yDistWaypoint );
|
||||||
|
|
||||||
|
if ( abs( xDistWaypoint ) >= abs( playerXDist ) )
|
||||||
|
{
|
||||||
|
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||||
|
m_velocity = 0;
|
||||||
|
m_chargeTime = 0;
|
||||||
|
m_sensorFunc = NPC_SENSOR_NONE;
|
||||||
|
|
||||||
|
return( true );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return( false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void CNpcSkeletalFishEnemy::processClose( int _frames )
|
void CNpcSkeletalFishEnemy::processClose( int _frames )
|
||||||
{
|
{
|
||||||
s32 moveX, moveY;
|
s32 moveX, moveY;
|
||||||
s16 decDir, incDir, moveDist;
|
s16 decDir, incDir, moveDist;
|
||||||
|
|
||||||
|
if ( m_chargeTime > GameState::getOneSecondInFrames() )
|
||||||
|
{
|
||||||
|
if ( m_velocity < SKELETAL_FISH_CHARGE_VELOCITY )
|
||||||
|
{
|
||||||
|
m_velocity++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_chargeTime += _frames;
|
||||||
|
}
|
||||||
|
|
||||||
s16 headingToPlayer = ratan2( playerYDist, playerXDist );
|
s16 headingToPlayer = ratan2( playerYDist, playerXDist );
|
||||||
|
|
||||||
if ( !m_animPlaying )
|
if ( !m_animPlaying )
|
||||||
|
@ -73,7 +128,7 @@ void CNpcSkeletalFishEnemy::processClose( int _frames )
|
||||||
|
|
||||||
m_npcPath.getDistToNextWaypoint( Pos, &xDistWaypoint, &yDistWaypoint );
|
m_npcPath.getDistToNextWaypoint( Pos, &xDistWaypoint, &yDistWaypoint );
|
||||||
|
|
||||||
if ( abs( moveDist ) < 1024 && abs( xDistWaypoint ) >= abs( playerXDist ) )
|
if ( ( playerXDistSqr + playerYDistSqr > 100 ) && abs( xDistWaypoint ) >= abs( playerXDist ) )
|
||||||
{
|
{
|
||||||
// continue charge
|
// continue charge
|
||||||
|
|
||||||
|
@ -82,5 +137,21 @@ void CNpcSkeletalFishEnemy::processClose( int _frames )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_controlFunc = NPC_CONTROL_MOVEMENT;
|
m_controlFunc = NPC_CONTROL_MOVEMENT;
|
||||||
|
m_timerFunc = NPC_TIMER_ATTACK_DONE;
|
||||||
|
m_chargeTime = m_timerTimer = GameState::getOneSecondInFrames();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
s32 CNpcSkeletalFishEnemy::getFrameShift( int _frames )
|
||||||
|
{
|
||||||
|
if ( m_chargeTime < GameState::getOneSecondInFrames() )
|
||||||
|
{
|
||||||
|
return( _frames << 8 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return( ( _frames << 8 ) >> 2 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,16 @@
|
||||||
class CNpcSkeletalFishEnemy : public CNpcEnemy
|
class CNpcSkeletalFishEnemy : public CNpcEnemy
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
virtual bool processSensor();
|
||||||
virtual void processClose( int _frames );
|
virtual void processClose( int _frames );
|
||||||
|
virtual s32 getFrameShift( int _frames );
|
||||||
|
|
||||||
|
s32 m_chargeTime;
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
SKELETAL_FISH_CHARGE_VELOCITY = 6,
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Add table
Add a link
Reference in a new issue