This commit is contained in:
Charles 2001-04-18 16:34:17 +00:00
parent 8afe90e6d4
commit 52c69c25b8
11 changed files with 64 additions and 31 deletions

View File

@ -114,11 +114,11 @@ void CNpcEnemy::processCloseAnemone1Attack( int _frames )
m_heading += moveDist; m_heading += moveDist;
m_heading = m_heading % ONE; m_heading &= 4095;
if ( withinRange ) if ( withinRange )
{ {
// can fire // can fire, start firing anim
if ( m_timerTimer <= 0 && !m_animPlaying ) if ( m_timerTimer <= 0 && !m_animPlaying )
{ {
@ -128,22 +128,40 @@ void CNpcEnemy::processCloseAnemone1Attack( int _frames )
m_animNo = ANIM_ANENOMELVL1_FIRE; m_animNo = ANIM_ANENOMELVL1_FIRE;
m_frame = 0; m_frame = 0;
} }
else }
{ }
CProjectile *projectile; }
projectile = new( "test projectile" ) CProjectile; else
projectile->init( Pos, m_heading ); {
projectile->setLayerCollision( m_layerCollision ); if ( !m_animPlaying || m_animNo != ANIM_ANENOMELVL1_BEND )
{
m_animPlaying = true;
m_animNo = ANIM_ANENOMELVL1_BEND;
m_frame = 0;
}
}
m_controlFunc = NPC_CONTROL_MOVEMENT; if ( withinRange )
m_timerTimer = GameState::getOneSecondInFrames(); {
m_timerFunc = NPC_TIMER_ATTACK_DONE; if ( m_timerTimer <= 0 && !m_animPlaying )
m_sensorFunc = NPC_SENSOR_NONE; {
if ( m_animNo == ANIM_ANENOMELVL1_FIRE )
{
// if firing anim is complete and user is still in range, fire projectile
m_animPlaying = true; CProjectile *projectile;
m_animNo = ANIM_ANENOMELVL1_BEND; projectile = new( "test projectile" ) CProjectile;
m_frame = 0; projectile->init( Pos, m_heading );
} projectile->setLayerCollision( m_layerCollision );
m_controlFunc = NPC_CONTROL_MOVEMENT;
m_timerTimer = GameState::getOneSecondInFrames();
m_timerFunc = NPC_TIMER_ATTACK_DONE;
m_sensorFunc = NPC_SENSOR_NONE;
m_animPlaying = true;
m_animNo = ANIM_ANENOMELVL1_BEND;
m_frame = 0;
} }
} }
} }

View File

