mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-22 18:39:42 +00:00
Add height field to navigator in ESM4 cells
This commit is contained in:
parent
5abbc56bf2
commit
eb77fd1813
3 changed files with 6 additions and 11 deletions
|
@ -481,11 +481,9 @@ namespace MWPhysics
|
|||
mHeightFields.erase(heightfield);
|
||||
}
|
||||
|
||||
const HeightField* PhysicsSystem::getHeightField(ESM::ExteriorCellLocation cellIndex) const
|
||||
const HeightField* PhysicsSystem::getHeightField(int x, int y) const
|
||||
{
|
||||
if (ESM::isEsm4Ext(cellIndex.mWorldspace))
|
||||
return nullptr;
|
||||
const auto heightField = mHeightFields.find(std::make_pair(cellIndex.mX, cellIndex.mY));
|
||||
const auto heightField = mHeightFields.find(std::make_pair(x, y));
|
||||
if (heightField == mHeightFields.end())
|
||||
return nullptr;
|
||||
return heightField->second.get();
|
||||
|
|
|
@ -189,7 +189,7 @@ namespace MWPhysics
|
|||
|
||||
void removeHeightField(int x, int y);
|
||||
|
||||
const HeightField* getHeightField(ESM::ExteriorCellLocation cellIndex) const;
|
||||
const HeightField* getHeightField(int x, int y) const;
|
||||
|
||||
bool toggleCollisionMode();
|
||||
|
||||
|
|
|
@ -346,10 +346,7 @@ namespace MWWorld
|
|||
|
||||
if (cell->getCell()->isExterior())
|
||||
{
|
||||
if (mPhysics->getHeightField(ESM::ExteriorCellLocation(cellX, cellY, cell->getCell()->getWorldSpace()))
|
||||
!= nullptr)
|
||||
mNavigator.removeHeightfield(osg::Vec2i(cellX, cellY), navigatorUpdateGuard);
|
||||
|
||||
mPhysics->removeHeightField(cellX, cellY);
|
||||
}
|
||||
|
||||
|
@ -414,7 +411,7 @@ namespace MWWorld
|
|||
mPhysics->addHeightField(defaultHeight.data(), cellX, cellY, worldsize, verts,
|
||||
ESM::Land::DEFAULT_HEIGHT, ESM::Land::DEFAULT_HEIGHT, land.get());
|
||||
}
|
||||
if (const auto heightField = mPhysics->getHeightField(cellIndex))
|
||||
if (const auto heightField = mPhysics->getHeightField(cellX, cellY))
|
||||
{
|
||||
const osg::Vec2i cellPosition(cellX, cellY);
|
||||
const btVector3& origin = heightField->getCollisionObject()->getWorldTransform().getOrigin();
|
||||
|
@ -469,7 +466,7 @@ namespace MWWorld
|
|||
|
||||
if (cellVariant.isExterior())
|
||||
{
|
||||
if (const auto heightField = mPhysics->getHeightField(cellIndex))
|
||||
if (const auto heightField = mPhysics->getHeightField(cellX, cellY))
|
||||
mNavigator.addWater(
|
||||
osg::Vec2i(cellX, cellY), ESM::Land::REAL_SIZE, waterLevel, navigatorUpdateGuard);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue