diff --git a/components/nif/niffile.cpp b/components/nif/niffile.cpp index 6f588a7cdb..efdd51a909 100644 --- a/components/nif/niffile.cpp +++ b/components/nif/niffile.cpp @@ -283,6 +283,7 @@ namespace Nif { "bhkCollisionObject", &construct }, { "bhkPCollisionObject", &construct }, { "bhkSPCollisionObject", &construct }, + { "bhkNPCollisionObject", &construct }, { "bhkBlendCollisionObject", &construct }, // Constraint records, Bethesda @@ -313,6 +314,10 @@ namespace Nif { "bhkSphereShape", &construct }, { "bhkTransformShape", &construct }, + // Physics system records, Bethesda + { "bhkPhysicsSystem", &construct }, + { "bhkRagdollSystem", &construct }, + // PROPERTIES // 4.0.0.2 diff --git a/components/nif/physics.cpp b/components/nif/physics.cpp index 120e56e2dd..a359f86066 100644 --- a/components/nif/physics.cpp +++ b/components/nif/physics.cpp @@ -342,6 +342,22 @@ namespace Nif mBody.read(nif); } + void bhkNPCollisionObject::read(NIFStream* nif) + { + NiCollisionObject::read(nif); + + nif->read(mFlags); + mData.read(nif); + nif->read(mBodyID); + } + + void bhkNPCollisionObject::post(Reader& nif) + { + NiCollisionObject::post(nif); + + mData.post(nif); + } + void bhkBlendCollisionObject::read(NIFStream* nif) { bhkCollisionObject::read(nif); @@ -353,6 +369,16 @@ namespace Nif nif->skip(8); // Unknown } + void bhkPhysicsSystem::read(NIFStream* nif) + { + nif->readVector(mData, nif->get()); + } + + void bhkRagdollSystem::read(NIFStream* nif) + { + nif->readVector(mData, nif->get()); + } + void bhkWorldObject::read(NIFStream* nif) { mShape.read(nif); diff --git a/components/nif/physics.hpp b/components/nif/physics.hpp index d4addeaad6..91d55c1f80 100644 --- a/components/nif/physics.hpp +++ b/components/nif/physics.hpp @@ -370,6 +370,11 @@ namespace Nif { }; + // Abstract physics system + struct bhkSystem : public Record + { + }; + // Generic collision object struct NiCollisionObject : public Record { @@ -394,6 +399,16 @@ namespace Nif } }; + struct bhkNPCollisionObject : NiCollisionObject + { + uint16_t mFlags; + bhkSystemPtr mData; + uint32_t mBodyID; + + void read(NIFStream* nif) override; + void post(Reader& nif) override; + }; + struct bhkBlendCollisionObject : bhkCollisionObject { float mHeirGain; @@ -402,6 +417,20 @@ namespace Nif void read(NIFStream* nif) override; }; + struct bhkPhysicsSystem : public bhkSystem + { + std::vector mData; + + void read(NIFStream* nif) override; + }; + + struct bhkRagdollSystem : public bhkSystem + { + std::vector mData; + + 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 1699820cdc..2c641b2aff 100644 --- a/components/nif/record.hpp +++ b/components/nif/record.hpp @@ -54,7 +54,9 @@ namespace Nif RC_bhkMoppBvTreeShape, RC_bhkNiTriStripsShape, RC_bhkPackedNiTriStripsShape, + RC_bhkPhysicsSystem, RC_bhkRagdollConstraint, + RC_bhkRagdollSystem, RC_bhkRigidBody, RC_bhkRigidBodyT, RC_bhkSimpleShapePhantom, diff --git a/components/nif/recordptr.hpp b/components/nif/recordptr.hpp index 54ebe0e9a2..8598a88f0e 100644 --- a/components/nif/recordptr.hpp +++ b/components/nif/recordptr.hpp @@ -136,6 +136,7 @@ namespace Nif struct BSShaderProperty; struct NiAlphaProperty; struct NiCollisionObject; + struct bhkSystem; struct bhkWorldObject; struct bhkShape; struct bhkSerializable; @@ -176,6 +177,7 @@ namespace Nif using BSShaderPropertyPtr = RecordPtrT; using NiAlphaPropertyPtr = RecordPtrT; using NiCollisionObjectPtr = RecordPtrT; + using bhkSystemPtr = RecordPtrT; using bhkWorldObjectPtr = RecordPtrT; using bhkShapePtr = RecordPtrT; using bhkEntityPtr = RecordPtrT;