diff --git a/components/nif/physics.cpp b/components/nif/physics.cpp index cd6c9bbabb..af4a573707 100644 --- a/components/nif/physics.cpp +++ b/components/nif/physics.cpp @@ -190,16 +190,16 @@ namespace Nif void bhkConstraintCInfo::read(NIFStream* nif) { nif->get(); // Number of entities, unused - mEntities.resize(2); // Hardcoded - for (auto& entity : mEntities) - entity.read(nif); + mEntityA.read(nif); + mEntityB.read(nif); mPriority = static_cast(nif->get()); } void bhkConstraintCInfo::post(Reader& nif) { - postRecordList(nif, mEntities); + mEntityA.post(nif); + mEntityB.post(nif); } void bhkPositionConstraintMotor::read(NIFStream* nif) @@ -254,25 +254,25 @@ namespace Nif void bhkRagdollConstraintCInfo::read(NIFStream* nif) { - mEntityData.resize(2); // Hardcoded by the format if (nif->getBethVersion() <= 16) { - for (EntityData& data: mEntityData) - { - nif->read(data.mPivot); - nif->read(data.mPlane); - nif->read(data.mTwist); - } + nif->read(mDataA.mPivot); + nif->read(mDataA.mPlane); + nif->read(mDataA.mTwist); + nif->read(mDataB.mPivot); + nif->read(mDataB.mPlane); + nif->read(mDataB.mTwist); } else { - for (EntityData& data: mEntityData) - { - nif->read(data.mTwist); - nif->read(data.mPlane); - nif->read(data.mMotor); - nif->read(data.mPivot); - } + nif->read(mDataA.mTwist); + nif->read(mDataA.mPlane); + nif->read(mDataA.mMotor); + nif->read(mDataA.mPivot); + nif->read(mDataB.mTwist); + nif->read(mDataB.mPlane); + nif->read(mDataB.mMotor); + nif->read(mDataB.mPivot); } nif->read(mConeMaxAngle); nif->read(mPlaneMinAngle); diff --git a/components/nif/physics.hpp b/components/nif/physics.hpp index 5367b8a2b9..14eab4efa2 100644 --- a/components/nif/physics.hpp +++ b/components/nif/physics.hpp @@ -219,7 +219,8 @@ namespace Nif struct bhkConstraintCInfo { - bhkEntityList mEntities; + bhkEntityPtr mEntityA; + bhkEntityPtr mEntityB; ConstraintPriority mPriority; void read(NIFStream* nif); void post(Reader& nif); @@ -274,14 +275,15 @@ namespace Nif struct bhkRagdollConstraintCInfo { - struct EntityData + struct Data { osg::Vec4f mPivot; osg::Vec4f mPlane; osg::Vec4f mTwist; osg::Vec4f mMotor; }; - std::vector mEntityData; + Data mDataA; + Data mDataB; float mConeMaxAngle; float mPlaneMinAngle, mPlaneMaxAngle; float mTwistMinAngle, mTwistMaxAngle; diff --git a/components/nif/recordptr.hpp b/components/nif/recordptr.hpp index 3c22502145..e2836d458d 100644 --- a/components/nif/recordptr.hpp +++ b/components/nif/recordptr.hpp @@ -176,6 +176,7 @@ namespace Nif using NiCollisionObjectPtr = RecordPtrT; using bhkWorldObjectPtr = RecordPtrT; using bhkShapePtr = RecordPtrT; + using bhkEntityPtr = RecordPtrT; using hkPackedNiTriStripsDataPtr = RecordPtrT; using NiAccumulatorPtr = RecordPtrT; using NiInterpolatorPtr = RecordPtrT;