Merge branch 'esm4revisions' into 'master'

ESM4 reading updates

See merge request OpenMW/openmw!3728
qt6_macos
psi29a 12 months ago
commit 2eacca7752

@ -44,19 +44,16 @@ void ESM4::GlobalVariable::load(ESM4::Reader& reader)
case ESM4::SUB_EDID:
reader.getZString(mEditorId);
break;
case ESM::fourCC("XALG"): // FO76
reader.get(mExtraFlags2);
break;
case ESM4::SUB_FNAM:
reader.get(mType);
break;
case ESM4::SUB_FLTV:
reader.get(mValue);
break;
case ESM4::SUB_FULL:
case ESM4::SUB_MODL:
case ESM4::SUB_MODB:
case ESM4::SUB_ICON:
case ESM4::SUB_DATA:
case ESM4::SUB_OBND: // TES5
case ESM4::SUB_VMAD: // TES5
case ESM::fourCC("NTWK"): // FO76
reader.skipSubRecordData();
break;
default:

@ -42,6 +42,7 @@ namespace ESM4
{
ESM::FormId mId; // from the header
std::uint32_t mFlags; // from the header, see enum type RecordFlag for details
std::uint64_t mExtraFlags2;
std::string mEditorId;

@ -48,6 +48,9 @@ void ESM4::HeadPart::load(ESM4::Reader& reader)
case ESM4::SUB_EDID:
reader.getZString(mEditorId);
break;
case ESM::fourCC("XALG"): // FO76
reader.get(mExtraFlags2);
break;
case ESM4::SUB_FULL:
reader.getLocalizedString(mFullName);
break;
@ -58,7 +61,7 @@ void ESM4::HeadPart::load(ESM4::Reader& reader)
reader.getZString(mModel);
break;
case ESM4::SUB_HNAM:
reader.getFormId(mAdditionalPart);
reader.getFormId(mExtraParts.emplace_back());
break;
case ESM4::SUB_NAM0: // TES5
{
@ -87,15 +90,25 @@ void ESM4::HeadPart::load(ESM4::Reader& reader)
case ESM4::SUB_TNAM:
reader.getFormId(mBaseTexture);
break;
case ESM4::SUB_CNAM:
reader.getFormId(mColor);
break;
case ESM4::SUB_RNAM:
reader.getFormId(mValidRaces.emplace_back());
break;
case ESM4::SUB_PNAM:
reader.get(mType);
break;
case ESM4::SUB_MODT: // Model data
case ESM4::SUB_MODC:
case ESM4::SUB_MODS:
case ESM4::SUB_MODF: // Model data end
case ESM4::SUB_RNAM:
case ESM4::SUB_CNAM:
case ESM4::SUB_MODF:
case ESM::fourCC("ENLM"):
case ESM::fourCC("XFLG"):
case ESM::fourCC("ENLT"):
case ESM::fourCC("ENLS"):
case ESM::fourCC("AUUV"):
case ESM::fourCC("MODD"): // Model data end
case ESM4::SUB_CTDA:
reader.skipSubRecordData();
break;

@ -43,6 +43,7 @@ namespace ESM4
{
ESM::FormId mId; // from the header
std::uint32_t mFlags; // from the header, see enum type RecordFlag for details
std::uint64_t mExtraFlags2;
std::string mEditorId;
std::string mFullName;
@ -70,10 +71,12 @@ namespace ESM4
Type_Eyelashes = 13,
};
ESM::FormId mAdditionalPart;
std::vector<ESM::FormId> mExtraParts;
std::array<std::string, 3> mTriFile;
ESM::FormId mBaseTexture;
ESM::FormId mColor;
std::vector<ESM::FormId> mValidRaces;
void load(ESM4::Reader& reader);
// void save(ESM4::Writer& writer) const;

@ -100,6 +100,7 @@ void ESM4::Header::load(ESM4::Reader& reader)
case ESM4::SUB_OFST: // Oblivion only?
case ESM4::SUB_DELE: // Oblivion only?
case ESM4::SUB_TNAM: // Fallout 4 (CK only)
case ESM::fourCC("MMSB"): // Fallout 76
reader.skipSubRecordData();
break;
default:

@ -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:

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

Loading…
Cancel
Save