1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-03 14:39:42 +00:00

Follow global naming convention for new records

This commit is contained in:
Alexei Dobrohotov 2021-11-10 22:50:01 +03:00
parent 6e5b45453d
commit cc4c96d0f1
6 changed files with 60 additions and 58 deletions

View file

@ -273,7 +273,7 @@ namespace Nif
void NiControllerManager::read(NIFStream *nif)
{
Controller::read(nif);
cumulative = nif->getBoolean();
mCumulative = nif->getBoolean();
unsigned int numSequences = nif->getUInt();
nif->skip(4 * numSequences); // Controller sequences
nif->skip(4); // Object palette

View file

@ -186,7 +186,7 @@ struct bhkBlendController : public Controller
struct NiControllerManager : public Controller
{
bool cumulative;
bool mCumulative;
void read(NIFStream *nif) override;
};

View file

@ -96,18 +96,18 @@ void BSBound::read(NIFStream *nif)
void BSFurnitureMarker::LegacyFurniturePosition::read(NIFStream *nif)
{
offset = nif->getVector3();
orientation = nif->getUShort();
positionRef = nif->getChar();
mOffset = nif->getVector3();
mOrientation = nif->getUShort();
mPositionRef = nif->getChar();
nif->skip(1); // Position ref 2
}
void BSFurnitureMarker::FurniturePosition::read(NIFStream *nif)
{
offset = nif->getVector3();
heading = nif->getFloat();
type = nif->getUShort();
entryPoint = nif->getUShort();
mOffset = nif->getVector3();
mHeading = nif->getFloat();
mType = nif->getUShort();
mEntryPoint = nif->getUShort();
}
void BSFurnitureMarker::read(NIFStream *nif)
@ -116,14 +116,14 @@ void BSFurnitureMarker::read(NIFStream *nif)
unsigned int num = nif->getUInt();
if (nif->getBethVersion() <= NIFFile::BethVersion::BETHVER_FO3)
{
legacyMarkers.resize(num);
for (auto& marker : legacyMarkers)
mLegacyMarkers.resize(num);
for (auto& marker : mLegacyMarkers)
marker.read(nif);
}
else
{
markers.resize(num);
for (auto& marker : markers)
mMarkers.resize(num);
for (auto& marker : mMarkers)
marker.read(nif);
}
}

View file

@ -124,22 +124,23 @@ struct BSFurnitureMarker : public Extra
{
struct LegacyFurniturePosition
{
osg::Vec3f offset;
uint16_t orientation;
uint8_t positionRef;
osg::Vec3f mOffset;
uint16_t mOrientation;
uint8_t mPositionRef;
void read(NIFStream *nif);
};
struct FurniturePosition
{
osg::Vec3f offset;
float heading;
uint16_t type, entryPoint;
osg::Vec3f mOffset;
float mHeading;
uint16_t mType;
uint16_t mEntryPoint;
void read(NIFStream *nif);
};
std::vector<LegacyFurniturePosition> legacyMarkers;
std::vector<FurniturePosition> markers;
std::vector<LegacyFurniturePosition> mLegacyMarkers;
std::vector<FurniturePosition> mMarkers;
void read(NIFStream *nif) override;
};

View file

@ -6,49 +6,49 @@ namespace Nif
void bhkCollisionObject::read(NIFStream *nif)
{
NiCollisionObject::read(nif);
flags = nif->getUShort();
body.read(nif);
mFlags = nif->getUShort();
mBody.read(nif);
}
void bhkWorldObject::read(NIFStream *nif)
{
shape.read(nif);
mShape.read(nif);
if (nif->getVersion() <= NIFFile::NIFVersion::VER_OB_OLD)
nif->skip(4); // Unknown
flags = nif->getUInt();
mFlags = nif->getUInt();
nif->skip(4); // Unused
worldObjectInfo.phaseType = nif->getChar();
mWorldObjectInfo.mPhaseType = nif->getChar();
nif->skip(3); // Unused
worldObjectInfo.data = nif->getUInt();
worldObjectInfo.size = nif->getUInt();
worldObjectInfo.capacityAndFlags = nif->getUInt();
mWorldObjectInfo.mData = nif->getUInt();
mWorldObjectInfo.mSize = nif->getUInt();
mWorldObjectInfo.mCapacityAndFlags = nif->getUInt();
}
void bhkWorldObject::post(NIFFile *nif)
{
shape.post(nif);
mShape.post(nif);
}
void bhkEntity::read(NIFStream *nif)
{
bhkWorldObject::read(nif);
responseType = static_cast<hkResponseType>(nif->getChar());
mResponseType = static_cast<hkResponseType>(nif->getChar());
nif->skip(1); // Unused
processContactDelay = nif->getUShort();
mProcessContactDelay = nif->getUShort();
}
void HavokMaterial::read(NIFStream *nif)
{
if (nif->getVersion() <= NIFFile::NIFVersion::VER_OB_OLD)
nif->skip(4); // Unknown
material = nif->getUInt();
mMaterial = nif->getUInt();
}
void hkSubPartData::read(NIFStream *nif)
{
havokFilter = nif->getUInt();
numVertices = nif->getUInt();
material.read(nif);
mHavokFilter = nif->getUInt();
mNumVertices = nif->getUInt();
mHavokMaterial.read(nif);
}
} // Namespace

View file

@ -12,45 +12,45 @@ namespace Nif
struct NiCollisionObject : public Record
{
// The node that references this object
NodePtr target;
NodePtr mTarget;
void read(NIFStream *nif) override
{
target.read(nif);
mTarget.read(nif);
}
void post(NIFFile *nif) override
{
target.post(nif);
mTarget.post(nif);
}
};
// Bethesda Havok-specific collision object
struct bhkCollisionObject : public NiCollisionObject
{
unsigned short flags;
CollisionBodyPtr body;
unsigned short mFlags;
CollisionBodyPtr mBody;
void read(NIFStream *nif) override;
void post(NIFFile *nif) override
{
NiCollisionObject::post(nif);
body.post(nif);
mBody.post(nif);
}
};
// Abstract Havok shape info record
struct bhkWorldObject : public Record
{
bhkShapePtr shape;
unsigned int flags; // Havok layer type, collision filter flags and group
bhkShapePtr mShape;
unsigned int mFlags; // Havok layer type, collision filter flags and group
struct WorldObjectInfo
{
unsigned char phaseType;
unsigned int data;
unsigned int size;
unsigned int capacityAndFlags;
unsigned char mPhaseType;
unsigned int mData;
unsigned int mSize;
unsigned int mCapacityAndFlags;
};
WorldObjectInfo worldObjectInfo;
WorldObjectInfo mWorldObjectInfo;
void read(NIFStream *nif) override;
void post(NIFFile *nif) override;
};
@ -59,29 +59,30 @@ struct bhkShape : public Record {};
enum class hkResponseType : uint8_t
{
Invalid = 0,
SimpleContact = 1,
Reporting = 2,
None = 3
Response_Invalid = 0,
Response_SimpleContact = 1,
Response_Reporting = 2,
Response_None = 3
};
struct bhkEntity : public bhkWorldObject
{
hkResponseType responseType;
unsigned short processContactDelay;
hkResponseType mResponseType;
unsigned short mProcessContactDelay;
void read(NIFStream *nif) override;
};
struct HavokMaterial
{
unsigned int material;
unsigned int mMaterial;
void read(NIFStream *nif);
};
struct hkSubPartData
{
HavokMaterial material;
unsigned int numVertices, havokFilter;
HavokMaterial mHavokMaterial;
unsigned int mNumVertices;
unsigned int mHavokFilter;
void read(NIFStream *nif);
};