Merge branch 'esm4_cell_fixes' into 'master'

A few fixes related to ESM4::Cell

See merge request OpenMW/openmw!3083
macos_ci
psi29a 2 years ago
commit 83c8312060

@ -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<ESM4::World>();
const ESM4::World* cellWorld = worldStore.find(mParent);

@ -1212,16 +1212,15 @@ namespace MWWorld
void Store<ESM4::Cell>::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<ESM4::Cell>::clearDynamic()

@ -291,9 +291,7 @@ namespace MWWorld
{
std::unordered_map<std::string, ESM4::Cell*, Misc::StringUtils::CiHash, Misc::StringUtils::CiEqual>
mCellNameIndex;
std::unordered_map<ESM::ExteriorCellLocation, ESM4::Cell*> mExteriors;
std::unordered_map<ESM::ExteriorCellLocation, ESM4::Cell*> mPersistentExteriors;
public:
const ESM4::Cell* searchCellName(std::string_view) const;

@ -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);

@ -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
};

@ -80,13 +80,13 @@ namespace ESM4
FormId mGlobal;
FormId mClimate;
FormId mWater;
float mWaterHeight = 0;
float mWaterHeight = sInvalidWaterLevel;
std::vector<FormId> 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

Loading…
Cancel
Save