This commit is contained in:
parent
2a71836478
commit
b9ccd83f66
7 changed files with 72 additions and 6 deletions
|
@ -70,6 +70,7 @@ enemy_src := 2denemy \
|
|||
nsshark \
|
||||
ndogfish \
|
||||
nhazard \
|
||||
nffolk \
|
||||
enemy
|
||||
|
||||
projectl_src := projectl
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
void CNpc::init()
|
||||
{
|
||||
m_type = NPC_SAW_BLADE;
|
||||
m_type = NPC_FISH_FOLK;
|
||||
|
||||
m_heading = m_fireHeading = 0;
|
||||
m_movementTimer = 0;
|
||||
|
@ -243,6 +243,29 @@ void CNpc::init()
|
|||
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:
|
||||
|
||||
break;
|
||||
|
@ -780,6 +803,13 @@ void CNpc::processMovementModifier(int _frames, s32 distX, s32 distY, s32 dist,
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
case NPC_MOVEMENT_MODIFIER_FISH_FOLK:
|
||||
{
|
||||
processFishFolkMovementModifier( _frames, distX, distY );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ protected:
|
|||
NPC_INIT_PENDULUM,
|
||||
NPC_INIT_FIREBALL,
|
||||
NPC_INIT_RETURNING_HAZARD,
|
||||
NPC_INIT_FISH_FOLK,
|
||||
};
|
||||
|
||||
enum NPC_CONTROL_FUNC
|
||||
|
@ -166,6 +167,7 @@ protected:
|
|||
NPC_MOVEMENT_MODIFIER_NONE = 0,
|
||||
NPC_MOVEMENT_MODIFIER_BOB = 1,
|
||||
NPC_MOVEMENT_MODIFIER_JELLYFISH,
|
||||
NPC_MOVEMENT_MODIFIER_FISH_FOLK,
|
||||
};
|
||||
|
||||
enum NPC_TIMER_FUNC
|
||||
|
@ -249,6 +251,10 @@ protected:
|
|||
void processSmallJellyfishMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange );
|
||||
void processCloseSmallJellyfishEvade( int _frames );
|
||||
|
||||
// fish folk functions
|
||||
|
||||
void processFishFolkMovementModifier( int _frames, s32 distX, s32 distY );
|
||||
|
||||
// clam functions
|
||||
|
||||
void processCloseClamAttack( int _frames );
|
||||
|
|
|
@ -186,15 +186,15 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
|||
},
|
||||
|
||||
{ // NPC_FISH_FOLK
|
||||
NPC_INIT_DEFAULT,
|
||||
NPC_INIT_FISH_FOLK,
|
||||
NPC_SENSOR_NONE,
|
||||
NPC_MOVEMENT_FIXED_PATH,
|
||||
NPC_MOVEMENT_MODIFIER_NONE,
|
||||
NPC_MOVEMENT_MODIFIER_FISH_FOLK,
|
||||
NPC_CLOSE_NONE,
|
||||
NPC_TIMER_NONE,
|
||||
false,
|
||||
2,
|
||||
128,
|
||||
2048,
|
||||
},
|
||||
|
||||
{ // NPC_PRICKLY_BUG
|
||||
|
|
|
@ -40,6 +40,7 @@ void CNpcPath::initPath()
|
|||
waypoint = NULL;
|
||||
pathType = SINGLE_USE_PATH;
|
||||
currentWaypoint = NULL;
|
||||
lastWaypoint = NULL;
|
||||
waypointCount = 0;
|
||||
reversePath = false;
|
||||
}
|
||||
|
@ -47,6 +48,7 @@ void CNpcPath::initPath()
|
|||
void CNpcPath::resetPath()
|
||||
{
|
||||
currentWaypoint = waypoint;
|
||||
lastWaypoint = NULL;
|
||||
}
|
||||
|
||||
void CNpcPath::addWaypoint( DVECTOR newPos )
|
||||
|
@ -118,6 +120,7 @@ bool CNpcPath::incPath()
|
|||
{
|
||||
if ( currentWaypoint->nextWaypoint )
|
||||
{
|
||||
lastWaypoint = currentWaypoint;
|
||||
currentWaypoint = currentWaypoint->nextWaypoint;
|
||||
}
|
||||
else
|
||||
|
@ -132,6 +135,7 @@ bool CNpcPath::incPath()
|
|||
case REPEATING_PATH:
|
||||
// go back to start
|
||||
|
||||
lastWaypoint = currentWaypoint;
|
||||
currentWaypoint = this->waypoint;
|
||||
|
||||
break;
|
||||
|
@ -143,6 +147,7 @@ bool CNpcPath::incPath()
|
|||
|
||||
if ( currentWaypoint->prevWaypoint )
|
||||
{
|
||||
lastWaypoint = currentWaypoint;
|
||||
currentWaypoint = currentWaypoint->prevWaypoint;
|
||||
}
|
||||
|
||||
|
@ -156,6 +161,7 @@ bool CNpcPath::incPath()
|
|||
|
||||
if ( currentWaypoint->prevWaypoint )
|
||||
{
|
||||
lastWaypoint = currentWaypoint;
|
||||
currentWaypoint = currentWaypoint->prevWaypoint;
|
||||
}
|
||||
else
|
||||
|
@ -164,6 +170,7 @@ bool CNpcPath::incPath()
|
|||
|
||||
if ( currentWaypoint->nextWaypoint )
|
||||
{
|
||||
lastWaypoint = currentWaypoint;
|
||||
currentWaypoint = currentWaypoint->nextWaypoint;
|
||||
}
|
||||
}
|
||||
|
@ -172,6 +179,23 @@ bool CNpcPath::incPath()
|
|||
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 )
|
||||
{
|
||||
return( currentWaypoint->isPointNear( currentPos, distX, distY ) );
|
||||
|
|
|
@ -40,16 +40,17 @@ private:
|
|||
NPC_PATH_TYPE pathType;
|
||||
u8 waypointCount;
|
||||
bool reversePath;
|
||||
CNpcWaypoint *currentWaypoint;
|
||||
CNpcWaypoint *lastWaypoint;
|
||||
|
||||
public:
|
||||
CNpcWaypoint *currentWaypoint;
|
||||
|
||||
void initPath();
|
||||
void addWaypoint( DVECTOR newPos );
|
||||
void removeAllWaypoints();
|
||||
void setPathType( NPC_PATH_TYPE newPathType );
|
||||
bool incPath();
|
||||
void resetPath();
|
||||
void reversePathDir();
|
||||
s32 think( DVECTOR currentPos, bool *pathComplete, bool *waypointChange );
|
||||
bool getDistToNextWaypoint( DVECTOR currentPos, s32 *distX, s32 *distY );
|
||||
};
|
||||
|
|
|
@ -149,6 +149,10 @@ SOURCE=..\..\..\source\enemy\nfdutch.cpp
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\enemy\nffolk.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\enemy\ngeneric.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
Loading…
Add table
Reference in a new issue