This commit is contained in:
Charles 2001-06-09 14:42:12 +00:00
parent 909d5578cf
commit 908c69641e
2 changed files with 46 additions and 4 deletions

View file

@ -145,17 +145,43 @@ void CNpcRaftPlatform::processMovement( int _frames )
DVECTOR testPos1, testPos2;
testPos1 = testPos2 = Pos;
testPos1.vx -= 10;
testPos2.vx += 10;
testPos1.vx -= 20;
testPos2.vx += 20;
testPos1.vy += CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
testPos2.vy += CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.vy, 16 );
s16 heightDiff;
heightDiff = CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
if ( heightDiff == 16 )
{
return;
}
testPos1.vy += heightDiff;
heightDiff = CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.vy, 16 );
if ( heightDiff == 16 )
{
return;
}
testPos2.vy += heightDiff;
s32 xDist = testPos2.vx - testPos1.vx;
s32 yDist = testPos2.vy - testPos1.vy;
s16 heading = ratan2( yDist, xDist );
/*if ( heading > 512 )
{
heading = 512;
}
else if ( heading < -512 )
{
heading = -512;
}*/
setCollisionAngle( heading );
}
@ -185,3 +211,18 @@ void CNpcRaftPlatform::render()
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const CRECT *CNpcRaftPlatform::getThinkBBox()
{
CRECT objThinkBox = getCollisionArea();
sBBox &thinkBBox = CThingManager::getThinkBBox();
objThinkBox.x1 = thinkBBox.XMin;
objThinkBox.x2 = thinkBBox.XMax;
objThinkBox.y1 = thinkBBox.YMin;
objThinkBox.y2 = thinkBBox.YMax;
return &objThinkBox;
}

View file

@ -23,6 +23,7 @@ class CNpcRaftPlatform : public CNpcPlatform
public:
virtual void postInit();
virtual void render();
virtual CRECT const *getThinkBBox();
protected:
virtual void processMovement( int _frames );