diff --git a/source/platform/pbranch.cpp b/source/platform/pbranch.cpp index 36168fd8b..182f6d41d 100644 --- a/source/platform/pbranch.cpp +++ b/source/platform/pbranch.cpp @@ -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 ); - } -}*/ diff --git a/source/platform/pbranch.h b/source/platform/pbranch.h index 9ba876b47..a0dfc3b36 100644 --- a/source/platform/pbranch.h +++ b/source/platform/pbranch.h @@ -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; diff --git a/source/platform/pbwheel.cpp b/source/platform/pbwheel.cpp index 1cffc7766..148021c56 100644 --- a/source/platform/pbwheel.cpp +++ b/source/platform/pbwheel.cpp @@ -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 ) diff --git a/source/platform/pbwheel.h b/source/platform/pbwheel.h index da84c1707..a1be11c81 100644 --- a/source/platform/pbwheel.h +++ b/source/platform/pbwheel.h @@ -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 ); diff --git a/source/platform/pfishhk.cpp b/source/platform/pfishhk.cpp index 1f587e578..f855c7000 100644 --- a/source/platform/pfishhk.cpp +++ b/source/platform/pfishhk.cpp @@ -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; diff --git a/source/platform/platform.cpp b/source/platform/platform.cpp index 6c1202e71..193cfda15 100644 --- a/source/platform/platform.cpp +++ b/source/platform/platform.cpp @@ -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 diff --git a/source/platform/platform.h b/source/platform/platform.h index 5f0727ffd..0c166584e 100644 --- a/source/platform/platform.h +++ b/source/platform/platform.h @@ -163,7 +163,6 @@ protected: virtual void processTimer( int _frames ); void processTilt( int _frames ); bool isCollisionWithGround(); - virtual sBBox &getBBox() {return( m_modelGfx->GetBBox() );} // data diff --git a/source/platform/ppendulm.cpp b/source/platform/ppendulm.cpp index b0625ff61..8a57092b2 100644 --- a/source/platform/ppendulm.cpp +++ b/source/platform/ppendulm.cpp @@ -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;