This commit is contained in:
Charles 2001-02-12 15:37:31 +00:00
parent 7f10a4e47e
commit b0f4d49313
7 changed files with 109 additions and 8 deletions

View File

@ -73,6 +73,7 @@ enemy_src := 2denemy \
nffolk \
nocto \
nfskull \
nsklfish \
enemy
projectl_src := projectl

View File

@ -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;
}

View File

@ -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 );

View File

@ -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,

71
source/enemy/nsklfish.cpp Normal file
View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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