diff --git a/components/nif/extra.cpp b/components/nif/extra.cpp index e289ae626e..69f66014d6 100644 --- a/components/nif/extra.cpp +++ b/components/nif/extra.cpp @@ -10,6 +10,13 @@ namespace Nif nif->readVector(mData, mRecordSize); } + void NiStringsExtraData::read(NIFStream* nif) + { + Extra::read(nif); + + nif->getSizedStrings(mData, nif->get()); + } + void NiTextKeyExtraData::read(NIFStream* nif) { Extra::read(nif); @@ -94,4 +101,39 @@ namespace Nif nif->read(mControlsBaseSkeleton); } + void BSBoneLODExtraData::read(NIFStream* nif) + { + Extra::read(nif); + + mData.resize(nif->get()); + for (BoneLOD& lod : mData) + lod.read(nif); + } + + void BSBoneLODExtraData::BoneLOD::read(NIFStream* nif) + { + nif->read(mDistance); + nif->read(mBone); + } + + void BSDecalPlacementVectorExtraData::read(NIFStream* nif) + { + NiFloatExtraData::read(nif); + + mBlocks.resize(nif->get()); + for (Block& block : mBlocks) + block.read(nif); + } + + void BSDecalPlacementVectorExtraData::Block::read(NIFStream* nif) + { + nif->readVector(mPoints, nif->get()); + nif->readVector(mNormals, mPoints.size()); + } + + void BSClothExtraData::read(NIFStream* nif) + { + nif->readVector(mData, nif->get()); + } + } diff --git a/components/nif/extra.hpp b/components/nif/extra.hpp index dfe4539138..bb3cc3f73e 100644 --- a/components/nif/extra.hpp +++ b/components/nif/extra.hpp @@ -38,10 +38,15 @@ namespace Nif using NiStringExtraData = TypedExtra; using NiVectorExtraData = TypedExtra; + using BSDistantObjectExtraData = TypedExtra; + using BSDistantObjectLargeRefExtraData = TypedExtra; + using NiBinaryExtraData = TypedVectorExtra; using NiFloatsExtraData = TypedVectorExtra; using NiIntegersExtraData = TypedVectorExtra; + using BSWArray = TypedVectorExtra; + // Distinct from NiBinaryExtraData, uses mRecordSize as its size struct NiExtraData : public Extra { @@ -50,6 +55,14 @@ namespace Nif void read(NIFStream* nif) override; }; + // != TypedVectorExtra, doesn't use the string table + struct NiStringsExtraData : public Extra + { + std::vector mData; + + void read(NIFStream* nif) override; + }; + struct NiVertWeightsExtraData : public Extra { void read(NIFStream* nif) override; @@ -115,5 +128,47 @@ namespace Nif void read(NIFStream* nif) override; }; + struct BSBoneLODExtraData : public Extra + { + struct BoneLOD + { + uint32_t mDistance; + std::string mBone; + + void read(NIFStream* nif); + }; + + std::vector mData; + + void read(NIFStream* nif) override; + }; + + struct BSDecalPlacementVectorExtraData : public NiFloatExtraData + { + struct Block + { + std::vector mPoints; + std::vector mNormals; + + void read(NIFStream* nif); + }; + + std::vector mBlocks; + + void read(NIFStream* nif) override; + }; + + struct BSExtraData : NiExtraData + { + void read(NIFStream* nif) override { } + }; + + struct BSClothExtraData : BSExtraData + { + std::vector mData; + + void read(NIFStream* nif) override; + }; + } #endif diff --git a/components/nif/niffile.cpp b/components/nif/niffile.cpp index ae871002c3..748c8bea42 100644 --- a/components/nif/niffile.cpp +++ b/components/nif/niffile.cpp @@ -200,6 +200,7 @@ namespace Nif { "NiIntegerExtraData", &construct }, { "NiIntegersExtraData", &construct }, { "NiVectorExtraData", &construct }, + { "NiStringsExtraData", &construct }, { "NiStringPalette", &construct }, // Bethesda bounds @@ -214,7 +215,16 @@ namespace Nif { "BSInvMarker", &construct }, // Other Bethesda records + { "BSExtraData", &construct }, { "BSBehaviorGraphExtraData", &construct }, + { "BSBoneLODExtraData", &construct }, + { "BSClothExtraData", &construct }, + { "BSDecalPlacementVectorExtraData", + &construct }, + { "BSDistantObjectExtraData", &construct }, + { "BSDistantObjectLargeRefExtraData", + &construct }, + { "BSWArray", &construct }, { "BSXFlags", &construct }, // GEOMETRY diff --git a/components/nif/record.hpp b/components/nif/record.hpp index 3cb000e90e..ba13554571 100644 --- a/components/nif/record.hpp +++ b/components/nif/record.hpp @@ -57,10 +57,16 @@ namespace Nif RC_bhkSphereShape, RC_BSBehaviorGraphExtraData, RC_BSBound, + RC_BSBoneLODExtraData, + RC_BSClothExtraData, + RC_BSDecalPlacementVectorExtraData, RC_BSDismemberSkinInstance, + RC_BSDistantObjectExtraData, + RC_BSDistantObjectLargeRefExtraData, RC_BSEffectShaderProperty, RC_BSEffectShaderPropertyColorController, RC_BSEffectShaderPropertyFloatController, + RC_BSExtraData, RC_BSFurnitureMarker, RC_BSInvMarker, RC_BSLightingShaderProperty, @@ -78,6 +84,7 @@ namespace Nif RC_BSShaderProperty, RC_BSShaderTextureSet, RC_BSTriShape, + RC_BSWArray, RC_BSXFlags, RC_hkPackedNiTriStripsData, RC_NiAlphaAccumulator, @@ -156,6 +163,7 @@ namespace Nif RC_NiSphericalCollider, RC_NiStencilProperty, RC_NiStringExtraData, + RC_NiStringsExtraData, RC_NiStringPalette, RC_NiSwitchNode, RC_NiTextKeyExtraData,