diff --git a/apps/openmw/mwworld/cell.cpp b/apps/openmw/mwworld/cell.cpp index 92b6ee9fc9..f4a57b87c9 100644 --- a/apps/openmw/mwworld/cell.cpp +++ b/apps/openmw/mwworld/cell.cpp @@ -30,7 +30,7 @@ namespace MWWorld .mFogDensity = 1.f,} ,mWaterHeight(cell.mWaterHeight) { - if (isExterior() && mWaterHeight == ESM4::Cell::sInvalidWaterLevel) + if (isExterior()) { auto& worldStore = MWBase::Environment::get().getESMStore()->get(); const ESM4::World* cellWorld = worldStore.find(mParent); diff --git a/apps/openmw/mwworld/store.cpp b/apps/openmw/mwworld/store.cpp index dd42476f64..4f8e4daa48 100644 --- a/apps/openmw/mwworld/store.cpp +++ b/apps/openmw/mwworld/store.cpp @@ -1212,16 +1212,15 @@ namespace MWWorld void Store::insertCell(ESM4::Cell* cellPtr) { + // Do not index exterior cells with Rec_Persistent flag because they are not real cells. + // References from these cells are merged into normal cells. + if (cellPtr->isExterior() && cellPtr->mFlags & ESM4::Rec_Persistent) + return; + if (!cellPtr->mEditorId.empty()) mCellNameIndex[cellPtr->mEditorId] = cellPtr; if (cellPtr->isExterior()) - { - ESM::ExteriorCellLocation cellindex = { cellPtr->mX, cellPtr->mY, cellPtr->mParent }; - if (cellPtr->mCellFlags & ESM4::Rec_Persistent) - mPersistentExteriors[cellindex] = cellPtr; - else - mExteriors[cellindex] = cellPtr; - } + mExteriors[ESM::ExteriorCellLocation(cellPtr->mX, cellPtr->mY, cellPtr->mParent)] = cellPtr; } void Store::clearDynamic() diff --git a/apps/openmw/mwworld/store.hpp b/apps/openmw/mwworld/store.hpp index 453f36db11..238c5cbd5f 100644 --- a/apps/openmw/mwworld/store.hpp +++ b/apps/openmw/mwworld/store.hpp @@ -291,9 +291,7 @@ namespace MWWorld { std::unordered_map mCellNameIndex; - std::unordered_map mExteriors; - std::unordered_map mPersistentExteriors; public: const ESM4::Cell* searchCellName(std::string_view) const; diff --git a/apps/openmw/mwworld/worldmodel.cpp b/apps/openmw/mwworld/worldmodel.cpp index 149b113b00..26402c5855 100644 --- a/apps/openmw/mwworld/worldmodel.cpp +++ b/apps/openmw/mwworld/worldmodel.cpp @@ -144,7 +144,7 @@ MWWorld::CellStore& MWWorld::WorldModel::getExterior(ESM::ExteriorCellLocation c record.mParent = cellIndex.mWorldspace; record.mX = cellIndex.mX; record.mY = cellIndex.mY; - record.mCellFlags = 0; + // Other ESM4::Cell members use default values from class definition. cell = mStore.insert(record); } CellStore* cellStore = &emplaceCellStore(cell->mId, *cell, mStore, mReaders, mCells); diff --git a/components/esm4/lighting.hpp b/components/esm4/lighting.hpp index d4f0d0ffea..486ea0fa61 100644 --- a/components/esm4/lighting.hpp +++ b/components/esm4/lighting.hpp @@ -35,16 +35,16 @@ namespace ESM4 // FO3/FNV version of the struct struct Lighting - { // | Aichan Prison values - std::uint32_t ambient; // | 16 17 19 00 (RGBA) - std::uint32_t directional; // | 00 00 00 00 (RGBA) - std::uint32_t fogColor; // | 1D 1B 16 00 (RGBA) - float fogNear; // Fog Near | 00 00 00 00 = 0.f - float fogFar; // Fog Far | 00 80 3B 45 = 3000.f - std::int32_t rotationXY; // rotation xy | 00 00 00 00 = 0 - std::int32_t rotationZ; // rotation z | 00 00 00 00 = 0 - float fogDirFade; // Fog dir fade | 00 00 80 3F = 1.f - float fogClipDist; // Fog clip dist | 00 80 3B 45 = 3000.f + { // | Aichan Prison values + std::uint32_t ambient = 0; // | 16 17 19 00 (RGBA) + std::uint32_t directional = 0; // | 00 00 00 00 (RGBA) + std::uint32_t fogColor = 0; // | 1D 1B 16 00 (RGBA) + float fogNear = 0; // Fog Near | 00 00 00 00 = 0.f + float fogFar = 0; // Fog Far | 00 80 3B 45 = 3000.f + std::int32_t rotationXY = 0; // | 00 00 00 00 = 0 + std::int32_t rotationZ = 0; // | 00 00 00 00 = 0 + float fogDirFade = 0; // | 00 00 80 3F = 1.f + float fogClipDist = 0; // | 00 80 3B 45 = 3000.f float fogPower = 1.f; // TES4 doesn't have this }; diff --git a/components/esm4/loadcell.hpp b/components/esm4/loadcell.hpp index c8980705e5..6bb04daff4 100644 --- a/components/esm4/loadcell.hpp +++ b/components/esm4/loadcell.hpp @@ -80,13 +80,13 @@ namespace ESM4 FormId mGlobal; FormId mClimate; FormId mWater; - float mWaterHeight = 0; + float mWaterHeight = sInvalidWaterLevel; std::vector mRegions; Lighting mLighting; FormId mLightingTemplate; // FO3/FONV - std::uint32_t mLightingTemplateFlags; // FO3/FONV + std::uint32_t mLightingTemplateFlags = 0; // FO3/FONV FormId mMusic; // FO3/FONV FormId mAcousticSpace; // FO3/FONV