From e0d7168d5c28c96a8035e4799d3fcc0ecd0e6120 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 6 Feb 2001 19:29:35 +0000 Subject: [PATCH] --- makefile.gaz | 1 + source/enemy/ngeneric.cpp | 21 +++--------------- source/enemy/npc.cpp | 22 +++++++++++++++++-- source/enemy/npc.h | 15 ++++++++++++- source/enemy/npcdata.cpp | 8 +++---- .../spongebob project/spongebob project.dsp | 4 ++++ 6 files changed, 46 insertions(+), 25 deletions(-) diff --git a/makefile.gaz b/makefile.gaz index d61b3c3d2..f1f8d9a7a 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -72,6 +72,7 @@ enemy_src := 2denemy \ nhazard \ nffolk \ nocto \ + nfskull \ enemy projectl_src := projectl diff --git a/source/enemy/ngeneric.cpp b/source/enemy/ngeneric.cpp index 1a279fe96..aa4896fd8 100644 --- a/source/enemy/ngeneric.cpp +++ b/source/enemy/ngeneric.cpp @@ -83,7 +83,7 @@ void CNpc::processGenericGotoTarget( int _frames, s32 xDist, s32 yDist, s32 spee Pos.vy += moveY; } -void CNpc::processCloseGenericUserSeek( int _frames ) +void CNpc::processGenericGetUserDist( int _frames, s32 *distX, s32 *distY ) { s32 moveX = 0, moveY = 0; @@ -95,21 +95,6 @@ void CNpc::processCloseGenericUserSeek( int _frames ) DVECTOR playerPos = player->getPos(); - s32 xDist, yDist; - s32 xDistSqr, yDistSqr; - - xDist = playerPos.vx - this->Pos.vx; - xDistSqr = xDist * xDist; - - yDist = playerPos.vy - this->Pos.vy; - yDistSqr = yDist * yDist; - - //if ( xDistSqr + yDistSqr > 22500 ) - //{ - //this->m_controlFunc = NPC_CONTROL_MOVEMENT; - //} - //else - { - processGenericGotoTarget( _frames, xDist, yDist, m_data[m_type].speed ); - } + *distX = playerPos.vx - this->Pos.vx; + *distY = playerPos.vy - this->Pos.vy; } diff --git a/source/enemy/npc.cpp b/source/enemy/npc.cpp index b49d3cdbf..c90794581 100644 --- a/source/enemy/npc.cpp +++ b/source/enemy/npc.cpp @@ -48,7 +48,7 @@ void CNpc::init() { - m_type = NPC_SMALL_JELLYFISH_1; + m_type = NPC_FLAMING_SKULL; m_heading = m_fireHeading = 0; m_movementTimer = 0; @@ -266,6 +266,13 @@ void CNpc::init() break; } + case NPC_FLAMING_SKULL: + { + m_state = FLAMING_SKULL_ATTACK; + + break; + } + default: break; @@ -539,6 +546,7 @@ bool CNpc::processSensor() case NPC_SENSOR_ANEMONE_USER_CLOSE: case NPC_SENSOR_EYEBALL_USER_CLOSE: + case NPC_SENSOR_FLAMING_SKULL_USER_CLOSE: { if ( xDistSqr + yDistSqr < 40000 ) { @@ -849,9 +857,14 @@ void CNpc::processClose(int _frames) break; case NPC_CLOSE_GENERIC_USER_SEEK: - processCloseGenericUserSeek( _frames ); + { + s32 distX, distY; + + processGenericGetUserDist( _frames, &distX, &distY ); + processGenericGotoTarget( _frames, distX, distY, m_data[m_type].speed ); break; + } case NPC_CLOSE_GHOST_PIRATE_ATTACK: processCloseGhostPirateAttack( _frames ); @@ -918,6 +931,11 @@ void CNpc::processClose(int _frames) break; + case NPC_CLOSE_FLAMING_SKULL_ATTACK: + processCloseFlamingSkullAttack( _frames ); + + break; + default: break; } diff --git a/source/enemy/npc.h b/source/enemy/npc.h index 0d0ade90b..59626672d 100644 --- a/source/enemy/npc.h +++ b/source/enemy/npc.h @@ -97,6 +97,7 @@ protected: NPC_INIT_FIREBALL, NPC_INIT_RETURNING_HAZARD, NPC_INIT_FISH_FOLK, + NPC_INIT_FLAMING_SKULL, }; enum NPC_CONTROL_FUNC @@ -125,6 +126,7 @@ protected: NPC_SENSOR_IRON_DOGFISH_USER_CLOSE, NPC_SENSOR_FALLING_ITEM_USER_CLOSE, NPC_SENSOR_FISH_HOOK_USER_CLOSE, + NPC_SENSOR_FLAMING_SKULL_USER_CLOSE, }; enum NPC_CLOSE_FUNC @@ -147,6 +149,7 @@ protected: NPC_CLOSE_IRON_DOGFISH_ATTACK, NPC_CLOSE_FALLING_ITEM_FALL, NPC_CLOSE_FISH_HOOK_RISE, + NPC_CLOSE_FLAMING_SKULL_ATTACK, }; enum NPC_MOVEMENT_FUNC @@ -208,6 +211,12 @@ protected: IRON_DOGFISH_LASER_EYE_2, }; + enum NPC_FLAMING_SKULL_STATE + { + FLAMING_SKULL_ATTACK = 0, + FLAMING_SKULL_RETURN = 1, + }; + enum { NPC_JELLYFISH_RESISTANCE = 64, @@ -244,7 +253,7 @@ protected: void processTimer( int _frames ); void processGenericGotoTarget( int _frames, s32 xDist, s32 yDist, s32 speed ); - void processCloseGenericUserSeek( int _frames ); + void processGenericGetUserDist( int _frames, s32 *distX, s32 *distY ); // small jellyfish functions @@ -285,6 +294,10 @@ protected: void processCloseEyeballAttack( int _frames ); + // flaming skull functions + + void processCloseFlamingSkullAttack( int _frames ); + // skull stomper functions void processCloseSkullStomperAttack( int _frames ); diff --git a/source/enemy/npcdata.cpp b/source/enemy/npcdata.cpp index 6fd726d76..9dbbf21b5 100644 --- a/source/enemy/npcdata.cpp +++ b/source/enemy/npcdata.cpp @@ -378,14 +378,14 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] = }, { // NPC_FLAMING_SKULL - NPC_INIT_DEFAULT, - NPC_SENSOR_NONE, + NPC_INIT_FLAMING_SKULL, + NPC_SENSOR_FLAMING_SKULL_USER_CLOSE, NPC_MOVEMENT_STATIC, NPC_MOVEMENT_MODIFIER_NONE, - NPC_CLOSE_NONE, + NPC_CLOSE_FLAMING_SKULL_ATTACK, NPC_TIMER_NONE, false, - 0, + 3, 128, }, diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index d2d987d31..e73057c7d 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -153,6 +153,10 @@ SOURCE=..\..\..\source\enemy\nffolk.cpp # End Source File # Begin Source File +SOURCE=..\..\..\source\enemy\nfskull.cpp +# End Source File +# Begin Source File + SOURCE=..\..\..\source\enemy\ngeneric.cpp # End Source File # Begin Source File