This commit is contained in:
parent
1c886a0730
commit
28a5cdef9c
8 changed files with 21 additions and 53 deletions
|
@ -43,6 +43,7 @@ void CNpcBranchPlatform::postInit()
|
||||||
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
|
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
|
||||||
|
|
||||||
calculateNonRotatedCollisionData();
|
calculateNonRotatedCollisionData();
|
||||||
|
setCollisionAngle( m_tiltAngle >> 8 );
|
||||||
|
|
||||||
m_angularVelocity = 0;
|
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 );
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
|
@ -23,15 +23,9 @@ class CNpcBranchPlatform : public CNpcPlatform
|
||||||
public:
|
public:
|
||||||
virtual void postInit();
|
virtual void postInit();
|
||||||
virtual void render();
|
virtual void render();
|
||||||
//virtual int getHeightFromPlatformAtPosition(int _x,int _y, int offsetX = 0, int offsetY = 0);
|
|
||||||
protected:
|
protected:
|
||||||
virtual void setWaypoints( sThingPlatform *ThisPlatform );
|
virtual void setWaypoints( sThingPlatform *ThisPlatform );
|
||||||
virtual void processMovement( int _frames );
|
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;
|
s32 m_angularVelocity;
|
||||||
u8 m_reversed;
|
u8 m_reversed;
|
||||||
|
|
|
@ -20,6 +20,19 @@
|
||||||
#endif
|
#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 )
|
void CNpcBigWheelPlatform::processMovement( int _frames )
|
||||||
|
|
|
@ -22,6 +22,7 @@ class CNpcBigWheelPlatform : public CNpcPlatform
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual CRECT const *getThinkBBox();
|
virtual CRECT const *getThinkBBox();
|
||||||
|
virtual void postInit();
|
||||||
protected:
|
protected:
|
||||||
virtual void setWaypoints( sThingPlatform *ThisPlatform );
|
virtual void setWaypoints( sThingPlatform *ThisPlatform );
|
||||||
virtual void processMovement( int _frames );
|
virtual void processMovement( int _frames );
|
||||||
|
|
|
@ -37,6 +37,9 @@ void CNpcFishHookPlatform::postInit()
|
||||||
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
|
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
|
||||||
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
|
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
|
||||||
|
|
||||||
|
calculateNonRotatedCollisionData();
|
||||||
|
setCollisionAngle( m_tiltAngle >> 8 );
|
||||||
|
|
||||||
m_isMoving = false;
|
m_isMoving = false;
|
||||||
m_isResetting = false;
|
m_isResetting = false;
|
||||||
m_isShuttingDown = false;
|
m_isShuttingDown = false;
|
||||||
|
|
|
@ -658,7 +658,6 @@ void CNpcPlatform::setCollisionAngle(int newAngle)
|
||||||
|
|
||||||
void CNpcPlatform::calculateBoundingBoxSize()
|
void CNpcPlatform::calculateBoundingBoxSize()
|
||||||
{
|
{
|
||||||
//sBBox boundingBox = getBBox();
|
|
||||||
sBBox boundingBox = m_nonRotatedCollisionArea;
|
sBBox boundingBox = m_nonRotatedCollisionArea;
|
||||||
|
|
||||||
// 'render' collision box at correct angle
|
// 'render' collision box at correct angle
|
||||||
|
|
|
@ -163,7 +163,6 @@ protected:
|
||||||
virtual void processTimer( int _frames );
|
virtual void processTimer( int _frames );
|
||||||
void processTilt( int _frames );
|
void processTilt( int _frames );
|
||||||
bool isCollisionWithGround();
|
bool isCollisionWithGround();
|
||||||
virtual sBBox &getBBox() {return( m_modelGfx->GetBBox() );}
|
|
||||||
|
|
||||||
// data
|
// data
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,9 @@ void CNpcPendulumPlatform::postInit()
|
||||||
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
|
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
|
||||||
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
|
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
|
||||||
|
|
||||||
|
calculateNonRotatedCollisionData();
|
||||||
|
setCollisionAngle( m_tiltAngle >> 8 );
|
||||||
|
|
||||||
m_extendDir = EXTEND_LEFT;
|
m_extendDir = EXTEND_LEFT;
|
||||||
m_extension = 0;
|
m_extension = 0;
|
||||||
m_heading = 1024;
|
m_heading = 1024;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue