This commit is contained in:
Charles 2001-02-23 21:35:11 +00:00
parent 75c4f618fa
commit 7766e20044
4 changed files with 69 additions and 17 deletions

View File

@ -295,6 +295,16 @@ void CNpc::processGenericFixedPathWalk( int _frames, s32 *moveX, s32 *moveY )
} }
} }
void CNpc::processGenericCircularPath( int _frames )
{
m_rotation += m_data[m_type].speed;
m_rotation %= 4096;
Pos.vx = m_base.vx + ( ( m_extension * rcos( m_rotation ) ) >> 12 );
Pos.vy = m_base.vy + ( ( m_extension * rsin( m_rotation ) ) >> 12 );
}
bool CNpc::isCollisionWithGround() bool CNpc::isCollisionWithGround()
{ {
ASSERT(m_layerCollision); ASSERT(m_layerCollision);

View File

@ -54,13 +54,14 @@ class CLayerCollision *CNpc::m_layerCollision;
void CNpc::init() void CNpc::init()
{ {
m_type = NPC_SMALL_JELLYFISH_1; m_type = NPC_CIRCULAR_PLATFORM;
m_heading = m_fireHeading = 0; m_heading = m_fireHeading = 0;
m_movementTimer = 0; m_movementTimer = 0;
m_timerTimer = 0; m_timerTimer = 0;
m_velocity = 0; m_velocity = 0;
m_extension = 0; m_extension = 0;
m_rotation = 0;
m_extension = EXTEND_RIGHT; m_extension = EXTEND_RIGHT;
@ -246,13 +247,26 @@ void CNpc::init()
break; break;
} }
case NPC_FLAMING_SKULL: case NPC_INIT_FLAMING_SKULL:
{ {
m_state = FLAMING_SKULL_ATTACK; m_state = FLAMING_SKULL_ATTACK;
break; break;
} }
case NPC_INIT_CIRCULAR_PLATFORM:
{
Pos.vx = 300;
Pos.vy = 300;
m_base = Pos;
m_extendDir = EXTEND_CLOCKWISE;
m_extension = 100;
break;
}
default: default:
break; break;
@ -659,6 +673,13 @@ void CNpc::processMovement(int _frames)
break; break;
} }
case NPC_MOVEMENT_FIXED_CIRCULAR:
{
processGenericCircularPath( _frames );
break;
}
case NPC_MOVEMENT_MOTHER_JELLYFISH: case NPC_MOVEMENT_MOTHER_JELLYFISH:
{ {
processMotherJellyfishMovement( _frames ); processMotherJellyfishMovement( _frames );

View File

@ -41,9 +41,10 @@ public:
NPC_PENDULUM, NPC_PENDULUM,
NPC_FIREBALL, NPC_FIREBALL,
NPC_SAW_BLADE, NPC_SAW_BLADE,
NPC_LINEAR_PLATFORM,
NPC_CIRCULAR_PLATFORM,
NPC_SMALL_JELLYFISH_1, NPC_SMALL_JELLYFISH_1,
NPC_SMALL_JELLYFISH_2, NPC_SMALL_JELLYFISH_2,
NPC_LARGE_JELLYFISH,
NPC_ANEMONE_1, NPC_ANEMONE_1,
NPC_ANEMONE_2, NPC_ANEMONE_2,
NPC_ANEMONE_3, NPC_ANEMONE_3,
@ -106,6 +107,7 @@ protected:
NPC_INIT_RETURNING_HAZARD, NPC_INIT_RETURNING_HAZARD,
NPC_INIT_FISH_FOLK, NPC_INIT_FISH_FOLK,
NPC_INIT_FLAMING_SKULL, NPC_INIT_FLAMING_SKULL,
NPC_INIT_CIRCULAR_PLATFORM,
}; };
enum NPC_CONTROL_FUNC enum NPC_CONTROL_FUNC
@ -167,6 +169,7 @@ protected:
NPC_MOVEMENT_STATIC = 0, NPC_MOVEMENT_STATIC = 0,
NPC_MOVEMENT_FIXED_PATH = 1, NPC_MOVEMENT_FIXED_PATH = 1,
NPC_MOVEMENT_FIXED_PATH_WALK, NPC_MOVEMENT_FIXED_PATH_WALK,
NPC_MOVEMENT_FIXED_CIRCULAR,
NPC_MOVEMENT_MOTHER_JELLYFISH, NPC_MOVEMENT_MOTHER_JELLYFISH,
NPC_MOVEMENT_SUB_SHARK, NPC_MOVEMENT_SUB_SHARK,
NPC_MOVEMENT_FLYING_DUTCHMAN, NPC_MOVEMENT_FLYING_DUTCHMAN,
@ -238,6 +241,8 @@ protected:
EXTEND_DOWN = false, EXTEND_DOWN = false,
EXTEND_RIGHT = true, EXTEND_RIGHT = true,
EXTEND_LEFT = false, EXTEND_LEFT = false,
EXTEND_CLOCKWISE = true,
EXTEND_ANTICLOCKWISE = false,
}; };
@ -273,6 +278,7 @@ protected:
void processGenericGetUserDist( int _frames, s32 *distX, s32 *distY ); void processGenericGetUserDist( int _frames, s32 *distX, s32 *distY );
void processGenericFixedPathMove( int _frames, s32 *moveX, s32 *moveY, s32 *moveVel, s32 *moveDist ); void processGenericFixedPathMove( int _frames, s32 *moveX, s32 *moveY, s32 *moveVel, s32 *moveDist );
void processGenericFixedPathWalk( int _frames, s32 *moveX, s32 *moveY ); void processGenericFixedPathWalk( int _frames, s32 *moveX, s32 *moveY );
void processGenericCircularPath( int _frames );
bool processGroundCollisionReverse( s32 *moveX, s32 *moveY ); bool processGroundCollisionReverse( s32 *moveX, s32 *moveY );
// small jellyfish functions // small jellyfish functions
@ -393,6 +399,7 @@ protected:
s32 m_timerTimer; s32 m_timerTimer;
s32 m_extension; s32 m_extension;
bool m_extendDir; bool m_extendDir;
s16 m_rotation;
DVECTOR m_base; DVECTOR m_base;
u8 m_state; u8 m_state;
u8 m_salvoCount; u8 m_salvoCount;

