This commit is contained in:
parent
3eabd82c8e
commit
8470b76ba1
7 changed files with 85 additions and 22 deletions
|
@ -62,6 +62,7 @@ enemy_src := 2denemy \
|
|||
ngeneric \
|
||||
nanemone \
|
||||
neyeball \
|
||||
nsstomp \
|
||||
enemy
|
||||
|
||||
projectl_src := projectl
|
||||
|
|
|
@ -48,18 +48,6 @@
|
|||
|
||||
CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
||||
{
|
||||
{ // NPC_TEST_TYPE
|
||||
NPC_INIT_DEFAULT,
|
||||
NPC_SENSOR_JELLYFISH_USER_CLOSE,
|
||||
NPC_MOVEMENT_FIXED_PATH,
|
||||
NPC_MOVEMENT_MODIFIER_JELLYFISH,
|
||||
NPC_CLOSE_JELLYFISH_EVADE,
|
||||
NPC_TIMER_NONE,
|
||||
false,
|
||||
3,
|
||||
128,
|
||||
},
|
||||
|
||||
{ // NPC_SANDY_CHEEKS
|
||||
NPC_INIT_DEFAULT,
|
||||
NPC_SENSOR_NONE,
|
||||
|
@ -382,12 +370,24 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] =
|
|||
3,
|
||||
64,
|
||||
},
|
||||
|
||||
{ // NPC_SKULL_STOMPER
|
||||
NPC_INIT_SKULL_STOMPER,
|
||||
NPC_SENSOR_SKULL_STOMPER_USER_CLOSE,
|
||||
NPC_MOVEMENT_STATIC,
|
||||
NPC_MOVEMENT_MODIFIER_NONE,
|
||||
NPC_CLOSE_SKULL_STOMPER_ATTACK,
|
||||
NPC_TIMER_NONE,
|
||||
false,
|
||||
3,
|
||||
2048,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
void CNpc::init()
|
||||
{
|
||||
m_type = NPC_EYEBALL;
|
||||
m_type = NPC_SKULL_STOMPER;
|
||||
|
||||
m_heading = m_fireHeading = 0;
|
||||
m_movementTimer = 0;
|
||||
|
@ -406,6 +406,7 @@ void CNpc::init()
|
|||
switch ( m_data[this->m_type].initFunc )
|
||||
{
|
||||
case NPC_INIT_DEFAULT:
|
||||
{
|
||||
m_npcPath.initPath();
|
||||
|
||||
DVECTOR newPos;
|
||||
|
@ -433,10 +434,36 @@ void CNpc::init()
|
|||
m_npcPath.setPathType( REPEATING_PATH );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case NPC_INIT_GHOST_PIRATE:
|
||||
m_heading = m_fireHeading = 3072;
|
||||
|
||||
break;
|
||||
|
||||
case NPC_INIT_SKULL_STOMPER:
|
||||
{
|
||||
m_heading = m_fireHeading = 1024;
|
||||
|
||||
m_npcPath.initPath();
|
||||
|
||||
DVECTOR newPos;
|
||||
|
||||
newPos.vx = 100;
|
||||
newPos.vy = 100;
|
||||
|
||||
m_npcPath.addWaypoint( newPos );
|
||||
|
||||
newPos.vx = 100;
|
||||
newPos.vy = 10;
|
||||
|
||||
m_npcPath.addWaypoint( newPos );
|
||||
|
||||
m_npcPath.setPathType( SINGLE_USE_PATH );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
|
@ -732,6 +759,21 @@ bool CNpc::processSensor()
|
|||
}
|
||||
}
|
||||
|
||||
case NPC_SENSOR_SKULL_STOMPER_USER_CLOSE:
|
||||
{
|
||||
if ( xDistSqr + yDistSqr < 40000 )
|
||||
{
|
||||
m_controlFunc = NPC_CONTROL_CLOSE;
|
||||
m_npcPath.currentWaypoint = 0;
|
||||
|
||||
return( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
return( false );
|
||||
}
|
||||
|
@ -764,8 +806,9 @@ void CNpc::processMovement(int _frames)
|
|||
case NPC_MOVEMENT_FIXED_PATH:
|
||||
{
|
||||
bool pathComplete;
|
||||
bool waypointChange;
|
||||
|
||||
s16 headingToTarget = m_npcPath.think( Pos, &pathComplete );
|
||||
s16 headingToTarget = m_npcPath.think( Pos, &pathComplete, &waypointChange );
|
||||
|
||||
if ( !pathComplete )
|
||||
{
|
||||
|
@ -932,6 +975,9 @@ void CNpc::processClose(int _frames)
|
|||
|
||||
break;
|
||||
|
||||
case NPC_CLOSE_SKULL_STOMPER_ATTACK:
|
||||
processCloseSkullStomperAttack( _frames );
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -29,9 +29,8 @@ class CNpc : public CThing
|
|||
public:
|
||||
enum NPC_UNIT_TYPE
|
||||
{
|
||||
NPC_TEST_TYPE = 0,
|
||||
NPC_SANDY_CHEEKS = 1,
|
||||
NPC_SMALL_JELLYFISH_1,
|
||||
NPC_SANDY_CHEEKS = 0,
|
||||
NPC_SMALL_JELLYFISH_1 = 1,
|
||||
NPC_SMALL_JELLYFISH_2,
|
||||
NPC_LARGE_JELLYFISH,
|
||||
NPC_ANEMONE_1,
|
||||
|
@ -57,6 +56,7 @@ public:
|
|||
NPC_FLAMING_SKULL,
|
||||
NPC_SHARK_MAN,
|
||||
NPC_OIL_BLOB,
|
||||
NPC_SKULL_STOMPER,
|
||||
NPC_UNIT_TYPE_MAX,
|
||||
};
|
||||
|
||||
|
@ -76,6 +76,7 @@ protected:
|
|||
NPC_INIT_SNAKE = 1,
|
||||
NPC_INIT_ACID,
|
||||
NPC_INIT_GHOST_PIRATE,
|
||||
NPC_INIT_SKULL_STOMPER,
|
||||
};
|
||||
|
||||
enum NPC_CONTROL_FUNC
|
||||
|
@ -98,6 +99,7 @@ protected:
|
|||
NPC_SENSOR_OIL_BLOB_USER_CLOSE,
|
||||
NPC_SENSOR_ANEMONE_USER_CLOSE,
|
||||
NPC_SENSOR_EYEBALL_USER_CLOSE,
|
||||
NPC_SENSOR_SKULL_STOMPER_USER_CLOSE,
|
||||
};
|
||||
|
||||
enum NPC_CLOSE_FUNC
|
||||
|
@ -112,6 +114,7 @@ protected:
|
|||
NPC_CLOSE_ANEMONE_1_ATTACK,
|
||||
NPC_CLOSE_ANEMONE_2_ATTACK,
|
||||
NPC_CLOSE_EYEBALL_ATTACK,
|
||||
NPC_CLOSE_SKULL_STOMPER_ATTACK,
|
||||
};
|
||||
|
||||
enum NPC_MOVEMENT_FUNC
|
||||
|
@ -203,6 +206,10 @@ protected:
|
|||
|
||||
void processCloseEyeballAttack( int _frames );
|
||||
|
||||
// skull stomper functions
|
||||
|
||||
void processCloseSkullStomperAttack( int _frames );
|
||||
|
||||
// data
|
||||
|
||||
static NPC_DATA m_data[NPC_UNIT_TYPE_MAX];
|
||||
|
|
|
@ -46,7 +46,7 @@ void CNpcPath::initPath()
|
|||
}
|
||||
|
||||
pathType = SINGLE_USE_PATH;
|
||||
currentWaypoint = 0;
|
||||
currentWaypoint = lastWaypoint = 0;
|
||||
waypointCount = 0;
|
||||
reversePath = false;
|
||||
}
|
||||
|
@ -122,15 +122,17 @@ bool CNpcPath::getDistToNextWaypoint( DVECTOR currentPos, s32 *distX, s32 *distY
|
|||
return( waypoint[currentWaypoint].isPointNear( currentPos, distX, distY ) );
|
||||
}
|
||||
|
||||
s32 CNpcPath::think( DVECTOR currentPos, bool *pathComplete )
|
||||
s32 CNpcPath::think( DVECTOR currentPos, bool *pathComplete, bool *waypointChange )
|
||||
{
|
||||
s32 xDist, yDist;
|
||||
|
||||
*pathComplete = false;
|
||||
*waypointChange = false;
|
||||
|
||||
if ( waypoint[currentWaypoint].isPointNear( currentPos, &xDist, &yDist ) )
|
||||
{
|
||||
*pathComplete = incPath();
|
||||
*waypointChange = true;
|
||||
}
|
||||
|
||||
s32 headingToTarget = ratan2( yDist, xDist );
|
||||
|
|
|
@ -41,16 +41,18 @@ class CNpcPath
|
|||
private:
|
||||
CNpcWaypoint waypoint[NPC_MAX_WAYPOINTS];
|
||||
NPC_PATH_TYPE pathType;
|
||||
u8 currentWaypoint;
|
||||
u8 waypointCount;
|
||||
u8 lastWaypoint;
|
||||
bool reversePath;
|
||||
|
||||
public:
|
||||
u8 currentWaypoint;
|
||||
|
||||
void initPath();
|
||||
void addWaypoint( DVECTOR newPos );
|
||||
void setPathType( NPC_PATH_TYPE newPathType );
|
||||
bool incPath();
|
||||
s32 think( DVECTOR currentPos, bool *pathComplete );
|
||||
s32 think( DVECTOR currentPos, bool *pathComplete, bool *waypointChange );
|
||||
bool getDistToNextWaypoint( DVECTOR currentPos, s32 *distX, s32 *distY );
|
||||
};
|
||||
|
||||
|
|
|
@ -128,8 +128,9 @@ void CNpc::processCloseSmallJellyfishEvade( int _frames )
|
|||
else
|
||||
{
|
||||
bool pathComplete;
|
||||
bool waypointChange;
|
||||
|
||||
s16 headingToTarget = m_npcPath.think( Pos, &pathComplete );
|
||||
s16 headingToTarget = m_npcPath.think( Pos, &pathComplete, &waypointChange );
|
||||
|
||||
if ( pathComplete )
|
||||
{
|
||||
|
|
|
@ -175,6 +175,10 @@ SOURCE=..\..\..\source\enemy\nshrkman.cpp
|
|||
|
||||
SOURCE=..\..\..\source\enemy\nsjfish.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\enemy\nsstomp.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "fileio"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue