This commit is contained in:
parent
909d5578cf
commit
908c69641e
2 changed files with 46 additions and 4 deletions
|
@ -145,17 +145,43 @@ void CNpcRaftPlatform::processMovement( int _frames )
|
||||||
DVECTOR testPos1, testPos2;
|
DVECTOR testPos1, testPos2;
|
||||||
|
|
||||||
testPos1 = testPos2 = Pos;
|
testPos1 = testPos2 = Pos;
|
||||||
testPos1.vx -= 10;
|
testPos1.vx -= 20;
|
||||||
testPos2.vx += 10;
|
testPos2.vx += 20;
|
||||||
|
|
||||||
testPos1.vy += CGameScene::getCollision()->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
|
s16 heightDiff;
|
||||||
testPos2.vy += CGameScene::getCollision()->getHeightFromGround( testPos2.vx, testPos2.vy, 16 );
|
|
||||||
|
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 xDist = testPos2.vx - testPos1.vx;
|
||||||
s32 yDist = testPos2.vy - testPos1.vy;
|
s32 yDist = testPos2.vy - testPos1.vy;
|
||||||
|
|
||||||
s16 heading = ratan2( yDist, xDist );
|
s16 heading = ratan2( yDist, xDist );
|
||||||
|
|
||||||
|
/*if ( heading > 512 )
|
||||||
|
{
|
||||||
|
heading = 512;
|
||||||
|
}
|
||||||
|
else if ( heading < -512 )
|
||||||
|
{
|
||||||
|
heading = -512;
|
||||||
|
}*/
|
||||||
|
|
||||||
setCollisionAngle( heading );
|
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;
|
||||||
|
}
|
|
@ -23,6 +23,7 @@ class CNpcRaftPlatform : public CNpcPlatform
|
||||||
public:
|
public:
|
||||||
virtual void postInit();
|
virtual void postInit();
|
||||||
virtual void render();
|
virtual void render();
|
||||||
|
virtual CRECT const *getThinkBBox();
|
||||||
protected:
|
protected:
|
||||||
virtual void processMovement( int _frames );
|
virtual void processMovement( int _frames );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue