This commit is contained in:
parent
eefc209b58
commit
5901bd4aba
4 changed files with 139 additions and 3 deletions
|
@ -156,6 +156,8 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] =
|
||||||
DAMAGE__NONE,
|
DAMAGE__NONE,
|
||||||
0,
|
0,
|
||||||
NPC_PLATFORM_INFINITE_LIFE,
|
NPC_PLATFORM_INFINITE_LIFE,
|
||||||
|
0,
|
||||||
|
NPC_PLATFORM_TIMER_NONE,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ // NPC_CIRCULAR_PLATFORM
|
{ // NPC_CIRCULAR_PLATFORM
|
||||||
|
@ -168,6 +170,8 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] =
|
||||||
DAMAGE__NONE,
|
DAMAGE__NONE,
|
||||||
0,
|
0,
|
||||||
NPC_PLATFORM_INFINITE_LIFE,
|
NPC_PLATFORM_INFINITE_LIFE,
|
||||||
|
0,
|
||||||
|
NPC_PLATFORM_TIMER_NONE,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ // NPC_BUBBLE_PLATFORM
|
{ // NPC_BUBBLE_PLATFORM
|
||||||
|
@ -179,7 +183,79 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] =
|
||||||
true,
|
true,
|
||||||
DAMAGE__NONE,
|
DAMAGE__NONE,
|
||||||
0,
|
0,
|
||||||
|
NPC_PLATFORM_FINITE_LIFE_RESPAWN,
|
||||||
|
0,
|
||||||
|
NPC_PLATFORM_TIMER_NONE,
|
||||||
|
},
|
||||||
|
|
||||||
|
{ // NPC_COLLAPSING_BUBBLE_PLATFORM
|
||||||
|
ACTORS_CLAM_SBK,
|
||||||
|
ANIM_CLAM_SIDESNAP,
|
||||||
|
NPC_PLATFORM_MOVEMENT_STATIC,
|
||||||
|
3,
|
||||||
|
128,
|
||||||
|
true,
|
||||||
|
DAMAGE__NONE,
|
||||||
|
0,
|
||||||
|
NPC_PLATFORM_INFINITE_LIFE_COLLAPSIBLE,
|
||||||
|
0,
|
||||||
|
NPC_PLATFORM_TIMER_NONE,
|
||||||
|
},
|
||||||
|
|
||||||
|
{ // NPC_FISH_HOOK_PLATFORM
|
||||||
|
ACTORS_CLAM_SBK,
|
||||||
|
ANIM_CLAM_SIDESNAP,
|
||||||
|
NPC_PLATFORM_MOVEMENT_STATIC,
|
||||||
|
3,
|
||||||
|
128,
|
||||||
|
true,
|
||||||
|
DAMAGE__NONE,
|
||||||
|
0,
|
||||||
|
NPC_PLATFORM_INFINITE_LIFE_FISH_HOOK,
|
||||||
|
0,
|
||||||
|
NPC_PLATFORM_TIMER_NONE,
|
||||||
|
},
|
||||||
|
|
||||||
|
{ // NPC_RETRACTING_PLATFORM
|
||||||
|
ACTORS_CLAM_SBK,
|
||||||
|
ANIM_CLAM_SIDESNAP,
|
||||||
|
NPC_PLATFORM_MOVEMENT_STATIC,
|
||||||
|
3,
|
||||||
|
128,
|
||||||
|
true,
|
||||||
|
DAMAGE__NONE,
|
||||||
|
0,
|
||||||
|
NPC_PLATFORM_INFINITE_LIFE,
|
||||||
|
0,
|
||||||
|
NPC_PLATFORM_TIMER_RETRACT,
|
||||||
|
},
|
||||||
|
|
||||||
|
{ // NPC_GEYSER_PLATFORM
|
||||||
|
ACTORS_CLAM_SBK,
|
||||||
|
ANIM_CLAM_SIDESNAP,
|
||||||
|
NPC_PLATFORM_MOVEMENT_STATIC,
|
||||||
|
8,
|
||||||
|
128,
|
||||||
|
true,
|
||||||
|
DAMAGE__NONE,
|
||||||
|
0,
|
||||||
|
NPC_PLATFORM_INFINITE_LIFE,
|
||||||
|
4,
|
||||||
|
NPC_PLATFORM_TIMER_GEYSER,
|
||||||
|
},
|
||||||
|
|
||||||
|
{ // NPC_PLAYER_BUBBLE_PLATFORM
|
||||||
|
ACTORS_CLAM_SBK,
|
||||||
|
ANIM_CLAM_SIDESNAP,
|
||||||
|
NPC_PLATFORM_MOVEMENT_PLAYER_BUBBLE,
|
||||||
|
3,
|
||||||
|
128,
|
||||||
|
true,
|
||||||
|
DAMAGE__NONE,
|
||||||
|
0,
|
||||||
NPC_PLATFORM_FINITE_LIFE,
|
NPC_PLATFORM_FINITE_LIFE,
|
||||||
|
0,
|
||||||
|
NPC_PLATFORM_TIMER_NONE,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ void CNpcPath::initPath()
|
||||||
lastWaypoint = NULL;
|
lastWaypoint = NULL;
|
||||||
waypointCount = 0;
|
waypointCount = 0;
|
||||||
reversePath = false;
|
reversePath = false;
|
||||||
minX = maxX = 0;
|
minX = maxX = minY = maxY = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CNpcPath::resetPath()
|
void CNpcPath::resetPath()
|
||||||
|
@ -84,6 +84,15 @@ void CNpcPath::addWaypoint( DVECTOR newPos )
|
||||||
{
|
{
|
||||||
maxX = newPos.vx;
|
maxX = newPos.vx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( newPos.vy < minY )
|
||||||
|
{
|
||||||
|
minY = newPos.vy;
|
||||||
|
}
|
||||||
|
else if ( newPos.vy > maxY )
|
||||||
|
{
|
||||||
|
maxY = newPos.vy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -99,7 +108,7 @@ void CNpcPath::addWaypoint( DVECTOR newPos )
|
||||||
|
|
||||||
currentWaypoint = this->waypoint;
|
currentWaypoint = this->waypoint;
|
||||||
|
|
||||||
minX = maxX = newPos.vx;
|
minX = maxX = minY = maxY = newPos.vx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +118,12 @@ void CNpcPath::getPathXExtents( s32 *minExtent, s32 *maxExtent )
|
||||||
*maxExtent = maxX;
|
*maxExtent = maxX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CNpcPath::getPathYExtents( s32 *minExtent, s32 *maxExtent )
|
||||||
|
{
|
||||||
|
*minExtent = minY;
|
||||||
|
*maxExtent = maxY;
|
||||||
|
}
|
||||||
|
|
||||||
void CNpcPath::removeAllWaypoints()
|
void CNpcPath::removeAllWaypoints()
|
||||||
{
|
{
|
||||||
CNpcWaypoint *testWaypoint;
|
CNpcWaypoint *testWaypoint;
|
||||||
|
@ -289,5 +304,47 @@ bool CNpcPath::thinkFlat( DVECTOR currentPos, s32 *distX, s32 *distY, s32 *headi
|
||||||
*heading = 2048;
|
*heading = 2048;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return( pointChange );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CNpcPath::thinkVertical( DVECTOR currentPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading )
|
||||||
|
{
|
||||||
|
bool pointChange = false;
|
||||||
|
|
||||||
|
if ( !this->waypoint )
|
||||||
|
{
|
||||||
|
return( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !currentWaypoint )
|
||||||
|
{
|
||||||
|
// if no currentWaypoint set, start it off
|
||||||
|
|
||||||
|
currentWaypoint = this->waypoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
*distX = currentWaypoint->pos.vx - currentPos.vx;
|
||||||
|
*distY = currentWaypoint->pos.vy - currentPos.vy;
|
||||||
|
|
||||||
|
*pathComplete = false;
|
||||||
|
|
||||||
|
if ( abs( *distY ) < 10 )
|
||||||
|
{
|
||||||
|
pointChange = true;
|
||||||
|
*pathComplete = incPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
*distX = currentWaypoint->pos.vx - currentPos.vx;
|
||||||
|
*distY = currentWaypoint->pos.vy - currentPos.vy;
|
||||||
|
|
||||||
|
if ( *distY > 0 )
|
||||||
|
{
|
||||||
|
*heading = 1024;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*heading = 3072;
|
||||||
|
}
|
||||||
|
|
||||||
return( pointChange );
|
return( pointChange );
|
||||||
}
|
}
|
|
@ -45,8 +45,10 @@ public:
|
||||||
void reversePathDir();
|
void reversePathDir();
|
||||||
s32 think( DVECTOR currentPos, bool *pathComplete, bool *waypointChange );
|
s32 think( DVECTOR currentPos, bool *pathComplete, bool *waypointChange );
|
||||||
bool thinkFlat( DVECTOR currentPos, s32 *distX, s32 *distY, s32 *heading );
|
bool thinkFlat( DVECTOR currentPos, s32 *distX, s32 *distY, s32 *heading );
|
||||||
|
bool thinkVertical( DVECTOR currentPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading );
|
||||||
bool getDistToNextWaypoint( DVECTOR currentPos, s32 *distX, s32 *distY );
|
bool getDistToNextWaypoint( DVECTOR currentPos, s32 *distX, s32 *distY );
|
||||||
void getPathXExtents( s32 *minExtent, s32 *maxExtent );
|
void getPathXExtents( s32 *minExtent, s32 *maxExtent );
|
||||||
|
void getPathYExtents( s32 *minExtent, s32 *maxExtent );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CNpcWaypoint *waypoint;
|
CNpcWaypoint *waypoint;
|
||||||
|
@ -56,6 +58,7 @@ private:
|
||||||
CNpcWaypoint *currentWaypoint;
|
CNpcWaypoint *currentWaypoint;
|
||||||
CNpcWaypoint *lastWaypoint;
|
CNpcWaypoint *lastWaypoint;
|
||||||
s32 minX, maxX;
|
s32 minX, maxX;
|
||||||
|
s32 minY, maxY;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -105,7 +105,7 @@ void CPlayerModeBubbleMixture::think()
|
||||||
CNpcPlatform *bubble;
|
CNpcPlatform *bubble;
|
||||||
DVECTOR pos;
|
DVECTOR pos;
|
||||||
bubble=new ("bubble platform") CNpcPlatform;
|
bubble=new ("bubble platform") CNpcPlatform;
|
||||||
bubble->setType( CNpcPlatform::NPC_BUBBLE_PLATFORM );
|
bubble->setType( CNpcPlatform::NPC_PLAYER_BUBBLE_PLATFORM );
|
||||||
pos=m_player->getPos();
|
pos=m_player->getPos();
|
||||||
pos.vx+=buboff.vx*m_player->getFacing();
|
pos.vx+=buboff.vx*m_player->getFacing();
|
||||||
pos.vy+=buboff.vy;
|
pos.vy+=buboff.vy;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue