This commit is contained in:
Charles 2001-04-07 15:39:22 +00:00
parent eefc209b58
commit 5901bd4aba
4 changed files with 139 additions and 3 deletions

View File

@ -156,6 +156,8 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] =
DAMAGE__NONE,
0,
NPC_PLATFORM_INFINITE_LIFE,
0,
NPC_PLATFORM_TIMER_NONE,
},
{ // NPC_CIRCULAR_PLATFORM
@ -168,6 +170,8 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] =
DAMAGE__NONE,
0,
NPC_PLATFORM_INFINITE_LIFE,
0,
NPC_PLATFORM_TIMER_NONE,
},
{ // NPC_BUBBLE_PLATFORM
@ -179,7 +183,79 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] =
true,
DAMAGE__NONE,
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,
0,
NPC_PLATFORM_TIMER_NONE,
},
};

View File

@ -43,7 +43,7 @@ void CNpcPath::initPath()
lastWaypoint = NULL;
waypointCount = 0;
reversePath = false;
minX = maxX = 0;
minX = maxX = minY = maxY = 0;
}
void CNpcPath::resetPath()
@ -84,6 +84,15 @@ void CNpcPath::addWaypoint( DVECTOR newPos )
{
maxX = newPos.vx;
}
if ( newPos.vy < minY )
{
minY = newPos.vy;
}
else if ( newPos.vy > maxY )
{
maxY = newPos.vy;
}
}
else
{
@ -99,7 +108,7 @@ void CNpcPath::addWaypoint( DVECTOR newPos )
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;
}
void CNpcPath::getPathYExtents( s32 *minExtent, s32 *maxExtent )
{
*minExtent = minY;
*maxExtent = maxY;
}
void CNpcPath::removeAllWaypoints()
{
CNpcWaypoint *testWaypoint;
@ -289,5 +304,47 @@ bool CNpcPath::thinkFlat( DVECTOR currentPos, s32 *distX, s32 *distY, s32 *headi
*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 );
}

View File

@ -45,8 +45,10 @@ public:
void reversePathDir();
s32 think( DVECTOR currentPos, bool *pathComplete, bool *waypointChange );
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 );
void getPathXExtents( s32 *minExtent, s32 *maxExtent );
void getPathYExtents( s32 *minExtent, s32 *maxExtent );
private:
CNpcWaypoint *waypoint;
@ -56,6 +58,7 @@ private:
CNpcWaypoint *currentWaypoint;
CNpcWaypoint *lastWaypoint;
s32 minX, maxX;
s32 minY, maxY;
};
#endif

View File

@ -105,7 +105,7 @@ void CPlayerModeBubbleMixture::think()
CNpcPlatform *bubble;
DVECTOR pos;
bubble=new ("bubble platform") CNpcPlatform;
bubble->setType( CNpcPlatform::NPC_BUBBLE_PLATFORM );
bubble->setType( CNpcPlatform::NPC_PLAYER_BUBBLE_PLATFORM );
pos=m_player->getPos();
pos.vx+=buboff.vx*m_player->getFacing();
pos.vy+=buboff.vy;