From 93b3d9238c9e4bb8f8ea23ee869545904e234270 Mon Sep 17 00:00:00 2001 From: "florent.teppe" Date: Fri, 5 May 2023 22:13:16 +0200 Subject: [PATCH] mWater level disabled for skyrim. --- components/esm4/loadcell.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/esm4/loadcell.cpp b/components/esm4/loadcell.cpp index a9d8db0003..21f50ff9d9 100644 --- a/components/esm4/loadcell.cpp +++ b/components/esm4/loadcell.cpp @@ -42,7 +42,7 @@ #include -float ESM4::Cell::sInvalidWaterLevel = std::numeric_limits::min(); +float ESM4::Cell::sInvalidWaterLevel = -200000.f; // TODO: Try loading only EDID and XCLC (along with mFormId, mFlags and mParent) // @@ -79,6 +79,7 @@ void ESM4::Cell::load(ESM4::Reader& reader) reader.setCurrCell(mFormId); // save for LAND (and other children) to access later std::uint32_t esmVer = reader.esmVersion(); bool isFONV = esmVer == ESM::VER_132 || esmVer == ESM::VER_133 || esmVer == ESM::VER_134; + bool isSkyrim = (esmVer == ESM::VER_170 || esmVer == ESM::VER_094); while (reader.getSubRecordHeader()) { @@ -240,8 +241,11 @@ void ESM4::Cell::load(ESM4::Reader& reader) throw std::runtime_error("ESM4::CELL::load - Unknown subrecord " + ESM::printName(subHdr.typeId)); } } - if (mWaterHeight > 1e8) // A Bit of a hack for skyrim, there is a value for the cell but it is all wrong. + if (isSkyrim) // Skyrim seems to have broken water level records. But the subrecord exists so it + // shouldn't be skipped. + { mWaterHeight = sInvalidWaterLevel; + } mReaderContext = reader.getContext(); }