Don't mess with A/B hardcoding in constraints

revert-6246b479
Alexei Kotov 1 year ago
parent eb3e762c50
commit ed8fd81714

@ -190,16 +190,16 @@ namespace Nif
void bhkConstraintCInfo::read(NIFStream* nif)
{
nif->get<unsigned int>(); // Number of entities, unused
mEntities.resize(2); // Hardcoded
for (auto& entity : mEntities)
entity.read(nif);
mEntityA.read(nif);
mEntityB.read(nif);
mPriority = static_cast<ConstraintPriority>(nif->get<uint32_t>());
}
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);

@ -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<EntityData> mEntityData;
Data mDataA;
Data mDataB;
float mConeMaxAngle;
float mPlaneMinAngle, mPlaneMaxAngle;
float mTwistMinAngle, mTwistMaxAngle;

@ -176,6 +176,7 @@ namespace Nif
using NiCollisionObjectPtr = RecordPtrT<NiCollisionObject>;
using bhkWorldObjectPtr = RecordPtrT<bhkWorldObject>;
using bhkShapePtr = RecordPtrT<bhkShape>;
using bhkEntityPtr = RecordPtrT<bhkEntity>;
using hkPackedNiTriStripsDataPtr = RecordPtrT<hkPackedNiTriStripsData>;
using NiAccumulatorPtr = RecordPtrT<NiAccumulator>;
using NiInterpolatorPtr = RecordPtrT<NiInterpolator>;

Loading…
Cancel
Save