View File

@ -134,6 +134,34 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
DAMAGE__LAVA, DAMAGE__LAVA,
}, },
{ // NPC_LINEAR_PLATFORM
NPC_INIT_DEFAULT,
NPC_SENSOR_NONE,
NPC_MOVEMENT_FIXED_PATH,
NPC_MOVEMENT_MODIFIER_NONE,
NPC_CLOSE_NONE,
NPC_TIMER_NONE,
false,
3,
128,
false,
DAMAGE__LAVA,
},
{ // NPC_CIRCULAR_PLATFORM
NPC_INIT_CIRCULAR_PLATFORM,
NPC_SENSOR_NONE,
NPC_MOVEMENT_FIXED_CIRCULAR,
NPC_MOVEMENT_MODIFIER_NONE,
NPC_CLOSE_NONE,
NPC_TIMER_NONE,
false,
3,
128,
false,
DAMAGE__LAVA,
},
{ // NPC_SMALL_JELLYFISH_1 { // NPC_SMALL_JELLYFISH_1
NPC_INIT_DEFAULT, NPC_INIT_DEFAULT,
NPC_SENSOR_JELLYFISH_USER_CLOSE, NPC_SENSOR_JELLYFISH_USER_CLOSE,
@ -162,20 +190,6 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
DAMAGE__LAVA, DAMAGE__LAVA,
}, },
{ // NPC_LARGE_JELLYFISH
NPC_INIT_DEFAULT,
NPC_SENSOR_NONE,
NPC_MOVEMENT_FIXED_PATH,
NPC_MOVEMENT_MODIFIER_NONE,
NPC_CLOSE_NONE,
NPC_TIMER_NONE,
false,
3,
128,
false,
DAMAGE__LAVA,
},
{ // NPC_ANEMONE_1 { // NPC_ANEMONE_1
NPC_INIT_DEFAULT, NPC_INIT_DEFAULT,
NPC_SENSOR_ANEMONE_USER_CLOSE, NPC_SENSOR_ANEMONE_USER_CLOSE,