From 7766e2004449115f19248ab692fb007fcb2b114e Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 23 Feb 2001 21:35:11 +0000 Subject: [PATCH] --- source/enemy/ngeneric.cpp | 10 ++++++++++ source/enemy/npc.cpp | 25 +++++++++++++++++++++-- source/enemy/npc.h | 9 ++++++++- source/enemy/npcdata.cpp | 42 ++++++++++++++++++++++++++------------- 4 files changed, 69 insertions(+), 17 deletions(-) diff --git a/source/enemy/ngeneric.cpp b/source/enemy/ngeneric.cpp index f4c9f38b6..b43f70ce0 100644 --- a/source/enemy/ngeneric.cpp +++ b/source/enemy/ngeneric.cpp @@ -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() { ASSERT(m_layerCollision); diff --git a/source/enemy/npc.cpp b/source/enemy/npc.cpp index cc2ab78de..2a94f07c0 100644 --- a/source/enemy/npc.cpp +++ b/source/enemy/npc.cpp @@ -54,13 +54,14 @@ class CLayerCollision *CNpc::m_layerCollision; void CNpc::init() { - m_type = NPC_SMALL_JELLYFISH_1; + m_type = NPC_CIRCULAR_PLATFORM; m_heading = m_fireHeading = 0; m_movementTimer = 0; m_timerTimer = 0; m_velocity = 0; m_extension = 0; + m_rotation = 0; m_extension = EXTEND_RIGHT; @@ -246,13 +247,26 @@ void CNpc::init() break; } - case NPC_FLAMING_SKULL: + case NPC_INIT_FLAMING_SKULL: { m_state = FLAMING_SKULL_ATTACK; break; } + case NPC_INIT_CIRCULAR_PLATFORM: + { + Pos.vx = 300; + Pos.vy = 300; + + m_base = Pos; + + m_extendDir = EXTEND_CLOCKWISE; + m_extension = 100; + + break; + } + default: break; @@ -659,6 +673,13 @@ void CNpc::processMovement(int _frames) break; } + case NPC_MOVEMENT_FIXED_CIRCULAR: + { + processGenericCircularPath( _frames ); + + break; + } + case NPC_MOVEMENT_MOTHER_JELLYFISH: { processMotherJellyfishMovement( _frames ); diff --git a/source/enemy/npc.h b/source/enemy/npc.h index 37c1b7efb..f15843cb1 100644 --- a/source/enemy/npc.h +++ b/source/enemy/npc.h @@ -41,9 +41,10 @@ public: NPC_PENDULUM, NPC_FIREBALL, NPC_SAW_BLADE, + NPC_LINEAR_PLATFORM, + NPC_CIRCULAR_PLATFORM, NPC_SMALL_JELLYFISH_1, NPC_SMALL_JELLYFISH_2, - NPC_LARGE_JELLYFISH, NPC_ANEMONE_1, NPC_ANEMONE_2, NPC_ANEMONE_3, @@ -106,6 +107,7 @@ protected: NPC_INIT_RETURNING_HAZARD, NPC_INIT_FISH_FOLK, NPC_INIT_FLAMING_SKULL, + NPC_INIT_CIRCULAR_PLATFORM, }; enum NPC_CONTROL_FUNC @@ -167,6 +169,7 @@ protected: NPC_MOVEMENT_STATIC = 0, NPC_MOVEMENT_FIXED_PATH = 1, NPC_MOVEMENT_FIXED_PATH_WALK, + NPC_MOVEMENT_FIXED_CIRCULAR, NPC_MOVEMENT_MOTHER_JELLYFISH, NPC_MOVEMENT_SUB_SHARK, NPC_MOVEMENT_FLYING_DUTCHMAN, @@ -238,6 +241,8 @@ protected: EXTEND_DOWN = false, EXTEND_RIGHT = true, EXTEND_LEFT = false, + EXTEND_CLOCKWISE = true, + EXTEND_ANTICLOCKWISE = false, }; @@ -273,6 +278,7 @@ protected: void processGenericGetUserDist( int _frames, s32 *distX, s32 *distY ); void processGenericFixedPathMove( int _frames, s32 *moveX, s32 *moveY, s32 *moveVel, s32 *moveDist ); void processGenericFixedPathWalk( int _frames, s32 *moveX, s32 *moveY ); + void processGenericCircularPath( int _frames ); bool processGroundCollisionReverse( s32 *moveX, s32 *moveY ); // small jellyfish functions @@ -393,6 +399,7 @@ protected: s32 m_timerTimer; s32 m_extension; bool m_extendDir; + s16 m_rotation; DVECTOR m_base; u8 m_state; u8 m_salvoCount; diff --git a/source/enemy/npcdata.cpp b/source/enemy/npcdata.cpp index 55186bd15..9f168779c 100644 --- a/source/enemy/npcdata.cpp +++ b/source/enemy/npcdata.cpp @@ -134,6 +134,34 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] = 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_INIT_DEFAULT, NPC_SENSOR_JELLYFISH_USER_CLOSE, @@ -162,20 +190,6 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] = 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_INIT_DEFAULT, NPC_SENSOR_ANEMONE_USER_CLOSE,