This commit is contained in:
parent
88f26878ed
commit
0a4f638870
@ -24,13 +24,14 @@
|
||||
|
||||
void CNpcBigWheelPlatform::postInit()
|
||||
{
|
||||
sBBox boundingBox = m_modelGfx->GetBBox();
|
||||
boundingBox.YMin = boundingBox.YMax - 32;
|
||||
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ) - 8, ( boundingBox.YMax - boundingBox.YMin ) );
|
||||
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
|
||||
CNpcPlatform::postInit();
|
||||
//sBBox boundingBox = m_modelGfx->GetBBox();
|
||||
//boundingBox.YMin = boundingBox.YMax - 32;
|
||||
//setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ) - 8, ( boundingBox.YMax - boundingBox.YMin ) );
|
||||
//setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
|
||||
|
||||
calculateNonRotatedCollisionData();
|
||||
setCollisionAngle( m_tiltAngle >> 8 );
|
||||
//calculateNonRotatedCollisionData();
|
||||
//setCollisionAngle( m_tiltAngle >> 8 );
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -104,3 +105,31 @@ const CRECT *CNpcBigWheelPlatform::getThinkBBox()
|
||||
|
||||
return &objThinkBox;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int CNpcBigWheelPlatform::getHeightFromPlatformAtPosition(int _x,int _y, int offsetX, int offsetY)
|
||||
{
|
||||
DVECTOR top;
|
||||
|
||||
CRECT collisionArea = getCollisionArea();
|
||||
|
||||
top.vy = offsetY + collisionArea.y1;
|
||||
|
||||
s32 centreX = ( ( collisionArea.x1 + collisionArea.x2 ) >> 1 ) + offsetX;
|
||||
|
||||
if ( abs( _x - centreX ) <= 20 )
|
||||
{
|
||||
top.vy = offsetY + collisionArea.y2 - 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
s32 baseY = offsetY + collisionArea.y2 - 16;
|
||||
|
||||
top.vy = baseY + ( ( ( abs( _x - centreX ) - 20 ) * ( offsetY + collisionArea.y1 - baseY ) ) / ( collisionArea.x2 - centreX - 20 ) );
|
||||
}
|
||||
|
||||
// Non-rotated platform
|
||||
|
||||
return( top.vy - _y );
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ class CNpcBigWheelPlatform : public CNpcPlatform
|
||||
public:
|
||||
virtual CRECT const *getThinkBBox();
|
||||
virtual void postInit();
|
||||
virtual int getHeightFromPlatformAtPosition(int _x,int _y, int offsetX = 0, int offsetY = 0);
|
||||
protected:
|
||||
virtual void setWaypoints( sThingPlatform *ThisPlatform );
|
||||
virtual void processMovement( int _frames );
|
||||
|
@ -713,22 +713,18 @@ if(newmode!=-1)
|
||||
platform=isOnPlatform();
|
||||
if(platform)
|
||||
{
|
||||
DVECTOR posDelta;
|
||||
posDelta=platform->getPosDelta();
|
||||
posDelta.vy = 0;
|
||||
shove(posDelta);
|
||||
|
||||
int platformOffset = ( ( CNpcPlatform* ) platform )->getHeightFromPlatformAtPosition( Pos.vx, Pos.vy );
|
||||
int height=CGameScene::getCollision()->getHeightFromGround(Pos.vx,Pos.vy,16);
|
||||
|
||||
if ( platformOffset < height )
|
||||
{
|
||||
Pos.vy += platformOffset;
|
||||
|
||||
DVECTOR posDelta;
|
||||
posDelta=platform->getPosDelta();
|
||||
posDelta.vy = 0;
|
||||
shove(posDelta);
|
||||
}
|
||||
/*if(((CNpcPlatform*)platform)->getHeightFromPlatformAtPosition(Pos.vx+posDelta.vx,Pos.vy+posDelta.vy)==0)
|
||||
{
|
||||
shove(posDelta);
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user