This commit is contained in:
Charles 2001-02-05 14:55:11 +00:00
parent 2a71836478
commit b9ccd83f66
7 changed files with 72 additions and 6 deletions

View File

@ -70,6 +70,7 @@ enemy_src := 2denemy \
nsshark \ nsshark \
ndogfish \ ndogfish \
nhazard \ nhazard \
nffolk \
enemy enemy
projectl_src := projectl projectl_src := projectl

View File

@ -48,7 +48,7 @@
void CNpc::init() void CNpc::init()
{ {
m_type = NPC_SAW_BLADE; m_type = NPC_FISH_FOLK;
m_heading = m_fireHeading = 0; m_heading = m_fireHeading = 0;
m_movementTimer = 0; m_movementTimer = 0;
@ -243,6 +243,29 @@ void CNpc::init()
break; break;
} }
case NPC_INIT_FISH_FOLK:
{
m_heading = m_fireHeading = 0;
m_npcPath.initPath();
DVECTOR newPos;
newPos.vx = 100;
newPos.vy = 100;
m_npcPath.addWaypoint( newPos );
newPos.vx = 500;
newPos.vy = 100;
m_npcPath.addWaypoint( newPos );
m_npcPath.setPathType( PONG_PATH );
break;
}
default: default:
break; break;
@ -780,6 +803,13 @@ void CNpc::processMovementModifier(int _frames, s32 distX, s32 distY, s32 dist,
break; break;
} }
case NPC_MOVEMENT_MODIFIER_FISH_FOLK:
{
processFishFolkMovementModifier( _frames, distX, distY );
break;
}
} }
} }

View File

@ -96,6 +96,7 @@ protected:
NPC_INIT_PENDULUM, NPC_INIT_PENDULUM,
NPC_INIT_FIREBALL, NPC_INIT_FIREBALL,
NPC_INIT_RETURNING_HAZARD, NPC_INIT_RETURNING_HAZARD,
NPC_INIT_FISH_FOLK,
}; };
enum NPC_CONTROL_FUNC enum NPC_CONTROL_FUNC
@ -166,6 +167,7 @@ protected:
NPC_MOVEMENT_MODIFIER_NONE = 0, NPC_MOVEMENT_MODIFIER_NONE = 0,
NPC_MOVEMENT_MODIFIER_BOB = 1, NPC_MOVEMENT_MODIFIER_BOB = 1,
NPC_MOVEMENT_MODIFIER_JELLYFISH, NPC_MOVEMENT_MODIFIER_JELLYFISH,
NPC_MOVEMENT_MODIFIER_FISH_FOLK,
}; };
enum NPC_TIMER_FUNC enum NPC_TIMER_FUNC
@ -249,6 +251,10 @@ protected:
void processSmallJellyfishMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange ); void processSmallJellyfishMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange );
void processCloseSmallJellyfishEvade( int _frames ); void processCloseSmallJellyfishEvade( int _frames );
// fish folk functions
void processFishFolkMovementModifier( int _frames, s32 distX, s32 distY );
// clam functions // clam functions
void processCloseClamAttack( int _frames ); void processCloseClamAttack( int _frames );

View File

@ -186,15 +186,15 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
}, },
{ // NPC_FISH_FOLK { // NPC_FISH_FOLK
NPC_INIT_DEFAULT, NPC_INIT_FISH_FOLK,
NPC_SENSOR_NONE, NPC_SENSOR_NONE,
NPC_MOVEMENT_FIXED_PATH, NPC_MOVEMENT_FIXED_PATH,
NPC_MOVEMENT_MODIFIER_NONE, NPC_MOVEMENT_MODIFIER_FISH_FOLK,
NPC_CLOSE_NONE, NPC_CLOSE_NONE,
NPC_TIMER_NONE, NPC_TIMER_NONE,
false, false,
2, 2,
128, 2048,
}, },
{ // NPC_PRICKLY_BUG { // NPC_PRICKLY_BUG

View File

@ -40,6 +40,7 @@ void CNpcPath::initPath()
waypoint = NULL; waypoint = NULL;
pathType = SINGLE_USE_PATH; pathType = SINGLE_USE_PATH;
currentWaypoint = NULL; currentWaypoint = NULL;
lastWaypoint = NULL;
waypointCount = 0; waypointCount = 0;
reversePath = false; reversePath = false;
} }
@ -47,6 +48,7 @@ void CNpcPath::initPath()
void CNpcPath::resetPath() void CNpcPath::resetPath()
{ {
currentWaypoint = waypoint; currentWaypoint = waypoint;
lastWaypoint = NULL;
} }
void CNpcPath::addWaypoint( DVECTOR newPos ) void CNpcPath::addWaypoint( DVECTOR newPos )
@ -118,6 +120,7 @@ bool CNpcPath::incPath()
{ {
if ( currentWaypoint->nextWaypoint ) if ( currentWaypoint->nextWaypoint )
{ {
lastWaypoint = currentWaypoint;
currentWaypoint = currentWaypoint->nextWaypoint; currentWaypoint = currentWaypoint->nextWaypoint;
} }
else else
@ -132,6 +135,7 @@ bool CNpcPath::incPath()
case REPEATING_PATH: case REPEATING_PATH:
// go back to start // go back to start
lastWaypoint = currentWaypoint;
currentWaypoint = this->waypoint; currentWaypoint = this->waypoint;
break; break;
@ -143,6 +147,7 @@ bool CNpcPath::incPath()
if ( currentWaypoint->prevWaypoint ) if ( currentWaypoint->prevWaypoint )
{ {
lastWaypoint = currentWaypoint;
currentWaypoint = currentWaypoint->prevWaypoint; currentWaypoint = currentWaypoint->prevWaypoint;
} }
@ -156,6 +161,7 @@ bool CNpcPath::incPath()
if ( currentWaypoint->prevWaypoint ) if ( currentWaypoint->prevWaypoint )
{ {
lastWaypoint = currentWaypoint;
currentWaypoint = currentWaypoint->prevWaypoint; currentWaypoint = currentWaypoint->prevWaypoint;
} }
else else
@ -164,6 +170,7 @@ bool CNpcPath::incPath()
if ( currentWaypoint->nextWaypoint ) if ( currentWaypoint->nextWaypoint )
{ {
lastWaypoint = currentWaypoint;
currentWaypoint = currentWaypoint->nextWaypoint; currentWaypoint = currentWaypoint->nextWaypoint;
} }
} }
@ -172,6 +179,23 @@ bool CNpcPath::incPath()
return( false ); return( false );
} }
void CNpcPath::reversePathDir()
{
if ( lastWaypoint )
{
CNpcWaypoint *tempWaypoint;
tempWaypoint = currentWaypoint;
currentWaypoint = lastWaypoint;
lastWaypoint = tempWaypoint;
if ( pathType == PONG_PATH )
{
reversePath = !reversePath;
}
}
}
bool CNpcPath::getDistToNextWaypoint( DVECTOR currentPos, s32 *distX, s32 *distY ) bool CNpcPath::getDistToNextWaypoint( DVECTOR currentPos, s32 *distX, s32 *distY )
{ {
return( currentWaypoint->isPointNear( currentPos, distX, distY ) ); return( currentWaypoint->isPointNear( currentPos, distX, distY ) );

View File

@ -40,16 +40,17 @@ private:
NPC_PATH_TYPE pathType; NPC_PATH_TYPE pathType;
u8 waypointCount; u8 waypointCount;
bool reversePath; bool reversePath;
CNpcWaypoint *currentWaypoint;
CNpcWaypoint *lastWaypoint;
public: public:
CNpcWaypoint *currentWaypoint;
void initPath(); void initPath();
void addWaypoint( DVECTOR newPos ); void addWaypoint( DVECTOR newPos );
void removeAllWaypoints(); void removeAllWaypoints();
void setPathType( NPC_PATH_TYPE newPathType ); void setPathType( NPC_PATH_TYPE newPathType );
bool incPath(); bool incPath();
void resetPath(); void resetPath();
void reversePathDir();
s32 think( DVECTOR currentPos, bool *pathComplete, bool *waypointChange ); s32 think( DVECTOR currentPos, bool *pathComplete, bool *waypointChange );
bool getDistToNextWaypoint( DVECTOR currentPos, s32 *distX, s32 *distY ); bool getDistToNextWaypoint( DVECTOR currentPos, s32 *distX, s32 *distY );
}; };

View File

@ -149,6 +149,10 @@ SOURCE=..\..\..\source\enemy\nfdutch.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\source\enemy\nffolk.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\enemy\ngeneric.cpp SOURCE=..\..\..\source\enemy\ngeneric.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File