|
|
@ -484,19 +484,19 @@ bool CTool::computeNearestValidSurfaceFromHeightMap(float x, float y, NLMISC::CV
|
|
|
|
|
|
|
|
|
|
|
|
const CScenarioEntryPoints::CCompleteIsland *islandDesc = getEditor().getIslandCollision().getCurrIslandDesc();
|
|
|
|
const CScenarioEntryPoints::CCompleteIsland *islandDesc = getEditor().getIslandCollision().getCurrIslandDesc();
|
|
|
|
if (!islandDesc) return false;
|
|
|
|
if (!islandDesc) return false;
|
|
|
|
|
|
|
|
|
|
|
|
sint mapX = (sint) (x - islandDesc->XMin);
|
|
|
|
sint mapX = (sint) (x - islandDesc->XMin);
|
|
|
|
sint mapY = (sint) (y - islandDesc->YMin);
|
|
|
|
sint mapY = (sint) (y - islandDesc->YMin);
|
|
|
|
|
|
|
|
|
|
|
|
if (mapX < 0 || mapY < 0 || mapX >= (islandDesc->XMax - islandDesc->XMin) || mapY >= (islandDesc->YMax - islandDesc->YMin)) return false;
|
|
|
|
if (mapX < 0 || mapY < 0 || mapX >= (islandDesc->XMax - islandDesc->XMin) || mapY >= (islandDesc->YMax - islandDesc->YMin)) return false;
|
|
|
|
sint hmZ = heightMap(mapX, mapY);
|
|
|
|
sint hmZ = heightMap(mapX, mapY);
|
|
|
|
if (hmZ >= 0x7ffe) return false; // not an accessible pos
|
|
|
|
if (hmZ >= 0x7ffe) return false; // not an accessible pos
|
|
|
|
|
|
|
|
|
|
|
|
if (!isIslandValidPos(heightMap, *islandDesc, x + 0.5f, y) ||
|
|
|
|
if (!isIslandValidPos(heightMap, *islandDesc, x + 0.5f, y) ||
|
|
|
|
!isIslandValidPos(heightMap, *islandDesc, x - 0.5f, y) ||
|
|
|
|
!isIslandValidPos(heightMap, *islandDesc, x - 0.5f, y) ||
|
|
|
|
!isIslandValidPos(heightMap, *islandDesc, x, y + 0.5f) ||
|
|
|
|
!isIslandValidPos(heightMap, *islandDesc, x, y + 0.5f) ||
|
|
|
|
!isIslandValidPos(heightMap, *islandDesc, x, y - 0.5f)) return false;
|
|
|
|
!isIslandValidPos(heightMap, *islandDesc, x, y - 0.5f)) return false;
|
|
|
|
|
|
|
|
|
|
|
|
float z = 1.f + 2.f * hmZ;
|
|
|
|
float z = 1.f + 2.f * hmZ;
|
|
|
|
// this is a possibly valid position
|
|
|
|
// this is a possibly valid position
|
|
|
|
// compute nearest surface from here, and see if not far from the intersection
|
|
|
|
// compute nearest surface from here, and see if not far from the intersection
|
|
|
@ -515,7 +515,7 @@ bool CTool::computeNearestValidSurfaceFromHeightMap(float x, float y, NLMISC::CV
|
|
|
|
inter1Found = inter1Found && normal1.z >= minAngleSin;
|
|
|
|
inter1Found = inter1Found && normal1.z >= minAngleSin;
|
|
|
|
inter2Found = inter2Found && normal2.z >= minAngleSin;
|
|
|
|
inter2Found = inter2Found && normal2.z >= minAngleSin;
|
|
|
|
if (!inter1Found && !inter2Found) return false;
|
|
|
|
if (!inter1Found && !inter2Found) return false;
|
|
|
|
|
|
|
|
|
|
|
|
if (inter1Found && inter2Found)
|
|
|
|
if (inter1Found && inter2Found)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// because z in heightmap in usually a 'ceil' of real height, tends to favor surface below
|
|
|
|
// because z in heightmap in usually a 'ceil' of real height, tends to favor surface below
|
|
|
@ -797,7 +797,7 @@ bool CTool::isMouseCaptured()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// *********************************************************************************************************
|
|
|
|
// *********************************************************************************************************
|
|
|
|
void CTool::setMouseCursor(const char *cursorTexture)
|
|
|
|
void CTool::setMouseCursor(const std::string &cursorTexture)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//H_AUTO(R2_CTool_setMouseCursor)
|
|
|
|
//H_AUTO(R2_CTool_setMouseCursor)
|
|
|
|
CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
|
|
|
CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
|
|
|