diff --git a/include/RefObject.h b/include/RefObject.h index 4dfa2dbb4a58d7a4919886098dac84d2d7581b06..43dbd57f532c5376c6c3012dadbda35fd1676fe3 100644 --- a/include/RefObject.h +++ b/include/RefObject.h @@ -29,6 +29,9 @@ public: /*! Constructor */ NIFLIB_API RefObject(); + /*! Copy Constructor */ + NIFLIB_API RefObject(const RefObject& src); + /*! Destructor */ NIFLIB_API virtual ~RefObject(); diff --git a/include/Type.h b/include/Type.h index 8c41a6f2092c40a46c51a860e258a82f4e3c24c9..6d14735e06cb5ff5b5092b0fc549ca5c593bf8ad 100644 --- a/include/Type.h +++ b/include/Type.h @@ -19,6 +19,7 @@ class NiObject; class Type { public: NIFLIB_API Type (const string & type_name, const Type * par_type ); + NIFLIB_API Type (const Type& src); NIFLIB_API ~Type(); NIFLIB_API string GetTypeName() const; diff --git a/include/nif_math.h b/include/nif_math.h index eec07e49717be334c165c01781a4ada8d3175e07..33dea8057609e36713f6cbd5cd6f61358ea3d62b 100644 --- a/include/nif_math.h +++ b/include/nif_math.h @@ -45,6 +45,9 @@ struct TexCoord { /*! Default constructor */ NIFLIB_API TexCoord() : u(0.0f), v(0.0f) {} + /*! Copy constructor */ + NIFLIB_API TexCoord(const TexCoord& src) : u(src.u), v(src.v) {} + NIFLIB_API TexCoord operator+(const TexCoord& rhs) const { TexCoord ret; @@ -603,6 +606,9 @@ struct Matrix33 { /*! Default constructor. Initializes matrix to identity. */ NIFLIB_API Matrix33(); + /*! Copy constructor. */ + NIFLIB_API Matrix33(const Matrix33& src); + /*! This constructor can be used to set all values in this matrix during initialization * \param[in] m11 The value to set at row 1, column 1. * \param[in] m12 The value to set at row 1, column 2. @@ -955,6 +961,13 @@ struct Color3 { /*! Default constructor */ NIFLIB_API Color3() {} + /*! Copy constructor */ + NIFLIB_API Color3(const Color3& src) { + this->r = src.r; + this->g = src.g; + this->b = src.b; + } + /*! This constructor can be used to set all values in this structure during initialization * \param[in] r The value to set the red component of this color to. Should be between 0.0f and 1.0f. * \param[in] g The value to set the green component of this color to. Should be between 0.0f and 1.0f. @@ -1010,6 +1023,9 @@ struct Color4 { /*! Default constructor */ NIFLIB_API Color4() : r(0.0f), g(0.0f), b(0.0f), a(0.0f) {} + /*! Copy constructor */ + NIFLIB_API Color4(const Color4& src) : r(src.r), g(src.g), b(src.b), a(src.a) {} + /*! This constructor can be used to set all values in this structure during initialization * \param[in] r The value to set the red component of this color to. Should be between 0.0f and 1.0f. * \param[in] g The value to set the green component of this color to. Should be between 0.0f and 1.0f. diff --git a/include/obj/BSLightingShaderProperty.h b/include/obj/BSLightingShaderProperty.h index 5abf7c47056d20ee205d70fc14036bbc5cbf2c42..2fe84d8bb81f54197b5af0abb13b6beb073fa2e1 100644 --- a/include/obj/BSLightingShaderProperty.h +++ b/include/obj/BSLightingShaderProperty.h @@ -34,6 +34,9 @@ public: /*! Constructor */ NIFLIB_API BSLightingShaderProperty(); + /*! Copy constructor */ + NIFLIB_API BSLightingShaderProperty(const BSLightingShaderProperty& src); + /*! Destructor */ NIFLIB_API virtual ~BSLightingShaderProperty(); diff --git a/include/obj/NiAVObject.h b/include/obj/NiAVObject.h index 77f56e6034558ca640c20debfcb0a8ad23b38005..8a842cfadca61044a551d30f51468c0c2e7e6cb8 100644 --- a/include/obj/NiAVObject.h +++ b/include/obj/NiAVObject.h @@ -35,6 +35,9 @@ public: /*! Constructor */ NIFLIB_API NiAVObject(); + /*! Copy constructor */ + NIFLIB_API NiAVObject(const NiAVObject& src); + /*! Destructor */ NIFLIB_API virtual ~NiAVObject(); diff --git a/include/obj/NiNode.h b/include/obj/NiNode.h index 0c7414b233d263df557f13bc30b311aaee2eef12..d2cf779034b97b7a6e81704f93d310908a7764f4 100644 --- a/include/obj/NiNode.h +++ b/include/obj/NiNode.h @@ -34,6 +34,9 @@ public: /*! Constructor */ NIFLIB_API NiNode(); + /*! Copy constructor */ + NIFLIB_API NiNode(const NiNode& src); + /*! Destructor */ NIFLIB_API virtual ~NiNode(); diff --git a/include/obj/NiObject.h b/include/obj/NiObject.h index 7553cad1e1e44a652cb07ab4d29d64beb4ed7d42..9a9ef1934301fcc55dc180da748f1d2f572060c5 100644 --- a/include/obj/NiObject.h +++ b/include/obj/NiObject.h @@ -38,6 +38,9 @@ public: /*! Constructor */ NIFLIB_API NiObject(); + /*! Copy constructor */ + NIFLIB_API NiObject(const NiObject& src); + /*! Destructor */ NIFLIB_API virtual ~NiObject(); diff --git a/include/obj/NiObjectNET.h b/include/obj/NiObjectNET.h index 67c6cb14a5393159fe09827c93b264038e4eb99d..07c19ea4547cc1524c21235722633be3ddb2b146 100644 --- a/include/obj/NiObjectNET.h +++ b/include/obj/NiObjectNET.h @@ -31,6 +31,9 @@ public: /*! Constructor */ NIFLIB_API NiObjectNET(); + /*! Copy constructor */ + NIFLIB_API NiObjectNET(const NiObjectNET& src); + /*! Destructor */ NIFLIB_API virtual ~NiObjectNET(); diff --git a/include/obj/bhkCompressedMeshShape.h b/include/obj/bhkCompressedMeshShape.h index 8e9c359334963f440c5ff69b0b0af9f3f1c03f2f..3ac0c392ca01c91379252237fbf18ae13f6f794d 100644 --- a/include/obj/bhkCompressedMeshShape.h +++ b/include/obj/bhkCompressedMeshShape.h @@ -32,6 +32,9 @@ public: /*! Constructor */ NIFLIB_API bhkCompressedMeshShape(); + /*! Copy constructor */ + NIFLIB_API bhkCompressedMeshShape(const bhkCompressedMeshShape& src); + /*! Destructor */ NIFLIB_API virtual ~bhkCompressedMeshShape(); diff --git a/include/obj/bhkMoppBvTreeShape.h b/include/obj/bhkMoppBvTreeShape.h index 10bd9af1bb3262af67c0e82f45ca650adc0e5e0f..30db0dfe4a9038749f44c4c3ce3921c12284cd3c 100644 --- a/include/obj/bhkMoppBvTreeShape.h +++ b/include/obj/bhkMoppBvTreeShape.h @@ -30,6 +30,9 @@ public: /*! Constructor */ NIFLIB_API bhkMoppBvTreeShape(); + /*! Copy constructor */ + NIFLIB_API bhkMoppBvTreeShape(const bhkMoppBvTreeShape& src); + /*! Destructor */ NIFLIB_API virtual ~bhkMoppBvTreeShape(); diff --git a/include/obj/bhkRigidBody.h b/include/obj/bhkRigidBody.h index f923c218bc2b24336fba9d590dbc3d97b8414388..4724bbba4abd29aaf636a32aa4c35b2d246bef04 100644 --- a/include/obj/bhkRigidBody.h +++ b/include/obj/bhkRigidBody.h @@ -39,6 +39,9 @@ public: /*! Constructor */ NIFLIB_API bhkRigidBody(); + /*! Copy constructor */ + NIFLIB_API bhkRigidBody(const bhkRigidBody& src); + /*! Destructor */ NIFLIB_API virtual ~bhkRigidBody(); diff --git a/src/RefObject.cpp b/src/RefObject.cpp index 6db8980df19b243163ec237a825acbaf2551f554..9d92a736bc010004fd8145f04cf72ebaa7e7c280 100644 --- a/src/RefObject.cpp +++ b/src/RefObject.cpp @@ -12,6 +12,11 @@ RefObject::RefObject() { objectsInMemory++; } +RefObject::RefObject(const RefObject& src) { + _ref_count = 0; + objectsInMemory++; +} + RefObject::~RefObject() { objectsInMemory--; } diff --git a/src/Type.cpp b/src/Type.cpp index 09639ef7baa091a188c8709780c83e0b881c2c8f..3fa1c32710aa200b2502dedf7d4307660355bc51 100644 --- a/src/Type.cpp +++ b/src/Type.cpp @@ -9,6 +9,8 @@ int Type::num_types = 0; Type::Type (const string & type_name, const Type * par_type ) : name(type_name), base_type(par_type), internal_type_number(num_types++) {} +Type::Type(const Type& src) : name(src.name), base_type(src.base_type), internal_type_number(src.internal_type_number) {} + Type::~Type() {} bool Type::operator<( const Type & compare_to ) const { diff --git a/src/nif_math.cpp b/src/nif_math.cpp index a7ffb8d4bb9e1699d872c70a36a8f382da157aaf..561d7ad36e82d808478879f76ffe63a979b4afd1 100644 --- a/src/nif_math.cpp +++ b/src/nif_math.cpp @@ -298,6 +298,10 @@ Matrix33::Matrix33() { *this = Matrix33::IDENTITY; } +Matrix33::Matrix33(const Matrix33& src) { + *this = src; +} + Quaternion Matrix33::AsQuaternion() const { Quaternion quat; float tr, s, q[4]; diff --git a/src/obj/BSLightingShaderProperty.cpp b/src/obj/BSLightingShaderProperty.cpp index 0ff3374958ba007538823c38402ce14556d27170..f3ce76908228c603b809436ceb12d0c636dedc9d 100644 --- a/src/obj/BSLightingShaderProperty.cpp +++ b/src/obj/BSLightingShaderProperty.cpp @@ -27,6 +27,36 @@ BSLightingShaderProperty::BSLightingShaderProperty() : shaderFlags1((unsigned in //--END CUSTOM CODE--// } +BSLightingShaderProperty::BSLightingShaderProperty(const BSLightingShaderProperty& src) + : shaderFlags1(src.shaderFlags1), + shaderFlags2(src.shaderFlags2), + textureSet(NULL), + emissiveSaturation(src.emissiveSaturation), + unknownInt7(src.unknownInt7), + alpha(src.alpha), + unknownFloat2(src.unknownFloat2), + glossiness(src.glossiness), + specularStrength(src.specularStrength), + lightingEffect1(src.lightingEffect1), + lightingEffect2(src.lightingEffect2), + environmentMapStrength(src.environmentMapStrength), + unknownFloat9(src.unknownFloat9), + eyeCubemapScale(src.eyeCubemapScale), + emissiveColor(src.emissiveColor), + specularColor(src.specularColor), + unknownColor1(src.unknownColor1), + unknownColor2(src.unknownColor2), + unknownFloatSet1(src.unknownFloatSet1), + unknownFloatSet5(src.unknownFloatSet5), + leftEyeReflectionCenter(src.leftEyeReflectionCenter), + rightEyeReflectionCenter(src.rightEyeReflectionCenter), + textureTranslation1(src.textureTranslation1), + textureRepeat(src.textureRepeat) +{ + //--BEGIN CONSTRUCTOR CUSTOM CODE--// + //--END CUSTOM CODE--// +} + BSLightingShaderProperty::~BSLightingShaderProperty() { //--BEGIN DESTRUCTOR CUSTOM CODE--// diff --git a/src/obj/NiAVObject.cpp b/src/obj/NiAVObject.cpp index 7329dd7e83b2968d8d66830ade5e1af3ae543c9f..a888c1c9de6244c9e81610a25978b31284ffa943 100644 --- a/src/obj/NiAVObject.cpp +++ b/src/obj/NiAVObject.cpp @@ -31,6 +31,27 @@ NiAVObject::NiAVObject() : flags((unsigned short)0), unknownShort1((unsigned sho //--END CUSTOM CODE--// } +NiAVObject::NiAVObject(const NiAVObject& src) + : NiObjectNET(src), + flags(src.flags), + unknownShort1(src.unknownShort1), + scale(src.scale), + numProperties((unsigned int)0), + unknown2(src.unknown2), + hasBoundingBox(src.hasBoundingBox), + collisionObject(NULL), + translation(src.translation), + velocity(src.velocity), + rotation(src.rotation), + boundingBox(src.boundingBox) +{ + //--BEGIN CONSTRUCTOR CUSTOM CODE--// + + parent = NULL; + + //--END CUSTOM CODE--// +} + NiAVObject::~NiAVObject() { //--BEGIN DESTRUCTOR CUSTOM CODE--// diff --git a/src/obj/NiNode.cpp b/src/obj/NiNode.cpp index 1325acc7b5913890a15a5903f760072b3e368c02..1908062e5f7d734b970359ea57766733bf19fae8 100644 --- a/src/obj/NiNode.cpp +++ b/src/obj/NiNode.cpp @@ -33,6 +33,13 @@ NiNode::NiNode() : numChildren((unsigned int)0), numEffects((unsigned int)0) { //--END CUSTOM CODE--// } +NiNode::NiNode(const NiNode& src) + : NiAVObject(src), + numChildren((unsigned int)0), + numEffects((unsigned int)0) +{ +} + NiNode::~NiNode() { //--BEGIN DESTRUCTOR CUSTOM CODE--// diff --git a/src/obj/NiObject.cpp b/src/obj/NiObject.cpp index deb2fb2f8165a33bdb37205dd8f7418076c34899..f9e2ccf2a90c0e87d3ba139dca98804a2b3df9c7 100644 --- a/src/obj/NiObject.cpp +++ b/src/obj/NiObject.cpp @@ -25,6 +25,14 @@ NiObject::NiObject() { //--END CUSTOM CODE--// } +NiObject::NiObject(const NiObject& src) + : RefObject(src), + internal_block_number(src.internal_block_number) +{ + //--BEGIN CONSTRUCTOR CUSTOM CODE--// + //--END CUSTOM CODE--// +} + NiObject::~NiObject() { //--BEGIN DESTRUCTOR CUSTOM CODE--// //--END CUSTOM CODE--// diff --git a/src/obj/NiObjectNET.cpp b/src/obj/NiObjectNET.cpp index dfc1177fd75d73eca772dac60686e0aafdbed4dd..d29c35bf8a280341928b42f9559d5ede6f940fc5 100644 --- a/src/obj/NiObjectNET.cpp +++ b/src/obj/NiObjectNET.cpp @@ -27,6 +27,23 @@ NiObjectNET::NiObjectNET() : skyrimShaderType((unsigned int)0), hasOldExtraData( //--END CUSTOM CODE--// } +NiObjectNET::NiObjectNET(const NiObjectNET& src) + : NiObject(src), + skyrimShaderType(src.skyrimShaderType), + name(src.name), + hasOldExtraData (src.hasOldExtraData), + oldExtraPropName(src.oldExtraPropName), + oldExtraInternalId(src.oldExtraInternalId), + oldExtraString(src.oldExtraString), + unknownByte(src.unknownByte), + extraData(NULL), + numExtraDataList((unsigned int)0), + controller(NULL) +{ + //--BEGIN CONSTRUCTOR CUSTOM CODE--// + //--END CUSTOM CODE--// +} + NiObjectNET::~NiObjectNET() { //--BEGIN DESTRUCTOR CUSTOM CODE--// diff --git a/src/obj/bhkCompressedMeshShape.cpp b/src/obj/bhkCompressedMeshShape.cpp index 823bbda6b1775914ed02ae860740bb001e171d79..43dfaea8f977ef31857531ac4f4aac204ff32284 100644 --- a/src/obj/bhkCompressedMeshShape.cpp +++ b/src/obj/bhkCompressedMeshShape.cpp @@ -28,6 +28,19 @@ bhkCompressedMeshShape::bhkCompressedMeshShape() : target(NULL), material((Havok //--END CUSTOM CODE--// } +bhkCompressedMeshShape::bhkCompressedMeshShape(const bhkCompressedMeshShape& src) + : target(NULL), + material(src.material), + unknownFloat1(src.unknownFloat1), + data(NULL) +{ + for (short i(0); i < 8; ++i) + { + unknown8Bytes[i] = src.unknown8Bytes[i]; + unknownFloats[i] = src.unknownFloats[i]; + } +} + bhkCompressedMeshShape::~bhkCompressedMeshShape() { //--BEGIN DESTRUCTOR CUSTOM CODE--// diff --git a/src/obj/bhkMoppBvTreeShape.cpp b/src/obj/bhkMoppBvTreeShape.cpp index 930b007862c4f1773e1c3e239b0b91e02d047e2a..ff98faaad97e55af3dd75c452ec480b9054fabaa 100644 --- a/src/obj/bhkMoppBvTreeShape.cpp +++ b/src/obj/bhkMoppBvTreeShape.cpp @@ -25,6 +25,24 @@ bhkMoppBvTreeShape::bhkMoppBvTreeShape() : shape(NULL), material((HavokMaterial) //--END CUSTOM CODE--// } +bhkMoppBvTreeShape::bhkMoppBvTreeShape(const bhkMoppBvTreeShape& src) + : shape(NULL), + material(src.material), + unknownInt1(src.unknownInt1), + unknownInt2(src.unknownInt2), + unknownFloat(src.unknownFloat), + moppDataSize(src.moppDataSize), + scale(src.scale), + unknownByte1(src.unknownByte1), + origin(src.origin) +{ + moppData.resize(src.moppData.size()); + for (unsigned int i(0); i < src.moppData.size(); ++i) + { + moppData[i] = src.moppData[i]; + } +} + bhkMoppBvTreeShape::~bhkMoppBvTreeShape() { //--BEGIN DESTRUCTOR CUSTOM CODE--// //--END CUSTOM CODE--// diff --git a/src/obj/bhkRigidBody.cpp b/src/obj/bhkRigidBody.cpp index 86004175650efe817f3a9c3a1dd65bfdefc7c048..6d238812a13a0467b13dd88c771b25747552b2d5 100644 --- a/src/obj/bhkRigidBody.cpp +++ b/src/obj/bhkRigidBody.cpp @@ -27,6 +27,60 @@ bhkRigidBody::bhkRigidBody() : unknownInt1((int)0), unknownInt2((int)0x00000001) //--END CUSTOM CODE--// } +bhkRigidBody::bhkRigidBody(const bhkRigidBody& src) + : unknownInt1(src.unknownInt1), + unknownInt2(src.unknownInt2), + collisionResponse_(src.collisionResponse_), + unknownByte(src.unknownByte), + processContactCallbackDelay_(src.processContactCallbackDelay_), + layerCopy(src.layerCopy), + colFilterCopy(src.colFilterCopy), + translation(src.translation), + rotation(src.rotation), + linearVelocity(src.linearVelocity), + angularVelocity(src.angularVelocity), + inertia(src.inertia), + center(src.center), + mass(src.mass), + linearDamping(src.linearDamping), + angularDamping(src.angularDamping), + friction(src.friction), + restitution(src.restitution), + unknownFloat51(src.unknownFloat51), + unknownFloat52(src.unknownFloat52), + unknownFloat53(src.unknownFloat53), + maxLinearVelocity(src.maxLinearVelocity), + maxAngularVelocity(src.maxAngularVelocity), + penetrationDepth(src.penetrationDepth), + motionSystem(src.motionSystem), + deactivatorType(src.deactivatorType), + solverDeactivation(src.solverDeactivation), + qualityType(src.qualityType), + unknownInt6(src.unknownInt6), + unknownInt7(src.unknownInt7), + unknownInt8(src.unknownInt8), + unknownInt81(src.unknownInt81), + numConstraints(src.numConstraints), + unknownInt9(src.unknownInt9), + unknownInt91(src.unknownInt91) +{ + //--BEGIN CONSTRUCTOR CUSTOM CODE--// + for (short i(0); i < 3; ++i) + { + unknown3Ints[i] = src.unknown3Ints[i]; + } + for (short i(0); i < 2; ++i) + { + unknown2Shorts[i] = src.unknown2Shorts[i]; + } + for (short i(0); i < 7; ++i) + { + unknown7Shorts[i] = src.unknown7Shorts[i]; + } + //vector<Ref<bhkSerializable > > constraints; vector<Ref<bhkSerializable > > constraints; + //--END CUSTOM CODE--// +} + bhkRigidBody::~bhkRigidBody() { //--BEGIN DESTRUCTOR CUSTOM CODE--// //--END CUSTOM CODE--//