@ -43,8 +43,10 @@ void CNpcEnemy::processBallBlobMovement( int _frames, s32 *moveX, s32 *moveY )
} }
// deal with horizontal // deal with horizontal
bool pathComplete;
if ( m_npcPath.thinkFlat( Pos, &waypointXDist, &waypointYDist, &waypointHeading ) ) if ( m_npcPath.thinkFlat( Pos, &pathComplete, &waypointXDist, &waypointYDist, &waypointHeading ) )
{ {
// increment waypoint // increment waypoint

View File

@ -240,7 +240,9 @@ void CNpcEnemy::processGenericFixedPathWalk( int _frames, s32 *moveX, s32 *moveY
// ignore y component of waypoint, since we are stuck to the ground // ignore y component of waypoint, since we are stuck to the ground
if ( m_npcPath.thinkFlat( Pos, &distX, &distY, &m_heading ) ) bool pathComplete;
if ( m_npcPath.thinkFlat( Pos, &pathComplete, &distX, &distY, &m_heading ) )
{ {
// path has finished, waypoint has changed, or there are no waypoints - do not move horizontally // path has finished, waypoint has changed, or there are no waypoints - do not move horizontally

View File

@ -1259,6 +1259,13 @@ void CNpcEnemy::processMovement(int _frames)
break; break;
} }
case NPC_MOVEMENT_RETURNING_HAZARD_GROUND:
{
processReturningHazardMovementGround( _frames );
break;
}
case NPC_MOVEMENT_SHARK_MAN: case NPC_MOVEMENT_SHARK_MAN:
{ {
processSharkManMovement( _frames, &moveX, &moveY ); processSharkManMovement( _frames, &moveX, &moveY );

View File

@ -291,6 +291,7 @@ protected:
NPC_MOVEMENT_STATIC_CYCLE_ANIM, NPC_MOVEMENT_STATIC_CYCLE_ANIM,
NPC_MOVEMENT_SHARK_MAN, NPC_MOVEMENT_SHARK_MAN,
NPC_MOVEMENT_BALL_BLOB, NPC_MOVEMENT_BALL_BLOB,
NPC_MOVEMENT_RETURNING_HAZARD_GROUND,
}; };
enum NPC_MOVEMENT_MODIFIER_FUNC enum NPC_MOVEMENT_MODIFIER_FUNC
@ -566,6 +567,7 @@ protected:
void processPendulumMovement( int _frames ); void processPendulumMovement( int _frames );
void processFireballMovement( int _frames ); void processFireballMovement( int _frames );
void processReturningHazardMovement( int _frames ); void processReturningHazardMovement( int _frames );
void processReturningHazardMovementGround( int _frames );
// data // data

View File

@ -368,7 +368,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
ANIM_DUSTDEVIL_TWIST, ANIM_DUSTDEVIL_TWIST,
NPC_INIT_RETURNING_HAZARD, NPC_INIT_RETURNING_HAZARD,
NPC_SENSOR_NONE, NPC_SENSOR_NONE,
NPC_MOVEMENT_RETURNING_HAZARD, NPC_MOVEMENT_RETURNING_HAZARD_GROUND,
NPC_MOVEMENT_MODIFIER_NONE, NPC_MOVEMENT_MODIFIER_NONE,
NPC_CLOSE_NONE, NPC_CLOSE_NONE,
NPC_TIMER_NONE, NPC_TIMER_NONE,
@ -469,7 +469,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
NPC_CLOSE_JELLYFISH_EVADE, NPC_CLOSE_JELLYFISH_EVADE,
NPC_TIMER_NONE, NPC_TIMER_NONE,
false, false,
3, 2,
128, 128,
DETECT_ALL_COLLISION, DETECT_ALL_COLLISION,
DAMAGE__SHOCK_ENEMY, DAMAGE__SHOCK_ENEMY,
@ -661,8 +661,8 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
NPC_CLOSE_NONE, NPC_CLOSE_NONE,
NPC_TIMER_NONE, NPC_TIMER_NONE,
false, false,
5, 3,
256, 2048,
DETECT_ALL_COLLISION, DETECT_ALL_COLLISION,
DAMAGE__HIT_ENEMY, DAMAGE__HIT_ENEMY,
16, 16,

View File

@ -267,10 +267,12 @@ s32 CNpcPath::think( DVECTOR currentPos, bool *pathComplete, bool *waypointChang
return( headingToTarget ); return( headingToTarget );
} }
bool CNpcPath::thinkFlat( DVECTOR currentPos, s32 *distX, s32 *distY, s32 *heading ) bool CNpcPath::thinkFlat( DVECTOR currentPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading )
{ {
bool pointChange = false; bool pointChange = false;
*pathComplete = false;
if ( !this->waypoint ) if ( !this->waypoint )
{ {
return( true ); return( true );
@ -289,7 +291,7 @@ bool CNpcPath::thinkFlat( DVECTOR currentPos, s32 *distX, s32 *distY, s32 *headi
if ( abs( *distX ) < 10 ) if ( abs( *distX ) < 10 )
{ {
pointChange = true; pointChange = true;
incPath(); *pathComplete = incPath();
} }
*distX = currentWaypoint->pos.vx - currentPos.vx; *distX = currentWaypoint->pos.vx - currentPos.vx;
@ -311,6 +313,8 @@ bool CNpcPath::thinkVertical( DVECTOR currentPos, bool *pathComplete, s32 *distX
{ {
bool pointChange = false; bool pointChange = false;
*pathComplete = false;
if ( !this->waypoint ) if ( !this->waypoint )
{ {
return( true ); return( true );
@ -326,8 +330,6 @@ bool CNpcPath::thinkVertical( DVECTOR currentPos, bool *pathComplete, s32 *distX
*distX = currentWaypoint->pos.vx - currentPos.vx; *distX = currentWaypoint->pos.vx - currentPos.vx;
*distY = currentWaypoint->pos.vy - currentPos.vy; *distY = currentWaypoint->pos.vy - currentPos.vy;
*pathComplete = false;
if ( abs( *distY ) < 10 ) if ( abs( *distY ) < 10 )
{ {
pointChange = true; pointChange = true;

View File

@ -44,7 +44,7 @@ public:
void resetPath(); void resetPath();
void reversePathDir(); void reversePathDir();
s32 think( DVECTOR currentPos, bool *pathComplete, bool *waypointChange ); s32 think( DVECTOR currentPos, bool *pathComplete, bool *waypointChange );
bool thinkFlat( DVECTOR currentPos, s32 *distX, s32 *distY, s32 *heading ); bool thinkFlat( DVECTOR currentPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading );
bool thinkVertical( DVECTOR currentPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading ); bool thinkVertical( DVECTOR currentPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading );
bool getDistToNextWaypoint( DVECTOR currentPos, s32 *distX, s32 *distY ); bool getDistToNextWaypoint( DVECTOR currentPos, s32 *distX, s32 *distY );
void getPathXExtents( s32 *minExtent, s32 *maxExtent ); void getPathXExtents( s32 *minExtent, s32 *maxExtent );

View File

@ -122,7 +122,7 @@ void CNpcEnemy::processSpiderCrabCollision()
{ {
CPlayer *player = GameScene.getPlayer(); CPlayer *player = GameScene.getPlayer();
//player->takeDamage( m_data[m_type].damageToUserType ); player->takeDamage( m_data[m_type].damageToUserType );
m_animNo = ANIM_SPIDERCRAB_BITE; m_animNo = ANIM_SPIDERCRAB_BITE;
m_animPlaying = true; m_animPlaying = true;
@ -142,7 +142,7 @@ void CNpcEnemy::processSpiderCrabCollision()
{ {
CPlayer *player = GameScene.getPlayer(); CPlayer *player = GameScene.getPlayer();
//player->takeDamage( m_data[m_type].damageToUserType ); player->takeDamage( m_data[m_type].damageToUserType );
m_controlFunc = m_oldControlFunc; m_controlFunc = m_oldControlFunc;
} }

View File

@ -225,7 +225,7 @@ void CNpcEnemy::processCloseSmallJellyfishEvade( int _frames )
m_heading += moveDist; m_heading += moveDist;
m_heading = m_heading % ONE; m_heading &= 4095;
moveX = ( _frames * 3 * rcos( m_heading ) ) >> 12; moveX = ( _frames * 3 * rcos( m_heading ) ) >> 12;
moveY = ( _frames * 3 * rsin( m_heading ) ) >> 12; moveY = ( _frames * 3 * rsin( m_heading ) ) >> 12;

View File

@ -60,7 +60,7 @@ void CNpcEnemy::processCloseSkullStomperAttack( int _frames )
// pause and change direction // pause and change direction
m_timerTimer = GameState::getOneSecondInFrames(); m_timerTimer = 3 * GameState::getOneSecondInFrames();
m_extendDir = EXTEND_UP; m_extendDir = EXTEND_UP;
} }
else else