Hide FO4 dismemberment caps

This commit is contained in:
Aussiemon
2026-11-06 12:48:39 -07:00
parent 9889b225b1
commit 9d45cb12cd
+19 -6
View File
@@ -1734,16 +1734,15 @@ namespace NifOsg
drawable = rig;
// FO3 and FNV body parts 100-299 are caps where a limb cuts off.
// TODO: Later games have different ids.
// TODO: Handle actual dismemberment.
// FO3 and FNV body parts 100-299 are dismemberment caps.
if (skin->mRecordType == Nif::RC_BSDismemberSkinInstance
&& mBethVersion <= Nif::NIFFile::BethVersion::BETHVER_FO3)
{
const auto& parts = static_cast<const Nif::BSDismemberSkinInstance*>(skin)->mParts;
if (!parts.empty() && std::all_of(parts.begin(), parts.end(), [](const auto& part) {
return part.mType >= 100 && part.mType < 300;
}))
const bool isCap = !parts.empty() && std::all_of(parts.begin(), parts.end(), [](const auto& part) {
return part.mType >= 100 && part.mType < 300;
});
if (isCap) // TODO: Handle actual dismemberment.
drawable->setNodeMask(Loader::getHiddenNodeMask());
}
}
@@ -1911,6 +1910,20 @@ namespace NifOsg
rig->setRootBone(rootBone->mName);
drawable = rig;
// FO4 subsegment user slots 100-102 are dismemberment caps.
if (nifNode->mRecordType == Nif::RC_BSSubIndexTriShape
&& mBethVersion == Nif::NIFFile::BethVersion::BETHVER_FO4)
{
const Nif::BSSubIndexTriShape& bsSubTriShape
= static_cast<const Nif::BSSubIndexTriShape&>(*nifNode);
const auto& records = bsSubTriShape.mSegmentation.mSubSegmentData.mDataRecords;
const bool isCap = std::any_of(records.begin(), records.end(),
[](const auto& r) { return r.mUserSlotID >= 100 && r.mUserSlotID <= 102; });
if (isCap) // TODO: Handle actual dismemberment.
drawable->setNodeMask(Loader::getHiddenNodeMask());
}
}
std::vector<const Nif::NiProperty*> drawableProps;