diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 027e66a88a..4fae09621f 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -779,6 +779,7 @@ namespace MWWorld void Scene::changePlayerCell(CellStore& cell, const ESM::Position& pos, bool adjustPlayerPos) { + mHalfGridSize = cell.getCell()->isEsm4() ? Constants::ESM4CellGridRadius : Constants::CellGridRadius; mCurrentCell = &cell; mRendering.enableTerrain(cell.isExterior()); diff --git a/apps/openmw/mwworld/scene.hpp b/apps/openmw/mwworld/scene.hpp index cec284a693..c775c3ee35 100644 --- a/apps/openmw/mwworld/scene.hpp +++ b/apps/openmw/mwworld/scene.hpp @@ -102,7 +102,7 @@ namespace MWWorld bool mPreloadFastTravel; float mPredictionTime; - static const int mHalfGridSize = Constants::CellGridRadius; + int mHalfGridSize = Constants::CellGridRadius; osg::Vec3f mLastPlayerPos; diff --git a/components/misc/constants.hpp b/components/misc/constants.hpp index 545db87094..eb40b1d584 100644 --- a/components/misc/constants.hpp +++ b/components/misc/constants.hpp @@ -28,6 +28,9 @@ namespace Constants // Size of active cell grid in cells (it is a square with the (2 * CellGridRadius + 1) cells side) constexpr int CellGridRadius = 1; + // ESM4 cells are twice smaller, so the active grid should have more cells. + constexpr int ESM4CellGridRadius = CellGridRadius * 2; + // A label to mark night/day visual switches const std::string NightDayLabel = "NightDaySwitch";