221 lines
5.2 KiB
C++
221 lines
5.2 KiB
C++
|
|
|
|
|
|
|
|
|
|
#include "xpathnodeconstant.h"
|
|
|
|
XPathNodeConstant::XPathNodeConstant()
|
|
: XAsset() {
|
|
}
|
|
|
|
void XPathNodeConstant::ParseData(QDataStream *aStream) {
|
|
if (GetPtr() == -1) {
|
|
int typeInt;
|
|
aStream->read((char*)&typeInt, sizeof(int));
|
|
mType = static_cast<NodeType>(typeInt);
|
|
|
|
aStream->read((char*)&mSpawnflags, sizeof(unsigned short));
|
|
aStream->read((char*)&mTargetname, sizeof(unsigned short));
|
|
aStream->read((char*)&mScriptLinkName, sizeof(unsigned short));
|
|
aStream->read((char*)&mScriptNoteworthy, sizeof(unsigned short));
|
|
aStream->read((char*)&mTarget, sizeof(unsigned short));
|
|
aStream->read((char*)&mAnimscript, sizeof(unsigned short));
|
|
aStream->read((char*)&mAnimscriptfunc, sizeof(int));
|
|
|
|
aStream->read((char*)mOrigin, 3 * sizeof(float));
|
|
aStream->read((char*)&mAngle, sizeof(float));
|
|
aStream->read((char*)mForward, 2 * sizeof(float));
|
|
aStream->read((char*)&mRadius, sizeof(float));
|
|
aStream->read((char*)&mMinUseDistSq, sizeof(float));
|
|
|
|
aStream->read((char*)mOverlapNode, 2 * sizeof(short));
|
|
aStream->read((char*)&mChainId, sizeof(short));
|
|
aStream->read((char*)&mChainDepth, sizeof(short));
|
|
aStream->read((char*)&mChainParent, sizeof(short));
|
|
|
|
aStream->read((char*)&mTotalLinkCount, sizeof(unsigned short));
|
|
|
|
// Allocate and parse links
|
|
if (mLinks != nullptr) {
|
|
delete[] mLinks;
|
|
mLinks = nullptr;
|
|
}
|
|
|
|
if (mTotalLinkCount > 0) {
|
|
mLinks = new XPathLink[mTotalLinkCount];
|
|
for (unsigned short i = 0; i < mTotalLinkCount; ++i) {
|
|
mLinks[i].ParseData(aStream);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
NodeType XPathNodeConstant::GetType() const {
|
|
return mType;
|
|
}
|
|
|
|
void XPathNodeConstant::SetType(NodeType type) {
|
|
mType = type;
|
|
}
|
|
|
|
unsigned short XPathNodeConstant::GetSpawnflags() const {
|
|
return mSpawnflags;
|
|
}
|
|
|
|
void XPathNodeConstant::SetSpawnflags(unsigned short flags) {
|
|
mSpawnflags = flags;
|
|
}
|
|
|
|
unsigned short XPathNodeConstant::GetTargetname() const {
|
|
return mTargetname;
|
|
}
|
|
|
|
void XPathNodeConstant::SetTargetname(unsigned short name) {
|
|
mTargetname = name;
|
|
}
|
|
|
|
unsigned short XPathNodeConstant::GetScriptLinkName() const {
|
|
return mScriptLinkName;
|
|
}
|
|
|
|
void XPathNodeConstant::SetScriptLinkName(unsigned short name) {
|
|
mScriptLinkName = name;
|
|
}
|
|
|
|
unsigned short XPathNodeConstant::GetScriptNoteworthy() const {
|
|
return mScriptNoteworthy;
|
|
}
|
|
|
|
void XPathNodeConstant::SetScriptNoteworthy(unsigned short noteworthy) {
|
|
mScriptNoteworthy = noteworthy;
|
|
}
|
|
|
|
unsigned short XPathNodeConstant::GetTarget() const {
|
|
return mTarget;
|
|
}
|
|
|
|
void XPathNodeConstant::SetTarget(unsigned short target) {
|
|
mTarget = target;
|
|
}
|
|
|
|
unsigned short XPathNodeConstant::GetAnimscript() const {
|
|
return mAnimscript;
|
|
}
|
|
|
|
void XPathNodeConstant::SetAnimscript(unsigned short script) {
|
|
mAnimscript = script;
|
|
}
|
|
|
|
int XPathNodeConstant::GetAnimscriptfunc() const {
|
|
return mAnimscriptfunc;
|
|
}
|
|
|
|
void XPathNodeConstant::SetAnimscriptfunc(int func) {
|
|
mAnimscriptfunc = func;
|
|
}
|
|
|
|
const float* XPathNodeConstant::GetOrigin() const {
|
|
return mOrigin;
|
|
}
|
|
|
|
void XPathNodeConstant::SetOrigin(const float* origin, size_t count) {
|
|
if (count <= 3) {
|
|
memcpy(mOrigin, origin, count * sizeof(float));
|
|
}
|
|
}
|
|
|
|
float XPathNodeConstant::GetAngle() const {
|
|
return mAngle;
|
|
}
|
|
|
|
void XPathNodeConstant::SetAngle(float angle) {
|
|
mAngle = angle;
|
|
}
|
|
|
|
const float* XPathNodeConstant::GetForward() const {
|
|
return mForward;
|
|
}
|
|
|
|
void XPathNodeConstant::SetForward(const float* forward, size_t count) {
|
|
if (count <= 2) {
|
|
memcpy(mForward, forward, count * sizeof(float));
|
|
}
|
|
}
|
|
|
|
float XPathNodeConstant::GetRadius() const {
|
|
return mRadius;
|
|
}
|
|
|
|
void XPathNodeConstant::SetRadius(float radius) {
|
|
mRadius = radius;
|
|
}
|
|
|
|
float XPathNodeConstant::GetMinUseDistSq() const {
|
|
return mMinUseDistSq;
|
|
}
|
|
|
|
void XPathNodeConstant::SetMinUseDistSq(float dist) {
|
|
mMinUseDistSq = dist;
|
|
}
|
|
|
|
short XPathNodeConstant::GetOverlapNode(int index) const {
|
|
if (index >= 0 && index < 2) {
|
|
return mOverlapNode[index];
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
void XPathNodeConstant::SetOverlapNode(int index, short node) {
|
|
if (index >= 0 && index < 2) {
|
|
mOverlapNode[index] = node;
|
|
}
|
|
}
|
|
|
|
short XPathNodeConstant::GetChainId() const {
|
|
return mChainId;
|
|
}
|
|
|
|
void XPathNodeConstant::SetChainId(short id) {
|
|
mChainId = id;
|
|
}
|
|
|
|
short XPathNodeConstant::GetChainDepth() const {
|
|
return mChainDepth;
|
|
}
|
|
|
|
void XPathNodeConstant::SetChainDepth(short depth) {
|
|
mChainDepth = depth;
|
|
}
|
|
|
|
short XPathNodeConstant::GetChainParent() const {
|
|
return mChainParent;
|
|
}
|
|
|
|
void XPathNodeConstant::SetChainParent(short parent) {
|
|
mChainParent = parent;
|
|
}
|
|
|
|
unsigned short XPathNodeConstant::GetTotalLinkCount() const {
|
|
return mTotalLinkCount;
|
|
}
|
|
|
|
void XPathNodeConstant::SetTotalLinkCount(unsigned short count) {
|
|
mTotalLinkCount = count;
|
|
}
|
|
|
|
XPathLink* XPathNodeConstant::GetLinks() const {
|
|
return mLinks;
|
|
}
|
|
|
|
void XPathNodeConstant::SetLinks(XPathLink* links, unsigned short count) {
|
|
if (mLinks != nullptr) {
|
|
delete[] mLinks;
|
|
}
|
|
|
|
mLinks = new XPathLink[count];
|
|
memcpy(mLinks, links, count * sizeof(XPathLink));
|
|
mTotalLinkCount = count;
|
|
}
|
|
|