This commit is contained in:
parent
b209ab73c8
commit
53f0008276
4 changed files with 71 additions and 4 deletions
|
@ -94,6 +94,7 @@ void CNpcCartPlatform::processMovement( int _frames )
|
|||
// have touched down
|
||||
|
||||
m_inJump = false;
|
||||
moveY += groundHeight;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -238,3 +239,67 @@ void CNpcCartPlatform::jump()
|
|||
m_vertSpeed = -6 << 8;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcCartPlatform::collidedWith( CThing *_thisThing )
|
||||
{
|
||||
switch(_thisThing->getThingType())
|
||||
{
|
||||
case TYPE_PLAYER:
|
||||
{
|
||||
CPlayer *player;
|
||||
DVECTOR playerPos;
|
||||
CRECT collisionArea;
|
||||
|
||||
// Only interested in SBs feet colliding with the box (pkg)
|
||||
player=(CPlayer*)_thisThing;
|
||||
playerPos=player->getPos();
|
||||
collisionArea=getCollisionArea();
|
||||
|
||||
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
||||
|
||||
if ( threshold > 16 )
|
||||
{
|
||||
threshold = 16;
|
||||
}
|
||||
|
||||
if( playerPos.vx >= collisionArea.x1 && playerPos.vx <= collisionArea.x2 )
|
||||
{
|
||||
if ( checkCollisionDelta( _thisThing, threshold, collisionArea ) )
|
||||
{
|
||||
player->setPlatform( this );
|
||||
|
||||
m_contact = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( playerPos.vy >= collisionArea.y1 && playerPos.vy <= collisionArea.y2 )
|
||||
{
|
||||
if ( m_isActivated || player->getPosDelta().vy >= 0 )
|
||||
{
|
||||
int height = getHeightFromPlatformAtPosition( playerPos.vx, playerPos.vy );
|
||||
|
||||
if ( height >= -threshold && height < 1 )
|
||||
{
|
||||
player->setPlatform( this );
|
||||
|
||||
m_contact = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case TYPE_NPC:
|
||||
case TYPE_HAZARD:
|
||||
break;
|
||||
|
||||
default:
|
||||
ASSERT(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ public:
|
|||
virtual void jump();
|
||||
protected:
|
||||
virtual void processMovement( int _frames );
|
||||
virtual void collidedWith(CThing *_thisThing);
|
||||
|
||||
s32 m_carSpeed;
|
||||
u8 m_isActivated;
|
||||
|
|
|
@ -18,10 +18,11 @@
|
|||
|
||||
void CNpcLoveBoatPlatform::postInit()
|
||||
{
|
||||
CNpcRaftPlatform::postInit();
|
||||
CNpcCartPlatform::postInit();
|
||||
|
||||
sBBox boundingBox = m_modelGfx->GetBBox();
|
||||
boundingBox.YMin += 32;
|
||||
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
|
||||
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
|
||||
calculateNonRotatedCollisionData();
|
||||
}
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
#ifndef __PLATFORM_PLURVE_H__
|
||||
#define __PLATFORM_PLURVE_H__
|
||||
|
||||
#ifndef __PLATFORM_PRAFT_H__
|
||||
#include "platform\praft.h"
|
||||
#ifndef __PLATFORM_PCART_H__
|
||||
#include "platform\pcart.h"
|
||||
#endif
|
||||
|
||||
class CNpcLoveBoatPlatform : public CNpcRaftPlatform
|
||||
class CNpcLoveBoatPlatform : public CNpcCartPlatform
|
||||
{
|
||||
public:
|
||||
virtual void postInit();
|
||||
|
|
Loading…
Add table
Reference in a new issue