This commit is contained in:
Charles 2001-02-14 16:04:41 +00:00
parent 55888be3d1
commit d249841bfc
3 changed files with 42 additions and 66 deletions

View file

@ -54,7 +54,7 @@ class CLayerCollision *CNpc::m_layerCollision;
void CNpc::init() void CNpc::init()
{ {
m_type = NPC_GARY; m_type = NPC_SKULL_STOMPER;
m_heading = m_fireHeading = 0; m_heading = m_fireHeading = 0;
m_movementTimer = 0; m_movementTimer = 0;
@ -116,23 +116,7 @@ void CNpc::init()
case NPC_INIT_SKULL_STOMPER: case NPC_INIT_SKULL_STOMPER:
{ {
m_heading = m_fireHeading = 1024; m_extendDir = EXTEND_DOWN;
m_npcPath.initPath();
DVECTOR newPos;
newPos.vx = 100;
newPos.vy = 100;
m_npcPath.addWaypoint( newPos );
newPos.vx = 100;
newPos.vy = 10;
m_npcPath.addWaypoint( newPos );
m_npcPath.setPathType( SINGLE_USE_PATH );
break; break;
} }

View file

@ -533,7 +533,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
NPC_CLOSE_SKULL_STOMPER_ATTACK, NPC_CLOSE_SKULL_STOMPER_ATTACK,
NPC_TIMER_NONE, NPC_TIMER_NONE,
false, false,
3, 5,
2048, 2048,
false, false,
DAMAGE__LAVA, DAMAGE__LAVA,

View file

@ -32,26 +32,44 @@ void CNpc::processCloseSkullStomperAttack( int _frames )
} }
else else
{ {
s32 velocity; if ( m_extendDir == EXTEND_DOWN )
bool pathComplete; {
bool waypointChange; if ( m_layerCollision->Get( Pos.vx >> 4, ( Pos.vy + ( m_data[m_type].speed * _frames ) ) >> 4 ) )
s16 headingToTarget = m_npcPath.think( Pos, &pathComplete, &waypointChange ); {
s32 moveX, moveY; // colliding with ground
if ( waypointChange ) s32 distY;
s32 lastPointY = 0;
for ( distY = 1 ; distY <= ( m_data[m_type].speed * _frames ) ; distY++ )
{ {
if ( !pathComplete ) if ( m_layerCollision->Get( Pos.vx >> 4, ( Pos.vy + distY ) >> 4 ) )
{ {
break;
}
else
{
lastPointY++;
}
}
Pos.vy += lastPointY;
// pause and change direction // pause and change direction
m_timerTimer = GameState::getOneSecondInFrames(); m_timerTimer = GameState::getOneSecondInFrames();
m_extendDir = EXTEND_UP; m_extendDir = EXTEND_UP;
}
else
{
// drop down
return; Pos.vy += m_data[m_type].speed * _frames;
} }
} }
else
if ( pathComplete ) {
if ( m_base.vx - Pos.vx == 0 && m_base.vy - Pos.vy == 0 )
{ {
m_controlFunc = NPC_CONTROL_MOVEMENT; m_controlFunc = NPC_CONTROL_MOVEMENT;
m_timerFunc = NPC_TIMER_ATTACK_DONE; m_timerFunc = NPC_TIMER_ATTACK_DONE;
@ -61,36 +79,10 @@ void CNpc::processCloseSkullStomperAttack( int _frames )
} }
else else
{ {
s32 preShiftX; // return to original position
s32 preShiftY;
m_heading = headingToTarget; processGenericGotoTarget( _frames, m_base.vx - Pos.vx, m_base.vy - Pos.vy, 1 );
if ( m_extendDir == EXTEND_DOWN )
{
preShiftX = _frames * 8 * rcos( m_heading );
preShiftY = _frames * 8 * rsin( m_heading );
} }
else
{
preShiftX = _frames * 2 * rcos( m_heading );
preShiftY = _frames * 2 * rsin( m_heading );
}
moveX = preShiftX >> 12;
if ( !moveX && preShiftX )
{
moveX = preShiftX / abs( preShiftX );
}
moveY = preShiftY >> 12;
if ( !moveY && preShiftY )
{
moveY = preShiftY / abs( preShiftY );
}
Pos.vx += moveX;
Pos.vy += moveY;
} }
} }
} }