diff --git a/source/platform/pcart.cpp b/source/platform/pcart.cpp index e948fc2d2..cd7775548 100644 --- a/source/platform/pcart.cpp +++ b/source/platform/pcart.cpp @@ -252,6 +252,18 @@ void CNpcCartPlatform::processMovement( int _frames ) setCollisionAngle( heading ); + testPos2 = Pos; + testPos2.vx += 32; + + yDiff = CGameScene::getCollision()->getHeightFromGroundCart( testPos2.vx, testPos2.vy, sensorDist + 1 ); + + if ( yDiff <= sensorDist ) + { + // only use if there is ground present + + testPos2.vy += yDiff; + } + switch ( CGameScene::getCollision()->getCollisionBlock( testPos2.vx, testPos2.vy - 8 ) & COLLISION_TYPE_MASK ) { case COLLISION_TYPE_FLAG_DAMAGE: diff --git a/source/platform/pghost.cpp b/source/platform/pghost.cpp index 2ba46c68a..b044298cd 100644 --- a/source/platform/pghost.cpp +++ b/source/platform/pghost.cpp @@ -244,6 +244,18 @@ void CNpcGhostTrainPlatform::processMovement( int _frames ) setCollisionAngle( heading ); + testPos2 = Pos; + testPos2.vx += 32; + + yDiff = CGameScene::getCollision()->getHeightFromGroundCart( testPos2.vx, testPos2.vy, sensorDist + 1 ); + + if ( yDiff <= sensorDist ) + { + // only use if there is ground present + + testPos2.vy += yDiff; + } + switch ( CGameScene::getCollision()->getCollisionBlock( testPos2.vx, testPos2.vy - 8 ) & COLLISION_TYPE_MASK ) { case COLLISION_TYPE_FLAG_DAMAGE: