diff --git a/components/nif/data.cpp b/components/nif/data.cpp index 5b0b99c531..4df464fdf5 100644 --- a/components/nif/data.cpp +++ b/components/nif/data.cpp @@ -392,4 +392,29 @@ void NiPalette::read(NIFStream *nif) colors[i] = nif->getUInt() | alphaMask; } +void NiStringPalette::read(NIFStream *nif) +{ + unsigned int size = nif->getUInt(); + if (!size) + return; + std::vector source; + nif->getChars(source, size); + if (nif->getUInt() != size) + nif->file->warn("Failed size check in NiStringPalette"); + if (source[source.size()-1] != '\0') + source.emplace_back('\0'); + const char* buffer = source.data(); + while (static_cast(buffer - source.data()) < source.size()) + { + palette.emplace_back(buffer); + buffer += palette.back().size() + 1; + } +} + +void NiBoolData::read(NIFStream *nif) +{ + mKeyList = std::make_shared(); + mKeyList->read(nif); +} + } // Namespace diff --git a/components/nif/data.hpp b/components/nif/data.hpp index 0ba5446459..d0ea150e0b 100644 --- a/components/nif/data.hpp +++ b/components/nif/data.hpp @@ -240,5 +240,17 @@ public: void read(NIFStream *nif) override; }; +struct NiStringPalette : public Record +{ + std::vector palette; + void read(NIFStream *nif) override; +}; + +struct NiBoolData : public Record +{ + ByteKeyMapPtr mKeyList; + void read(NIFStream *nif) override; +}; + } // Namespace #endif diff --git a/components/nif/niffile.cpp b/components/nif/niffile.cpp index 098f6aba24..b50b602d57 100644 --- a/components/nif/niffile.cpp +++ b/components/nif/niffile.cpp @@ -116,6 +116,8 @@ static std::map makeFactory() factory["NiColorExtraData"] = {&construct , RC_NiColorExtraData }; factory["NiFloatExtraData"] = {&construct , RC_NiFloatExtraData }; factory["NiFloatsExtraData"] = {&construct , RC_NiFloatsExtraData }; + factory["NiStringPalette"] = {&construct , RC_NiStringPalette }; + factory["NiBoolData"] = {&construct , RC_NiBoolData }; return factory; } diff --git a/components/nif/record.hpp b/components/nif/record.hpp index eb26b0cce2..0e8b80ffa7 100644 --- a/components/nif/record.hpp +++ b/components/nif/record.hpp @@ -109,7 +109,9 @@ enum RecordType RC_NiVectorExtraData, RC_NiColorExtraData, RC_NiFloatExtraData, - RC_NiFloatsExtraData + RC_NiFloatsExtraData, + RC_NiStringPalette, + RC_NiBoolData }; /// Base class for all records diff --git a/components/nif/recordptr.hpp b/components/nif/recordptr.hpp index 57607cb6a3..d0b3d00ab8 100644 --- a/components/nif/recordptr.hpp +++ b/components/nif/recordptr.hpp @@ -143,6 +143,7 @@ class NiAutoNormalParticlesData; class NiPalette; struct NiParticleModifier; struct NiLinesData; +struct NiBoolData; using NodePtr = RecordPtrT; using ExtraPtr = RecordPtrT; @@ -166,6 +167,7 @@ using NiRotatingParticlesDataPtr = RecordPtrT; using NiAutoNormalParticlesDataPtr = RecordPtrT; using NiPalettePtr = RecordPtrT; using NiParticleModifierPtr = RecordPtrT; +using NiBoolDataPtr = RecordPtrT; using NodeList = RecordListT; using PropertyList = RecordListT;