This commit is contained in:
Charles 2001-05-23 15:10:45 +00:00
parent 1c886a0730
commit 28a5cdef9c
8 changed files with 21 additions and 53 deletions

View File

@ -43,6 +43,7 @@ void CNpcBranchPlatform::postInit()
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
calculateNonRotatedCollisionData();
setCollisionAngle( m_tiltAngle >> 8 );
m_angularVelocity = 0;
@ -224,48 +225,3 @@ void CNpcBranchPlatform::render()
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
sBBox & CNpcBranchPlatform::getBBox()
{
return( m_boundingBox );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*int CNpcBranchPlatform::getHeightFromPlatformAtPosition(int _x,int _y, int offsetX, int offsetY)
{
DVECTOR top;
int angle;
CRECT collisionArea = getCollisionArea();
if ( m_reversed )
{
top.vx = offsetX + collisionArea.x2;
}
else
{
top.vx = offsetX + collisionArea.x1;
}
top.vy = offsetY + collisionArea.y1;
angle=getCollisionAngle();
if(angle==0)
{
// Non-rotated platform
return( top.vy - _y );
}
else
{
// Rotate backwards to find height at current position
int hypotenuse = ( ( top.vx - _x ) << 12 ) / rcos( angle );
int angleHeight = -( hypotenuse * rsin( angle ) ) >> 12;
return( ( top.vy - _y ) + angleHeight );
}
}*/

View File

@ -23,15 +23,9 @@ class CNpcBranchPlatform : public CNpcPlatform
public:
virtual void postInit();
virtual void render();
//virtual int getHeightFromPlatformAtPosition(int _x,int _y, int offsetX = 0, int offsetY = 0);
protected:
virtual void setWaypoints( sThingPlatform *ThisPlatform );
virtual void processMovement( int _frames );
virtual sBBox &getBBox();
//virtual void collidedWith(CThing *_thisThing);
//virtual void calculateBoundingBoxSize();
//virtual int getHeightFromPlatformAtPosition(int _x,int _y, int offsetX = 0, int offsetY = 0);
s32 m_angularVelocity;
u8 m_reversed;

View File

@ -20,6 +20,19 @@
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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 );
calculateNonRotatedCollisionData();
setCollisionAngle( m_tiltAngle >> 8 );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcBigWheelPlatform::processMovement( int _frames )

View File

@ -22,6 +22,7 @@ class CNpcBigWheelPlatform : public CNpcPlatform
{
public:
virtual CRECT const *getThinkBBox();
virtual void postInit();
protected:
virtual void setWaypoints( sThingPlatform *ThisPlatform );
virtual void processMovement( int _frames );

View File

@ -37,6 +37,9 @@ void CNpcFishHookPlatform::postInit()
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
calculateNonRotatedCollisionData();
setCollisionAngle( m_tiltAngle >> 8 );
m_isMoving = false;
m_isResetting = false;
m_isShuttingDown = false;

View File

@ -658,7 +658,6 @@ void CNpcPlatform::setCollisionAngle(int newAngle)
void CNpcPlatform::calculateBoundingBoxSize()
{
//sBBox boundingBox = getBBox();
sBBox boundingBox = m_nonRotatedCollisionArea;
// 'render' collision box at correct angle

View File

@ -163,7 +163,6 @@ protected:
virtual void processTimer( int _frames );
void processTilt( int _frames );
bool isCollisionWithGround();
virtual sBBox &getBBox() {return( m_modelGfx->GetBBox() );}
// data

View File

@ -36,6 +36,9 @@ void CNpcPendulumPlatform::postInit()
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
calculateNonRotatedCollisionData();
setCollisionAngle( m_tiltAngle >> 8 );
m_extendDir = EXTEND_LEFT;
m_extension = 0;
m_heading = 1024;