This commit is contained in:
Charles 2001-05-22 20:39:46 +00:00
parent 4e4300b439
commit aa3b575d38
3 changed files with 48 additions and 4 deletions

View file

@ -81,8 +81,34 @@ void CNpcGeyserPlatformGenerator::think( int _frames )
startPos.vx += ( -5 + ( getRnd() % 11 ) ); startPos.vx += ( -5 + ( getRnd() % 11 ) );
newPlatform->init( startPos ); newPlatform->init( startPos );
CNpcWaypoint *sourceWaypoint = m_npcPath.getWaypointList();
if ( sourceWaypoint )
{
while( sourceWaypoint )
{
newPlatform->addWaypoint( sourceWaypoint->pos.vx >> 4, sourceWaypoint->pos.vy >> 4 );
sourceWaypoint = sourceWaypoint->nextWaypoint;
}
}
newPlatform->setLayerCollision( m_layerCollision ); newPlatform->setLayerCollision( m_layerCollision );
newPlatform->setTiltable( false ); newPlatform->setTiltable( false );
newPlatform->postInit(); newPlatform->postInit();
} }
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const CRECT *CNpcGeyserPlatformGenerator::getThinkBBox()
{
CRECT objThinkBox = getCollisionArea();
sBBox &thinkBBox = CThingManager::getThinkBBox();
objThinkBox.x1 = thinkBBox.XMin;
objThinkBox.x2 = thinkBBox.XMax;
objThinkBox.y1 = thinkBBox.YMin;
objThinkBox.y2 = thinkBBox.YMax;
return &objThinkBox;
}

View file

@ -23,6 +23,7 @@ class CNpcGeyserPlatformGenerator : public CNpcPlatform
public: public:
void setTargetType( NPC_PLATFORM_UNIT_TYPE targetType ) {m_targetType = targetType;} void setTargetType( NPC_PLATFORM_UNIT_TYPE targetType ) {m_targetType = targetType;}
virtual void render(); virtual void render();
virtual CRECT const *getThinkBBox();
protected: protected:
virtual void think( int _frames ); virtual void think( int _frames );
virtual void collidedWith(CThing *_thisThing); virtual void collidedWith(CThing *_thisThing);

View file

@ -19,11 +19,28 @@
void CNpcBubblePlatform::processMovement( int _frames ) void CNpcBubblePlatform::processMovement( int _frames )
{ {
Pos.vy -= m_speed * _frames; if ( !isSetToShutdown() )
if ( Pos.vy < 0 )
{ {
setToShutdown(); Pos.vy -= m_speed * _frames;
if ( m_npcPath.getWaypointCount() > 1 )
{
s32 minY, maxY;
m_npcPath.getPathYExtents( &minY, &maxY );
if ( Pos.vy < minY )
{
setToShutdown();
}
}
else
{
if ( Pos.vy < 0 )
{
setToShutdown();
}
}
} }
} }