From 0eb8d28e81f91976f9b37f4fd81e2cb8bba73796 Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Wed, 20 Sep 2023 05:37:52 +0300 Subject: [PATCH] Read bhkBlendCollisionObject --- components/nif/niffile.cpp | 1 + components/nif/physics.cpp | 11 +++++++++++ components/nif/physics.hpp | 8 ++++++++ components/nif/record.hpp | 1 + 4 files changed, 21 insertions(+) diff --git a/components/nif/niffile.cpp b/components/nif/niffile.cpp index 52472caaeb..6d86455e49 100644 --- a/components/nif/niffile.cpp +++ b/components/nif/niffile.cpp @@ -281,6 +281,7 @@ namespace Nif { "bhkCollisionObject", &construct }, { "bhkPCollisionObject", &construct }, { "bhkSPCollisionObject", &construct }, + { "bhkBlendCollisionObject", &construct }, // Constraint records, Bethesda { "bhkHingeConstraint", &construct }, diff --git a/components/nif/physics.cpp b/components/nif/physics.cpp index 03f196bd53..62fcd4b6b3 100644 --- a/components/nif/physics.cpp +++ b/components/nif/physics.cpp @@ -342,6 +342,17 @@ namespace Nif mBody.read(nif); } + void bhkBlendCollisionObject::read(NIFStream* nif) + { + bhkCollisionObject::read(nif); + + nif->read(mHeirGain); + nif->read(mVelGain); + + if (nif->getBethVersion() <= 8) + nif->skip(8); // Unknown + } + void bhkWorldObject::read(NIFStream* nif) { mShape.read(nif); diff --git a/components/nif/physics.hpp b/components/nif/physics.hpp index 18d9d23249..fb0ab6694c 100644 --- a/components/nif/physics.hpp +++ b/components/nif/physics.hpp @@ -394,6 +394,14 @@ namespace Nif } }; + struct bhkBlendCollisionObject : bhkCollisionObject + { + float mHeirGain; + float mVelGain; + + void read(NIFStream* nif) override; + }; + // Abstract Havok shape info record struct bhkWorldObject : public bhkSerializable { diff --git a/components/nif/record.hpp b/components/nif/record.hpp index 2551fa836c..9d02fc2c85 100644 --- a/components/nif/record.hpp +++ b/components/nif/record.hpp @@ -36,6 +36,7 @@ namespace Nif { RC_MISSING = 0, RC_AvoidNode, + RC_bhkBlendCollisionObject, RC_bhkBlendController, RC_bhkBoxShape, RC_bhkCapsuleShape,