2025-09-03 13:21:02 -04:00
|
|
|
#include "xphyspreset.h"
|
|
|
|
|
|
|
|
|
|
XPhysPreset::XPhysPreset()
|
|
|
|
|
: XAsset()
|
2025-09-07 23:16:12 -04:00
|
|
|
, mName()
|
2025-09-03 13:21:02 -04:00
|
|
|
, mType(0)
|
|
|
|
|
, mMass(0)
|
|
|
|
|
, mBounce(0)
|
|
|
|
|
, mFriction(0)
|
|
|
|
|
, mBulletForceScale(0)
|
|
|
|
|
, mExplosiveForceScale(0)
|
2025-09-07 23:16:12 -04:00
|
|
|
, mSndAliasPrefix()
|
2025-09-03 13:21:02 -04:00
|
|
|
, mPiecesSpreadFraction(0)
|
|
|
|
|
, mPiecesUpwardVelocity(0)
|
|
|
|
|
, mTempDefaultToCylinder(false)
|
|
|
|
|
{
|
2025-09-05 18:35:17 -04:00
|
|
|
SetType(ASSET_TYPE_PHYSPRESET);
|
|
|
|
|
SetName("Phys Preset");
|
2025-09-03 13:21:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
XPhysPreset::~XPhysPreset()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-10 21:58:26 -04:00
|
|
|
void XPhysPreset::ParseData(XDataStream *aStream)
|
2025-09-03 13:21:02 -04:00
|
|
|
{
|
2025-09-07 23:16:12 -04:00
|
|
|
if (GetPtr() == -1)
|
|
|
|
|
{
|
|
|
|
|
mName.ParsePtr(aStream, false);
|
|
|
|
|
|
|
|
|
|
*aStream
|
|
|
|
|
>> mType
|
2025-09-10 21:58:26 -04:00
|
|
|
>> mMass;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
quint32 rawTemp;
|
|
|
|
|
*aStream >> rawTemp;
|
|
|
|
|
memcpy(&mBounce, &rawTemp, sizeof(mBounce));
|
|
|
|
|
*aStream >> rawTemp;
|
|
|
|
|
memcpy(&mFriction, &rawTemp, sizeof(mFriction));
|
|
|
|
|
*aStream >> rawTemp;
|
|
|
|
|
memcpy(&mBulletForceScale, &rawTemp, sizeof(mBulletForceScale));
|
|
|
|
|
*aStream >> rawTemp;
|
|
|
|
|
memcpy(&mExplosiveForceScale, &rawTemp, sizeof(mExplosiveForceScale));
|
2025-09-07 23:16:12 -04:00
|
|
|
|
|
|
|
|
mSndAliasPrefix.ParsePtr(aStream, false);
|
|
|
|
|
|
2025-09-10 21:58:26 -04:00
|
|
|
|
|
|
|
|
*aStream >> rawTemp;
|
|
|
|
|
memcpy(&mPiecesSpreadFraction, &rawTemp, sizeof(mPiecesSpreadFraction));
|
|
|
|
|
*aStream >> rawTemp;
|
|
|
|
|
memcpy(&mPiecesUpwardVelocity, &rawTemp, sizeof(mPiecesUpwardVelocity));
|
|
|
|
|
|
|
|
|
|
*aStream >> mTempDefaultToCylinder;
|
2025-09-07 23:16:12 -04:00
|
|
|
|
|
|
|
|
mName.ParseData(aStream);
|
|
|
|
|
mSndAliasPrefix.ParseData(aStream);
|
|
|
|
|
}
|
2025-09-03 13:21:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XPhysPreset::Clear()
|
|
|
|
|
{
|
2025-09-07 23:16:12 -04:00
|
|
|
mName.Clear();
|
2025-09-03 13:21:02 -04:00
|
|
|
mType = 0;
|
|
|
|
|
mMass = 0;
|
|
|
|
|
mBounce = 0;
|
|
|
|
|
mFriction = 0;
|
|
|
|
|
mBulletForceScale = 0;
|
|
|
|
|
mExplosiveForceScale = 0;
|
2025-09-07 23:16:12 -04:00
|
|
|
mSndAliasPrefix.Clear();
|
2025-09-03 13:21:02 -04:00
|
|
|
mPiecesSpreadFraction = 0;
|
|
|
|
|
mPiecesUpwardVelocity = 0;
|
|
|
|
|
mTempDefaultToCylinder = false;
|
|
|
|
|
}
|