From 9a6c2fd2ccab30ee6e9b14643562cd4e7de5233f Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Mon, 30 Oct 2023 23:23:39 +0300 Subject: [PATCH] Fill out ESM4::ItemMod --- components/esm4/loadimod.cpp | 38 ++++++++++++++++++++++++++++++++++-- components/esm4/loadimod.hpp | 19 ++++++++++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/components/esm4/loadimod.cpp b/components/esm4/loadimod.cpp index 7382946e2c..0359f6d23b 100644 --- a/components/esm4/loadimod.cpp +++ b/components/esm4/loadimod.cpp @@ -46,16 +46,50 @@ void ESM4::ItemMod::load(ESM4::Reader& reader) case ESM4::SUB_EDID: reader.getZString(mEditorId); break; - case ESM4::SUB_OBND: case ESM4::SUB_FULL: + reader.getLocalizedString(mFullName); + break; case ESM4::SUB_MODL: + reader.getZString(mModel); + break; + case ESM4::SUB_MODB: + reader.get(mBoundRadius); + break; + case ESM4::SUB_DESC: + reader.getLocalizedString(mText); + break; case ESM4::SUB_ICON: + reader.getZString(mIcon); + break; case ESM4::SUB_MICO: + reader.getZString(mMiniIcon); + break; case ESM4::SUB_SCRI: - case ESM4::SUB_DESC: + reader.getFormId(mScriptId); + break; case ESM4::SUB_YNAM: + reader.getFormId(mPickUpSound); + break; case ESM4::SUB_ZNAM: + reader.getFormId(mDropSound); + break; case ESM4::SUB_DATA: + reader.get(mData.mValue); + reader.get(mData.mWeight); + break; + case ESM4::SUB_OBND: + case ESM4::SUB_MODT: // Model data + case ESM4::SUB_MODS: + case ESM4::SUB_MODD: // Model data end + case ESM4::SUB_DAMC: // Destructible + case ESM4::SUB_DEST: + case ESM4::SUB_DMDC: + case ESM4::SUB_DMDL: + case ESM4::SUB_DMDT: + case ESM4::SUB_DMDS: + case ESM4::SUB_DSTA: + case ESM4::SUB_DSTD: + case ESM4::SUB_DSTF: // Destructible end reader.skipSubRecordData(); break; default: diff --git a/components/esm4/loadimod.hpp b/components/esm4/loadimod.hpp index f1faed978c..1f6250ae72 100644 --- a/components/esm4/loadimod.hpp +++ b/components/esm4/loadimod.hpp @@ -42,10 +42,29 @@ namespace ESM4 struct ItemMod { + struct Data + { + std::uint32_t mValue{ 0 }; + float mWeight{ 0.f }; + }; + ESM::FormId mId; // from the header std::uint32_t mFlags; // from the header, see enum type RecordFlag for details std::string mEditorId; + std::string mFullName; + std::string mModel; + std::string mText; + std::string mIcon; + std::string mMiniIcon; + + ESM::FormId mScriptId; + ESM::FormId mPickUpSound; + ESM::FormId mDropSound; + + float mBoundRadius; + + Data mData; void load(ESM4::Reader& reader); // void save(ESM4::Writer& writer) const;