This commit is contained in:
parent
d920a3994a
commit
d6dabe439a
4 changed files with 101 additions and 69 deletions
|
@ -209,7 +209,7 @@ void CNpcEnemy::init()
|
|||
{
|
||||
CEnemyThing::init();
|
||||
|
||||
m_type = NPC_MOTHER_JELLYFISH;
|
||||
m_type = NPC_SUB_SHARK;
|
||||
|
||||
// sActorHdr *Hdr = m_skel.Load( m_data[m_type].skelType );
|
||||
// m_skel.Init( Hdr );
|
||||
|
@ -229,6 +229,7 @@ void CNpcEnemy::init()
|
|||
m_extension = 0;
|
||||
m_rotation = 0;
|
||||
m_reversed = false;
|
||||
m_salvoCount = 0;
|
||||
|
||||
m_health = m_data[this->m_type].initHealth;
|
||||
|
||||
|
@ -312,7 +313,7 @@ void CNpcEnemy::init()
|
|||
|
||||
case NPC_INIT_SUB_SHARK:
|
||||
{
|
||||
m_state = SUB_SHARK_CYCLE;
|
||||
m_state = SUB_SHARK_MINE_1;
|
||||
m_extendDir = EXTEND_RIGHT;
|
||||
|
||||
break;
|
||||
|
|
|
@ -285,9 +285,10 @@ protected:
|
|||
|
||||
enum NPC_SUB_SHARK_STATE
|
||||
{
|
||||
SUB_SHARK_CYCLE = 0,
|
||||
SUB_SHARK_MINE_1 = 1,
|
||||
SUB_SHARK_MINE_2,
|
||||
SUB_SHARK_MINE_1 = 0,
|
||||
SUB_SHARK_MINE_2 = 1,
|
||||
SUB_SHARK_CYCLE,
|
||||
SUB_SHARK_SWALLOW,
|
||||
};
|
||||
|
||||
enum NPC_FLYING_DUTCHMAN_STATE
|
||||
|
@ -316,6 +317,7 @@ protected:
|
|||
{
|
||||
NPC_JELLYFISH_RESISTANCE = 64,
|
||||
NPC_BOOGER_MONSTER_MAX_EXTENSION = 20,
|
||||
NPC_SUB_SHARK_HIGH_SPEED = 6,
|
||||
EXTEND_UP = true,
|
||||
EXTEND_DOWN = false,
|
||||
EXTEND_RIGHT = true,
|
||||
|
|
|
@ -714,7 +714,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
|||
NPC_TIMER_NONE,
|
||||
false,
|
||||
3,
|
||||
64,
|
||||
2048,
|
||||
false,
|
||||
DAMAGE__HIT_ENEMY,
|
||||
256,
|
||||
|
|
|
@ -35,11 +35,20 @@
|
|||
void CNpcEnemy::processSubSharkMovement( int _frames )
|
||||
{
|
||||
if ( !m_animPlaying )
|
||||
{
|
||||
if ( playerXDistSqr + playerYDistSqr < 100 && !m_salvoCount )
|
||||
{
|
||||
m_animPlaying = true;
|
||||
m_animNo = ANIM_SHARKSUB_SHARKSUBSWIPE;
|
||||
m_frame = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_animPlaying = true;
|
||||
m_animNo = ANIM_SHARKSUB_SHARKSUBSWIM;
|
||||
m_frame = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_timerTimer <= 0 )
|
||||
{
|
||||
|
@ -60,51 +69,56 @@ void CNpcEnemy::processSubSharkMovement( int _frames )
|
|||
if ( m_movementTimer > 0 )
|
||||
{
|
||||
m_movementTimer -= _frames;
|
||||
}
|
||||
|
||||
if ( m_extendDir == EXTEND_RIGHT )
|
||||
{
|
||||
s32 xDist = 600 - Pos.vx;
|
||||
s32 xDistSqr = xDist * xDist;
|
||||
s32 yDist = m_base.vy - Pos.vy;
|
||||
s32 yDistSqr = yDist * yDist;
|
||||
|
||||
if ( xDistSqr > 100 )
|
||||
if ( ( xDistSqr + yDistSqr ) > 100 )
|
||||
{
|
||||
processGenericGotoTarget( _frames, xDist, 0, m_data[m_type].speed );
|
||||
processGenericGotoTarget( _frames, xDist, yDist, m_data[m_type].speed );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_extendDir = EXTEND_LEFT;
|
||||
|
||||
if ( m_movementTimer <= 0 )
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
s32 xDist = 100 - Pos.vx;
|
||||
s32 xDistSqr = xDist * xDist;
|
||||
s32 yDist = m_base.vy - Pos.vy;
|
||||
s32 yDistSqr = yDist * yDist;
|
||||
|
||||
if ( xDistSqr > 100 )
|
||||
if ( ( xDistSqr + yDistSqr ) > 100 )
|
||||
{
|
||||
processGenericGotoTarget( _frames, xDist, 0, m_data[m_type].speed );
|
||||
processGenericGotoTarget( _frames, xDist, yDist, m_data[m_type].speed );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_extendDir = EXTEND_RIGHT;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if ( m_movementTimer <= 0 )
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CNpcEnemy::processCloseSubSharkAttack( int _frames )
|
||||
{
|
||||
if ( !m_animPlaying )
|
||||
if ( m_state != SUB_SHARK_SWALLOW )
|
||||
{
|
||||
m_animPlaying = true;
|
||||
m_animNo = ANIM_SHARKSUB_SHARKSUBCHOMP;
|
||||
m_frame = 0;
|
||||
}
|
||||
|
||||
if ( playerXDist > 0 )
|
||||
{
|
||||
m_extendDir = EXTEND_RIGHT;
|
||||
|
@ -113,40 +127,21 @@ void CNpcEnemy::processCloseSubSharkAttack( int _frames )
|
|||
{
|
||||
m_extendDir = EXTEND_LEFT;
|
||||
}
|
||||
}
|
||||
|
||||
switch( m_state )
|
||||
{
|
||||
case SUB_SHARK_MINE_1:
|
||||
{
|
||||
if ( playerXDistSqr > 100 )
|
||||
{
|
||||
processGenericGotoTarget( _frames, playerXDist, 0, m_data[m_type].speed );
|
||||
}
|
||||
else
|
||||
{
|
||||
// fire at player
|
||||
|
||||
m_salvoCount = 5;
|
||||
m_state = SUB_SHARK_MINE_2;
|
||||
m_movementTimer = GameState::getOneSecondInFrames() * 8;
|
||||
m_controlFunc = NPC_CONTROL_MOVEMENT;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SUB_SHARK_MINE_2:
|
||||
{
|
||||
if ( playerXDistSqr > 100 )
|
||||
{
|
||||
processGenericGotoTarget( _frames, playerXDist, 0, m_data[m_type].speed );
|
||||
}
|
||||
else
|
||||
|
||||
if ( playerXDistSqr < 100 )
|
||||
{
|
||||
// fire at player
|
||||
|
||||
m_salvoCount = 5;
|
||||
m_state = SUB_SHARK_CYCLE;
|
||||
m_state++;
|
||||
m_movementTimer = GameState::getOneSecondInFrames() * 8;
|
||||
m_controlFunc = NPC_CONTROL_MOVEMENT;
|
||||
}
|
||||
|
@ -158,12 +153,46 @@ void CNpcEnemy::processCloseSubSharkAttack( int _frames )
|
|||
{
|
||||
// charge player
|
||||
|
||||
if ( playerXDistSqr > 100 )
|
||||
if ( !m_animPlaying )
|
||||
{
|
||||
processGenericGotoTarget( _frames, playerXDist, 0, 6 );
|
||||
m_animPlaying = true;
|
||||
m_animNo = ANIM_SHARKSUB_SHARKSUBSPRINTOPEN;
|
||||
m_frame = 0;
|
||||
}
|
||||
|
||||
processGenericGotoTarget( _frames, playerXDist, 0, NPC_SUB_SHARK_HIGH_SPEED );
|
||||
|
||||
if ( playerXDistSqr < 10000 )
|
||||
{
|
||||
m_animPlaying = true;
|
||||
m_animNo = ANIM_SHARKSUB_SHARKSUBCHOMP;
|
||||
m_frame = 0;
|
||||
|
||||
m_state = SUB_SHARK_SWALLOW;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SUB_SHARK_SWALLOW:
|
||||
{
|
||||
// if ( collision )
|
||||
// else
|
||||
|
||||
if ( m_extendDir == EXTEND_RIGHT )
|
||||
{
|
||||
Pos.vx += NPC_SUB_SHARK_HIGH_SPEED;
|
||||
}
|
||||
else
|
||||
{
|
||||
Pos.vx -= NPC_SUB_SHARK_HIGH_SPEED;
|
||||
}
|
||||
|
||||
if ( !m_animPlaying )
|
||||
{
|
||||
m_animPlaying = true;
|
||||
m_animNo = ANIM_SHARKSUB_SHARKSUBSWIM;
|
||||
m_frame = 0;
|
||||
m_controlFunc = NPC_CONTROL_MOVEMENT;
|
||||
m_movementTimer = GameState::getOneSecondInFrames() * 8;
|
||||
m_state = SUB_SHARK_MINE_1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue