From f9825328d2e9e80978735b81209bfa5afa3b5cf2 Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Fri, 5 Jan 2024 17:22:39 +0300 Subject: [PATCH] Bring ESM4 texture set reading up-to-date with FO76 --- components/esm4/loadtxst.cpp | 25 ++++++++++++++++++++++--- components/esm4/loadtxst.hpp | 7 ++++++- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/components/esm4/loadtxst.cpp b/components/esm4/loadtxst.cpp index 3f1aebafb4..3b5f04f265 100644 --- a/components/esm4/loadtxst.cpp +++ b/components/esm4/loadtxst.cpp @@ -44,6 +44,9 @@ void ESM4::TextureSet::load(ESM4::Reader& reader) case ESM4::SUB_EDID: reader.getZString(mEditorId); break; + case ESM::fourCC("FLTR"): // FO76 + reader.getZString(mFilter); + break; case ESM4::SUB_TX00: reader.getZString(mDiffuse); break; @@ -51,29 +54,45 @@ void ESM4::TextureSet::load(ESM4::Reader& reader) reader.getZString(mNormalMap); break; case ESM4::SUB_TX02: + // This is a "wrinkle map" in FO4/76 reader.getZString(mEnvMask); break; case ESM4::SUB_TX03: + // This is a glow map in FO4/76 reader.getZString(mToneMap); break; case ESM4::SUB_TX04: + // This is a height map in FO4/76 reader.getZString(mDetailMap); break; case ESM4::SUB_TX05: reader.getZString(mEnvMap); break; case ESM4::SUB_TX06: - reader.getZString(mUnknown); + reader.getZString(mMultiLayer); break; case ESM4::SUB_TX07: + // This is a "smooth specular" map in FO4/76 + reader.getZString(mSpecular); + break; + case ESM::fourCC("TX08"): // FO76 reader.getZString(mSpecular); break; + case ESM::fourCC("TX09"): // FO76 + reader.getZString(mLighting); + break; + case ESM::fourCC("TX10"): // FO76 + reader.getZString(mFlow); + break; + case ESM4::SUB_DNAM: + reader.get(mDataFlags); + break; case ESM4::SUB_MNAM: reader.getZString(mMaterial); break; - case ESM4::SUB_DNAM: - case ESM4::SUB_DODT: + case ESM4::SUB_DODT: // Decal data case ESM4::SUB_OBND: // object bounds + case ESM::fourCC("OPDS"): // Object placement defaults, FO76 reader.skipSubRecordData(); break; default: diff --git a/components/esm4/loadtxst.hpp b/components/esm4/loadtxst.hpp index 0b55f37f8c..8e628df841 100644 --- a/components/esm4/loadtxst.hpp +++ b/components/esm4/loadtxst.hpp @@ -44,6 +44,7 @@ namespace ESM4 std::uint32_t mFlags; // from the header, see enum type RecordFlag for details std::string mEditorId; + std::string mFilter; std::string mDiffuse; // includes alpha info std::string mNormalMap; // includes specular info (alpha channel) @@ -51,8 +52,12 @@ namespace ESM4 std::string mToneMap; std::string mDetailMap; std::string mEnvMap; - std::string mUnknown; + std::string mMultiLayer; std::string mSpecular; + std::string mSmoothSpecular; + std::string mLighting; + std::string mFlow; + std::uint16_t mDataFlags; std::string mMaterial; void load(ESM4::Reader& reader);