diff --git a/makefile.gaz b/makefile.gaz index d08352507..1af25693b 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -73,6 +73,7 @@ enemy_src := 2denemy \ nffolk \ nocto \ nfskull \ + nsklfish \ enemy projectl_src := projectl diff --git a/source/enemy/npc.cpp b/source/enemy/npc.cpp index 4fb58d59b..00e026cfa 100644 --- a/source/enemy/npc.cpp +++ b/source/enemy/npc.cpp @@ -54,7 +54,7 @@ s32 CNpc::playerYDistSqr; void CNpc::init() { - m_type = NPC_FLAMING_SKULL; + m_type = NPC_SKELETAL_FISH; m_heading = m_fireHeading = 0; m_movementTimer = 0; @@ -453,7 +453,7 @@ bool CNpc::processSensor() } } - case NPC_SENSOR_SHARK_MAN_USER_VISIBLE: + case NPC_SENSOR_GENERIC_USER_VISIBLE: { s32 xDistWaypoint, yDistWaypoint; @@ -461,7 +461,7 @@ bool CNpc::processSensor() { // within range - // make sure user is closer to shark man than next waypoint + // make sure user is closer to npc than next waypoint s32 xDistWaypoint, yDistWaypoint; @@ -506,7 +506,7 @@ bool CNpc::processSensor() } else { - // check if shark man is facing user + // check if npc is facing user decDir = m_heading - headingToPlayer; @@ -949,6 +949,11 @@ void CNpc::processClose(int _frames) break; + case NPC_CLOSE_SKELETAL_FISH_ATTACK: + processCloseSkeletalFishAttack( _frames ); + + break; + default: break; } diff --git a/source/enemy/npc.h b/source/enemy/npc.h index 2f5cd0862..b85820685 100644 --- a/source/enemy/npc.h +++ b/source/enemy/npc.h @@ -46,6 +46,7 @@ public: NPC_ANEMONE_1, NPC_ANEMONE_2, NPC_ANEMONE_3, + NPC_SKELETAL_FISH, NPC_CLAM, NPC_SQUID_DART, NPC_FISH_FOLK, @@ -122,7 +123,7 @@ protected: NPC_SENSOR_SPIDER_CRAB_USER_CLOSE, NPC_SENSOR_NINJA_STARFISH_USER_CLOSE, NPC_SENSOR_GHOST_PIRATE_USER_CLOSE, - NPC_SENSOR_SHARK_MAN_USER_VISIBLE, + NPC_SENSOR_GENERIC_USER_VISIBLE, NPC_SENSOR_OIL_BLOB_USER_CLOSE, NPC_SENSOR_ANEMONE_USER_CLOSE, NPC_SENSOR_EYEBALL_USER_CLOSE, @@ -156,6 +157,7 @@ protected: NPC_CLOSE_FALLING_ITEM_FALL, NPC_CLOSE_FISH_HOOK_RISE, NPC_CLOSE_FLAMING_SKULL_ATTACK, + NPC_CLOSE_SKELETAL_FISH_ATTACK, }; enum NPC_MOVEMENT_FUNC @@ -302,6 +304,10 @@ protected: void processCloseAnemone2Attack( int _frames ); void processCloseAnemone3Attack( int _frames ); + // skeletal fish functions + + void processCloseSkeletalFishAttack( int _frames ); + // eyeball functions void processCloseEyeballAttack( int _frames ); diff --git a/source/enemy/npcdata.cpp b/source/enemy/npcdata.cpp index 3ffc8e8ac..85f012da8 100644 --- a/source/enemy/npcdata.cpp +++ b/source/enemy/npcdata.cpp @@ -204,6 +204,20 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] = DAMAGE__LAVA, }, + { // NPC_SKELETAL_FISH + NPC_INIT_DEFAULT, + NPC_SENSOR_GENERIC_USER_VISIBLE, + NPC_MOVEMENT_FIXED_PATH, + NPC_MOVEMENT_MODIFIER_NONE, + NPC_CLOSE_SKELETAL_FISH_ATTACK, + NPC_TIMER_NONE, + false, + 3, + 2048, + false, + DAMAGE__LAVA, + }, + { // NPC_CLAM NPC_INIT_DEFAULT, NPC_SENSOR_CLAM_USER_CLOSE, @@ -471,7 +485,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] = { // NPC_SHARK_MAN NPC_INIT_DEFAULT, - NPC_SENSOR_SHARK_MAN_USER_VISIBLE, + NPC_SENSOR_GENERIC_USER_VISIBLE, NPC_MOVEMENT_FIXED_PATH, NPC_MOVEMENT_MODIFIER_NONE, NPC_CLOSE_SHARK_MAN_ATTACK, diff --git a/source/enemy/nsklfish.cpp b/source/enemy/nsklfish.cpp new file mode 100644 index 000000000..0b77a254f --- /dev/null +++ b/source/enemy/nsklfish.cpp @@ -0,0 +1,71 @@ +/*========================================================================= + + nsklfish.cpp + + Author: CRB + Created: + Project: Spongebob + Purpose: + + Copyright (c) 2000 Climax Development Ltd + +===========================================================================*/ + +#ifndef __ENEMY_NPC_H__ +#include "enemy\npc.h" +#endif + +#ifndef __GAME_GAME_H__ +#include "game\game.h" +#endif + +#ifndef __PLAYER_PLAYER_H__ +#include "player\player.h" +#endif + + +void CNpc::processCloseSkeletalFishAttack( int _frames ) +{ + s32 moveX, moveY; + s16 decDir, incDir, moveDist; + + s16 headingToPlayer = ratan2( playerYDist, playerXDist ); + + decDir = m_heading - headingToPlayer; + + if ( decDir < 0 ) + { + decDir += ONE; + } + + incDir = headingToPlayer - m_heading; + + if ( incDir < 0 ) + { + incDir += ONE; + } + + if ( decDir < incDir ) + { + moveDist = -decDir; + } + else + { + moveDist = incDir; + } + + s32 xDistWaypoint, yDistWaypoint; + + m_npcPath.getDistToNextWaypoint( Pos, &xDistWaypoint, &yDistWaypoint ); + + if ( abs( moveDist ) < 1024 && abs( xDistWaypoint ) >= abs( playerXDist ) ) + { + // continue charge + + processGenericGotoTarget( _frames, playerXDist, playerYDist, m_velocity ); + } + else + { + m_controlFunc = NPC_CONTROL_MOVEMENT; + } +} diff --git a/source/projectl/projectl.cpp b/source/projectl/projectl.cpp index d3d1018d6..3ca691a2d 100644 --- a/source/projectl/projectl.cpp +++ b/source/projectl/projectl.cpp @@ -275,8 +275,8 @@ void CProjectile::render() offset = getScreenOffset(); - x = Pos.vx - offset.vx + ( scrnWidth >> 1 ) - ( spriteWidth >> 1 ); - y = Pos.vy - offset.vy + ( scrnHeight >> 1 ) - ( spriteHeight >> 1 ); + x = Pos.vx - offset.vx /*+ ( scrnWidth >> 1 )*/ - ( spriteWidth >> 1 ); + y = Pos.vy - offset.vy /*+ ( scrnHeight >> 1 )*/ - ( spriteHeight >> 1 ); m_spriteBank->printFT4(FRM_BARNACLEBOY,x,y,0,0,0); } diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index 7a5d1f68c..02d6b0d3b 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -209,6 +209,10 @@ SOURCE=..\..\..\source\enemy\nsjfish.cpp # End Source File # Begin Source File +SOURCE=..\..\..\source\enemy\nsklfish.cpp +# End Source File +# Begin Source File + SOURCE=..\..\..\source\enemy\nsshark.cpp # End Source File # Begin Source File