diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index c558dd4d27..0d1b98ebbb 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -204,12 +204,11 @@ namespace struct InsertVisitor { MWWorld::CellStore& mCell; - bool mRescale; Loading::Listener& mLoadingListener; std::vector mToInsert; - InsertVisitor (MWWorld::CellStore& cell, bool rescale, Loading::Listener& loadingListener); + InsertVisitor (MWWorld::CellStore& cell, Loading::Listener& loadingListener); bool operator() (const MWWorld::Ptr& ptr); @@ -217,8 +216,8 @@ namespace void insert(AddObject&& addObject); }; - InsertVisitor::InsertVisitor (MWWorld::CellStore& cell, bool rescale, Loading::Listener& loadingListener) - : mCell (cell), mRescale (rescale), mLoadingListener (loadingListener) + InsertVisitor::InsertVisitor (MWWorld::CellStore& cell, Loading::Listener& loadingListener) + : mCell (cell), mLoadingListener (loadingListener) {} bool InsertVisitor::operator() (const MWWorld::Ptr& ptr) @@ -234,14 +233,6 @@ namespace { for (MWWorld::Ptr& ptr : mToInsert) { - if (mRescale) - { - if (ptr.getCellRef().getScale()<0.5) - ptr.getCellRef().setScale(0.5); - else if (ptr.getCellRef().getScale()>2) - ptr.getCellRef().setScale(2); - } - if (!ptr.getRefData().isDeleted() && ptr.getRefData().isEnabled()) { try @@ -427,8 +418,7 @@ namespace MWWorld cell->respawn(); // ... then references. This is important for adjustPosition to work correctly. - /// \todo rescale depending on the state of a new GMST - insertCell (*cell, true, loadingListener); + insertCell (*cell, loadingListener); mRendering.addCell(cell); MWBase::Environment::get().getWindowManager()->addCell(cell); @@ -769,9 +759,9 @@ namespace MWWorld mCellChanged = false; } - void Scene::insertCell (CellStore &cell, bool rescale, Loading::Listener* loadingListener) + void Scene::insertCell (CellStore &cell, Loading::Listener* loadingListener) { - InsertVisitor insertVisitor (cell, rescale, *loadingListener); + InsertVisitor insertVisitor (cell, *loadingListener); cell.forEach (insertVisitor); insertVisitor.insert([&] (const MWWorld::Ptr& ptr) { addObject(ptr, *mPhysics, mRendering); }); insertVisitor.insert([&] (const MWWorld::Ptr& ptr) { addObject(ptr, *mPhysics, mNavigator); }); diff --git a/apps/openmw/mwworld/scene.hpp b/apps/openmw/mwworld/scene.hpp index 056c3acb2a..57f994fab3 100644 --- a/apps/openmw/mwworld/scene.hpp +++ b/apps/openmw/mwworld/scene.hpp @@ -85,7 +85,7 @@ namespace MWWorld osg::Vec3f mLastPlayerPos; - void insertCell (CellStore &cell, bool rescale, Loading::Listener* loadingListener); + void insertCell (CellStore &cell, Loading::Listener* loadingListener); // Load and unload cells as necessary to create a cell grid with "X" and "Y" in the center void changeCellGrid (int playerCellX, int playerCellY, bool changeEvent = true); diff --git a/components/esm/cellref.cpp b/components/esm/cellref.cpp index 4b9c6b0734..c6adfbd4dc 100644 --- a/components/esm/cellref.cpp +++ b/components/esm/cellref.cpp @@ -67,6 +67,10 @@ void ESM::CellRef::loadData(ESMReader &esm, bool &isDeleted) break; case ESM::FourCC<'X','S','C','L'>::value: esm.getHT(mScale); + if (mScale < 0.5) + mScale = 0.5; + else if (mScale > 2) + mScale = 2; break; case ESM::FourCC<'A','N','A','M'>::value: mOwner = esm.getHString(); @@ -141,7 +145,12 @@ void ESM::CellRef::save (ESMWriter &esm, bool wideRefNum, bool inInventory, bool } if (mScale != 1.0) { - esm.writeHNT("XSCL", mScale); + float scale = mScale; + if (scale < 0.5) + scale = 0.5; + else if (scale > 2) + scale = 2; + esm.writeHNT("XSCL", scale); } esm.writeHNOCString("ANAM", mOwner);