This commit is contained in:
Charles 2001-03-30 22:43:35 +00:00
parent 5bcc1f3ef9
commit 28e212b5c2
8 changed files with 78 additions and 7 deletions

View file

@ -128,11 +128,16 @@ void CThingManager::thinkAllThings(int _frames)
// Player -> Platform collision
thing1=s_thingLists[CThing::TYPE_PLATFORM];
thing2=s_thingLists[CThing::TYPE_PLAYER];
thing2->setHasPlatformCollided( false );
thing2->setNewCollidedPos( thing2->getPos() );
while(thing1&&thing2)
{
//if ( !thing1->hasChild( thing2 ) )
{
thing1->removeAllChild();
if(thing1->canCollide()&&
thing1->checkCollisionAgainst(thing2))
{
@ -776,11 +781,36 @@ int CThing::checkCollisionAgainst(CThing *_thisThing)
if ( ( newPos.vx >= thisRect.x1 && newPos.vx <= thisRect.x2 ) &&
( newPos.vy >= thisRect.y1 && newPos.vy <= thisRect.y2 ) )
{
_thisThing->setCentreCollision( true );
thatPos.vy = getNewYPos( _thisThing );
_thisThing->setNewCollidedPos( thatPos );
if ( thatPos.vy - _thisThing->getPos().vy >= -10 )
{
_thisThing->setHasPlatformCollided( true );
_thisThing->setCentreCollision( true );
if ( _thisThing->getHasPlatformCollided() )
{
// if this has already collided with a platform, check the current platform is
// (a) within 10 units,
// (b) higher
DVECTOR oldCollidedPos = _thisThing->getNewCollidedPos();
if ( thatPos.vy < oldCollidedPos.vy )
{
_thisThing->setNewCollidedPos( thatPos );
}
}
else
{
_thisThing->setNewCollidedPos( thatPos );
}
}
else
{
_thisThing->setCentreCollision( false );
}
}
else
{