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