diff --git a/source/platform/praft.cpp b/source/platform/praft.cpp index a4a88988d..90c49b85e 100644 --- a/source/platform/praft.cpp +++ b/source/platform/praft.cpp @@ -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; +} \ No newline at end of file diff --git a/source/platform/praft.h b/source/platform/praft.h index 7d0e66ee9..eb945b126 100644 --- a/source/platform/praft.h +++ b/source/platform/praft.h @@ -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 );