Skip to content
Snippets Groups Projects
Commit 4a6a4d4c authored by Shon Ferguson's avatar Shon Ferguson
Browse files

Fixed some GCC compile problems.

Changed some functions to use pointers instead of Ref templates.
Updated to latest XML description.
parent 8bfdc86b
No related branches found
No related tags found
No related merge requests found
Showing with 274 additions and 143 deletions
......@@ -27,7 +27,7 @@ struct NIFLIB_API Header {
/*!
* Unknown.
*/
array<3,LineString> copyright;
array<3,LineString > copyright;
/*!
* The NIF version, in hexadecimal notation: 0x04000002, 0x0401000C,
* 0x04020002, 0x04020100, 0x04020200, 0x0A000100, 0x0A010000,
......
/* Copyright (c) 2006, NIF File Format Library and Tools
All rights reserved. Please see niflib.h for licence. */
#ifndef _OBLIVIONCOLFILTER_H_
#define _OBLIVIONCOLFILTER_H_
#include "../NIF_IO.h"
namespace Niflib {
/*!
* Oblivion's ColFilter property for Havok.
*/
struct NIFLIB_API OblivionColFilter {
/*! Default Constructor */
OblivionColFilter();
/*! Default Destructor */
~OblivionColFilter();
/*!
* Sets mesh color in Oblivion Construction Set.
*/
OblivionLayer layer;
/*!
* The first bit sets the LINK property and controls whether this body is
* physically linked to others. The next bit turns collision off. Then,
* the next bit sets the SCALED property in Oblivion. The next five bits
* make up the number of this part in a linked body list.
*/
byte colFilter;
/*!
* Unknown.
*/
ushort unknownShort;
};
}
#endif
/* Copyright (c) 2006, NIF File Format Library and Tools
All rights reserved. Please see niflib.h for licence. */
#ifndef _OBLIVIONSUBSHAPE_H_
#define _OBLIVIONSUBSHAPE_H_
#include "../NIF_IO.h"
namespace Niflib {
/*!
* Havok Information for packed TriStrip shapes.
*/
struct NIFLIB_API OblivionSubShape {
/*! Default Constructor */
OblivionSubShape();
/*! Default Destructor */
~OblivionSubShape();
/*!
* Sets mesh color in Oblivion Construction Set.
*/
OblivionLayer layer;
/*!
* The first bit sets the LINK property and controls whether this body is
* physically linked to others. The next bit turns collision off. Then,
* the next bit sets the SCALED property in Oblivion. The next five bits
* make up the number of this part in a linked body list.
*/
byte colFilter;
/*!
* Unknown.
*/
ushort unknownShort;
/*!
* Seems to be the number of vertices that form this sub shape.
*/
uint vertexCount___;
/*!
* The material of the subshape.
*/
HavokMaterial material;
};
}
#endif
......@@ -6,7 +6,7 @@ All rights reserved. Please see niflib.h for licence. */
#include <iostream>
using namespace std;
#include "nif_basic_types.h"
#include "../nif_basic_types.h"
namespace Niflib {
......
......@@ -26,8 +26,7 @@ struct NIFLIB_API hkTriangle {
*/
ushort unknownShort;
/*!
* This appears to be a normalized vector, so probably it is a normal or
* a tangent vector or something like that.
* This is the triangle's normal.
*/
Vector3 normal;
};
......
......@@ -194,7 +194,7 @@ ushort unknownShort3; \
bool hasUnknownFloats2; \
vector<float > unknownFloats2; \
byte hasUnknownFloats3; \
vector< array<4,float> > unknownFloats3; \
vector< array<4,float > > unknownFloats3; \
#define BHK_BLEND_COLLISION_OBJECT_MEMBERS \
float unknownFloat1; \
......@@ -210,7 +210,7 @@ ushort unknownShort2; \
ushort unknownShort3; \
ushort unknownShort4; \
Vector3 dimensions; \
float unknownFloat2; \
float min_Size; \
#define BHK_CAPSULE_SHAPE_MEMBERS \
float radius; \
......@@ -226,14 +226,14 @@ float radius2; \
#define BHK_COLLISION_OBJECT_MEMBERS \
#define BHK_CONVEX_VERTICES_SHAPE_MEMBERS \
array<7,float> unknownFloats1; \
mutable uint num1; \
vector<Float4 > unknownVectors1; \
mutable uint num2; \
vector<Float4 > unknownVectors2; \
array<7,float > unknownFloats1; \
mutable uint numVertices; \
vector<Float4 > vertices; \
mutable uint numNormals; \
vector<Float4 > normals; \
#define BHK_HINGE_CONSTRAINT_MEMBERS \
array< 5, array<4,float> > unknownFloats; \
array< 5, array<4,float > > unknownFloats; \
#define BHK_LIMITED_HINGE_CONSTRAINT_MEMBERS \
LimitedHingeDescriptor limitedHinge; \
......@@ -242,7 +242,7 @@ LimitedHingeDescriptor limitedHinge; \
mutable uint numSubShapes; \
vector<Ref<bhkShape > > subShapes; \
HavokMaterial material; \
array<6,float> unknownFloats; \
array<6,float > unknownFloats; \
mutable uint numUnknownInts; \
vector<uint > unknownInts; \
......@@ -260,7 +260,7 @@ float damping; \
#define BHK_MOPP_BV_TREE_SHAPE_MEMBERS \
Ref<bhkShape > shape; \
HavokMaterial material; \
array<8,byte> unknownBytes1; \
array<8,byte > unknownBytes1; \
float unknownFloat; \
mutable uint numUnknownBytes2; \
vector<byte > unknownBytes2; \
......@@ -277,35 +277,35 @@ vector<Sphere > spheres; \
#define BHK_NI_TRI_STRIPS_SHAPE_MEMBERS \
float unknownFloat1; \
uint unknownInt1; \
array<4,uint> unknownInts1; \
array<4,uint > unknownInts1; \
uint unknownInt2; \
Vector3 scale; \
uint unknownInt3; \
mutable uint numStripsData; \
vector<Ref<NiTriStripsData > > stripsData; \
mutable uint numUnknownInts2; \
vector<uint > unknownInts2; \
mutable uint numDataLayers; \
vector<OblivionColFilter > dataLayers; \
#define BHK_PACKED_NI_TRI_STRIPS_SHAPE_MEMBERS \
mutable ushort numSubparts; \
vector< array<3,uint> > subparts; \
array<9,float> unknownFloats; \
mutable ushort numSubShapes; \
vector<OblivionSubShape > subShapes; \
array<9,float > unknownFloats; \
float scale; \
array<3,float> unknownFloats2; \
array<3,float > unknownFloats2; \
Ref<hkPackedNiTriStripsData > data; \
#define BHK_PRISMATIC_CONSTRAINT_MEMBERS \
array<8,Float4> unknownVectors; \
array<3,float> unknownFloats2; \
array<8,Float4 > unknownVectors; \
array<3,float > unknownFloats2; \
#define BHK_RAGDOLL_CONSTRAINT_MEMBERS \
#define BHK_RIGID_BODY_MEMBERS \
array<5,float> unknown5Floats; \
array<4,ushort> unknown4Shorts; \
array<5,float > unknown5Floats; \
array<4,ushort > unknown4Shorts; \
OblivionLayer layerCopy; \
byte colFilterCopy; \
array<7,ushort> unknown7Shorts; \
array<7,ushort > unknown7Shorts; \
Vector3 translation; \
float unknownFloat00; \
QuaternionXYZW rotation; \
......@@ -313,7 +313,7 @@ Vector3 linearVelocity; \
float unknownFloat01; \
Vector3 angularVelocity; \
float unknownFloat02; \
array<12,float> transform; \
array<12,float > transform; \
Vector3 center; \
float unknownFloat03; \
float mass; \
......@@ -337,8 +337,8 @@ vector<Ref<AbhkConstraint > > constraints; \
#define BHK_RIGID_BODY_T_MEMBERS \
#define BHK_SIMPLE_SHAPE_PHANTOM_MEMBERS \
array<7,float> unkownFloats; \
array< 3, array<5,float> > unknownFloats2; \
array<7,float > unkownFloats; \
array< 3, array<5,float > > unknownFloats2; \
float unknownFloat; \
#define BHK_S_P_COLLISION_OBJECT_MEMBERS \
......@@ -347,7 +347,7 @@ float unknownFloat; \
float radius; \
#define BHK_STIFF_SPRING_CONSTRAINT_MEMBERS \
array< 2, array<4,float> > unknownFloats; \
array< 2, array<4,float > > unknownFloats; \
float unknownFloat; \
#define BHK_TRANSFORM_SHAPE_MEMBERS \
......@@ -437,10 +437,10 @@ Ref<NiBoolData > data; \
uint numControlPt; \
#define NI_B_SPLINE_COMP_FLOAT_INTERPOLATOR_MEMBERS \
array<4,float> unknownFloats; \
array<4,float > unknownFloats; \
#define NI_B_SPLINE_COMP_POINT3_INTERPOLATOR_MEMBERS \
array<6,float> unknownFloats; \
array<6,float > unknownFloats; \
#define NI_B_SPLINE_COMP_TRANSFORM_INTERPOLATOR_MEMBERS \
Vector3 translation; \
......@@ -486,8 +486,8 @@ uint unknownInt2; \
byte unknownByte; \
uint collisionType; \
Vector3 unknownVector; \
array<8,float> unknownFloat1; \
array<15,float> unknownFloat2; \
array<8,float > unknownFloat1; \
array<15,float > unknownFloat2; \
#define NI_COLOR_DATA_MEMBERS \
KeyGroup<Color4 > data; \
......@@ -595,7 +595,7 @@ mutable uint numRotationKeys; \
KeyType rotationType; \
vector<Key<Quaternion > > quaternionKeys; \
float unknownFloat; \
array<3,KeyGroup<float >> xyzRotations; \
array<3,KeyGroup<float > > xyzRotations; \
KeyGroup<Vector3 > translations; \
KeyGroup<float > scales; \
......@@ -637,8 +637,8 @@ float alpha; \
#define NI_MESH_P_SYS_DATA_MEMBERS \
byte unknownByte11; \
vector< array<10,float> > unknownFloats4; \
vector< array<12,float> > unknownFloats5; \
vector< array<10,float > > unknownFloats4; \
vector< array<12,float > > unknownFloats5; \
uint unknownInt1; \
Ref<NiObject > modifier; \
byte unknownByte2; \
......@@ -671,7 +671,7 @@ vector<Ref<NiDynamicEffect > > effects; \
#define FX_WIDGET_MEMBERS \
byte unknown1; \
array<292,byte> unknown292Bytes; \
array<292,byte > unknown292Bytes; \
#define FX_BUTTON_MEMBERS \
......@@ -690,7 +690,7 @@ BillboardMode billboardMode; \
#define NI_B_S_PARTICLE_NODE_MEMBERS \
#define NI_L_O_D_NODE_MEMBERS \
array<4,byte> unknown4Bytes; \
array<4,byte > unknown4Bytes; \
Vector3 lodCenter; \
mutable uint numLodLevels; \
vector<LODRange > lodLevels; \
......@@ -700,7 +700,7 @@ Ref<NiLODData > lodLevelData; \
#define NI_PALETTE_MEMBERS \
byte unknownByte; \
uint numEntries_; \
array< 256, array<4,byte> > palette; \
array< 256, array<4,byte > > palette; \
#define NI_PARTICLE_BOMB_MEMBERS \
float unknownFloat1; \
......@@ -819,9 +819,9 @@ uint greenMask; \
uint blueMask; \
uint alphaMask; \
uint bitsPerPixel; \
array<8,byte> unknown8Bytes; \
array<8,byte > unknown8Bytes; \
uint unknownInt; \
array<54,byte> unknown54Bytes; \
array<54,byte > unknown54Bytes; \
Ref<NiPalette > palette; \
mutable uint numMipmaps; \
uint bytesPerPixel; \
......@@ -867,9 +867,9 @@ Ref<NiPSysSpawnModifier > spawnModifier; \
#define NI_P_SYS_BOMB_MODIFIER_MEMBERS \
NiNode * unknownLink; \
array<2,uint> unknownInts1; \
array<3,float> unknownFloats; \
array<2,uint> unknownInts2; \
array<2,uint > unknownInts1; \
array<3,float > unknownFloats; \
array<2,uint > unknownInts2; \
#define NI_P_SYS_BOUND_UPDATE_MODIFIER_MEMBERS \
ushort updateSkip; \
......@@ -890,13 +890,13 @@ float radius; \
float height; \
#define NI_P_SYS_DATA_MEMBERS \
vector< array<10,float> > unknownFloats4; \
vector< array<10,float > > unknownFloats4; \
bool unknownBool1; \
vector< array<32,byte> > unknownBytes; \
vector< array<28,byte> > unknownBytesAlt; \
vector< array<32,byte > > unknownBytes; \
vector< array<28,byte > > unknownBytesAlt; \
byte unknownByte3; \
bool unknownBool2; \
vector< array<4,byte> > unknownBytes2; \
vector< array<4,byte > > unknownBytes2; \
uint unknownInt1; \
#define NI_P_SYS_DRAG_MODIFIER_MEMBERS \
......@@ -1123,12 +1123,12 @@ uint operation; \
Ref<NiFloatData > data; \
#define NI_TEXTURE_MODE_PROPERTY_MEMBERS \
array<3,short> unknown3Shorts; \
array<3,short > unknown3Shorts; \
#define NI_IMAGE_MEMBERS \
byte external_; \
string file; \
array<4,short> unknown4Shorts; \
array<4,short > unknown4Shorts; \
#define NI_TEXTURE_PROPERTY_MEMBERS \
ushort flags; \
......@@ -1172,7 +1172,7 @@ vector<ShaderTexDesc > shaderTextures; \
Vector3 translation; \
Quaternion rotation; \
float scale; \
array<3,byte> unknownBytes; \
array<3,byte > unknownBytes; \
Ref<NiTransformData > data; \
#define NI_TRI_SHAPE_MEMBERS \
......@@ -1201,16 +1201,16 @@ mutable ushort unknownCount2; \
mutable ushort unknownCount3; \
float unknownFloat; \
ushort unknownShort; \
vector< array<6,ushort> > unknownClodShorts1; \
vector< array<6,ushort > > unknownClodShorts1; \
vector<ushort > unknownClodShorts2; \
vector< array<6,ushort> > unknownClodShorts3; \
vector< array<6,ushort > > unknownClodShorts3; \
#define NI_U_V_CONTROLLER_MEMBERS \
ushort unknownShort; \
Ref<NiUVData > data; \
#define NI_U_V_DATA_MEMBERS \
array<4,KeyGroup<float >> uvGroups; \
array<4,KeyGroup<float > > uvGroups; \
#define NI_VECTOR_EXTRA_DATA_MEMBERS \
Vector3 vectorData; \
......@@ -1679,7 +1679,7 @@ CompareMode function; \
#define BHK_BOX_SHAPE_PARENT bhkConvexShape
#define BHK_BOX_SHAPE_CONSTRUCT : unknownFloat1(0.0f), unknownShort1((ushort)0), unknownShort2((ushort)0), unknownShort3((ushort)0), unknownShort4((ushort)0), unknownFloat2(0.0f)
#define BHK_BOX_SHAPE_CONSTRUCT : unknownFloat1(0.0f), unknownShort1((ushort)0), unknownShort2((ushort)0), unknownShort3((ushort)0), unknownShort4((ushort)0), min_Size(0.0f)
#define BHK_CAPSULE_SHAPE_INCLUDE "bhkConvexShape.h"
......@@ -1696,7 +1696,7 @@ CompareMode function; \
#define BHK_CONVEX_VERTICES_SHAPE_PARENT bhkSphereRepShape
#define BHK_CONVEX_VERTICES_SHAPE_CONSTRUCT : num1((uint)0), num2((uint)0)
#define BHK_CONVEX_VERTICES_SHAPE_CONSTRUCT : numVertices((uint)0), numNormals((uint)0)
#define BHK_HINGE_CONSTRAINT_INCLUDE "AbhkConstraint.h"
......@@ -1736,13 +1736,13 @@ CompareMode function; \
#define BHK_NI_TRI_STRIPS_SHAPE_PARENT bhkSphereRepShape
#define BHK_NI_TRI_STRIPS_SHAPE_CONSTRUCT : unknownFloat1(0.1f), unknownInt1((uint)0x004ABE60), unknownInt2((uint)1), scale(1.0f, 1.0f, 1.0f), unknownInt3((uint)0), numStripsData((uint)0), numUnknownInts2((uint)0)
#define BHK_NI_TRI_STRIPS_SHAPE_CONSTRUCT : unknownFloat1(0.1f), unknownInt1((uint)0x004ABE60), unknownInt2((uint)1), scale(1.0f, 1.0f, 1.0f), unknownInt3((uint)0), numStripsData((uint)0), numDataLayers((uint)0)
#define BHK_PACKED_NI_TRI_STRIPS_SHAPE_INCLUDE "AbhkShapeCollection.h"
#define BHK_PACKED_NI_TRI_STRIPS_SHAPE_PARENT AbhkShapeCollection
#define BHK_PACKED_NI_TRI_STRIPS_SHAPE_CONSTRUCT : numSubparts((ushort)0), scale(1.0f), data(NULL)
#define BHK_PACKED_NI_TRI_STRIPS_SHAPE_CONSTRUCT : numSubShapes((ushort)0), scale(1.0f), data(NULL)
#define BHK_PRISMATIC_CONSTRAINT_INCLUDE "AbhkConstraint.h"
......@@ -2541,7 +2541,7 @@ CompareMode function; \
#define NI_SOURCE_TEXTURE_PARENT NiObjectNET
#define NI_SOURCE_TEXTURE_CONSTRUCT : useExternal((byte)1), unknownLink(NULL), unknownByte((byte)1), pixelData(NULL), pixelLayout((PixelLayout)5), useMipmaps((MipMapFormat)2), alphaFormat((AlphaFormat)3), unknownByte2((byte)1)
#define NI_SOURCE_TEXTURE_CONSTRUCT : useExternal((byte)1), unknownLink(NULL), unknownByte((byte)0), pixelData(NULL), pixelLayout((PixelLayout)5), useMipmaps((MipMapFormat)2), alphaFormat((AlphaFormat)3), unknownByte2((byte)1)
#define NI_SPECULAR_PROPERTY_INCLUDE "NiProperty.h"
......
......@@ -23,4 +23,4 @@ const unsigned VER_20_0_0_5 = 0x14000005; /*!< NIF Version 20.0.0.4 */
const unsigned VER_UNSUPPORTED = 0xFFFFFFFF; /*!< Unsupported NIF Version */
const unsigned VER_INVALID = 0xFFFFFFFE; /*!< Not a NIF file */
#endif
\ No newline at end of file
#endif
......@@ -48,14 +48,14 @@ public:
*/
virtual string GetIDString();
void AddExtraData( Ref<NiExtraData> & obj, uint version = VER_10_0_1_0 );
void RemoveExtraData( Ref<NiExtraData> obj );
void AddExtraData( NiExtraData * obj, unsigned version = VER_10_0_1_0 );
void RemoveExtraData( NiExtraData * obj );
void ShiftExtraData( uint version = VER_10_0_1_0 );
void ClearExtraData();
list< Ref<NiExtraData> > GetExtraData() const;
void AddController( Ref<NiTimeController> & obj );
void RemoveController( Ref<NiTimeController> obj );
void AddController( NiTimeController * obj );
void RemoveController( NiTimeController * obj );
void ClearControllers();
list< Ref<NiTimeController> > GetControllers() const;
......
......@@ -16,7 +16,7 @@ typedef Ref<NiSequenceStreamHelper> NiSequenceStreamHelperRef;
* NiSequenceStreamHelper - Keyframe animation root node, in .kf files.
*/
class NIFLIB_API NiSequenceStreamHelper : public NI_SEQUENCE_STREAM_HELPER_PARENT {
class NiSequenceStreamHelper : public NI_SEQUENCE_STREAM_HELPER_PARENT {
public:
NiSequenceStreamHelper();
~NiSequenceStreamHelper();
......
......@@ -8,6 +8,7 @@ All rights reserved. Please see niflib.h for licence. */
// Include structures
#include "../Ref.h"
#include "../gen/OblivionColFilter.h"
namespace Niflib {
// Forward define of referenced blocks
......
......@@ -8,6 +8,7 @@ All rights reserved. Please see niflib.h for licence. */
// Include structures
#include "../Ref.h"
#include "../gen/OblivionSubShape.h"
namespace Niflib {
// Forward define of referenced blocks
......
......@@ -1474,6 +1474,14 @@
RelativePath=".\src\gen\obj_impl.cpp"
>
</File>
<File
RelativePath=".\src\gen\OblivionColFilter.cpp"
>
</File>
<File
RelativePath=".\src\gen\OblivionSubShape.cpp"
>
</File>
<File
RelativePath=".\src\gen\Particle.cpp"
>
......@@ -2584,6 +2592,14 @@
RelativePath=".\include\gen\obj_defines.h"
>
</File>
<File
RelativePath=".\include\gen\OblivionColFilter.h"
>
</File>
<File
RelativePath=".\include\gen\OblivionSubShape.h"
>
</File>
<File
RelativePath=".\include\gen\Particle.h"
>
......
/* Copyright (c) 2006, NIF File Format Library and Tools
All rights reserved. Please see niflib.h for licence. */
#include "../../include/gen/OblivionColFilter.h"
using namespace Niflib;
//Constructor
OblivionColFilter::OblivionColFilter() : colFilter((byte)0), unknownShort((ushort)0) {};
//Destructor
OblivionColFilter::~OblivionColFilter() {};
/* Copyright (c) 2006, NIF File Format Library and Tools
All rights reserved. Please see niflib.h for licence. */
#include "../../include/gen/OblivionSubShape.h"
using namespace Niflib;
//Constructor
OblivionSubShape::OblivionSubShape() : colFilter((byte)0), unknownShort((ushort)0), vertexCount___((uint)0) {};
//Destructor
OblivionSubShape::~OblivionSubShape() {};
......@@ -2211,7 +2211,7 @@ void bhkBoxShape::InternalRead( istream& in, list<uint> & link_stack, unsigned i
NifStream( unknownShort3, in, version );
NifStream( unknownShort4, in, version );
NifStream( dimensions, in, version );
NifStream( unknownFloat2, in, version );
NifStream( min_Size, in, version );
}
 
void bhkBoxShape::InternalWrite( ostream& out, const map<NiObjectRef,uint> & link_map, unsigned int version, unsigned int user_version ) const {
......@@ -2222,7 +2222,7 @@ void bhkBoxShape::InternalWrite( ostream& out, const map<NiObjectRef,uint> & lin
NifStream( unknownShort3, out, version );
NifStream( unknownShort4, out, version );
NifStream( dimensions, out, version );
NifStream( unknownFloat2, out, version );
NifStream( min_Size, out, version );
}
 
std::string bhkBoxShape::InternalAsString( bool verbose ) const {
......@@ -2235,7 +2235,7 @@ std::string bhkBoxShape::InternalAsString( bool verbose ) const {
out << " Unknown Short 3: " << unknownShort3 << endl;
out << " Unknown Short 4: " << unknownShort4 << endl;
out << " Dimensions: " << dimensions << endl;
out << " Unknown Float 2: " << unknownFloat2 << endl;
out << " Min. size: " << min_Size << endl;
return out.str();
}
 
......@@ -2331,32 +2331,32 @@ void bhkConvexVerticesShape::InternalRead( istream& in, list<uint> & link_stack,
for (uint i1 = 0; i1 < 7; i1++) {
NifStream( unknownFloats1[i1], in, version );
};
NifStream( num1, in, version );
unknownVectors1.resize(num1);
for (uint i1 = 0; i1 < unknownVectors1.size(); i1++) {
NifStream( unknownVectors1[i1], in, version );
NifStream( numVertices, in, version );
vertices.resize(numVertices);
for (uint i1 = 0; i1 < vertices.size(); i1++) {
NifStream( vertices[i1], in, version );
};
NifStream( num2, in, version );
unknownVectors2.resize(num2);
for (uint i1 = 0; i1 < unknownVectors2.size(); i1++) {
NifStream( unknownVectors2[i1], in, version );
NifStream( numNormals, in, version );
normals.resize(numNormals);
for (uint i1 = 0; i1 < normals.size(); i1++) {
NifStream( normals[i1], in, version );
};
}
 
void bhkConvexVerticesShape::InternalWrite( ostream& out, const map<NiObjectRef,uint> & link_map, unsigned int version, unsigned int user_version ) const {
bhkSphereRepShape::Write( out, link_map, version, user_version );
num2 = uint(unknownVectors2.size());
num1 = uint(unknownVectors1.size());
numNormals = uint(normals.size());
numVertices = uint(vertices.size());
for (uint i1 = 0; i1 < 7; i1++) {
NifStream( unknownFloats1[i1], out, version );
};
NifStream( num1, out, version );
for (uint i1 = 0; i1 < unknownVectors1.size(); i1++) {
NifStream( unknownVectors1[i1], out, version );
NifStream( numVertices, out, version );
for (uint i1 = 0; i1 < vertices.size(); i1++) {
NifStream( vertices[i1], out, version );
};
NifStream( num2, out, version );
for (uint i1 = 0; i1 < unknownVectors2.size(); i1++) {
NifStream( unknownVectors2[i1], out, version );
NifStream( numNormals, out, version );
for (uint i1 = 0; i1 < normals.size(); i1++) {
NifStream( normals[i1], out, version );
};
}
 
......@@ -2364,8 +2364,8 @@ std::string bhkConvexVerticesShape::InternalAsString( bool verbose ) const {
stringstream out;
uint array_output_count = 0;
out << bhkSphereRepShape::asString();
num2 = uint(unknownVectors2.size());
num1 = uint(unknownVectors1.size());
numNormals = uint(normals.size());
numVertices = uint(vertices.size());
array_output_count = 0;
for (uint i1 = 0; i1 < 7; i1++) {
if ( !verbose && ( array_output_count > MAXARRAYDUMP ) ) {
......@@ -2378,9 +2378,9 @@ std::string bhkConvexVerticesShape::InternalAsString( bool verbose ) const {
out << " Unknown Floats 1[" << i1 << "]: " << unknownFloats1[i1] << endl;
array_output_count++;
};
out << " Num 1: " << num1 << endl;
out << " Num Vertices: " << numVertices << endl;
array_output_count = 0;
for (uint i1 = 0; i1 < unknownVectors1.size(); i1++) {
for (uint i1 = 0; i1 < vertices.size(); i1++) {
if ( !verbose && ( array_output_count > MAXARRAYDUMP ) ) {
out << "<Data Truncated. Use verbose mode to see complete listing.>" << endl;
break;
......@@ -2388,12 +2388,12 @@ std::string bhkConvexVerticesShape::InternalAsString( bool verbose ) const {
if ( !verbose && ( array_output_count > MAXARRAYDUMP ) ) {
break;
};
out << " Unknown Vectors 1[" << i1 << "]: " << unknownVectors1[i1] << endl;
out << " Vertices[" << i1 << "]: " << vertices[i1] << endl;
array_output_count++;
};
out << " Num 2: " << num2 << endl;
out << " Num Normals: " << numNormals << endl;
array_output_count = 0;
for (uint i1 = 0; i1 < unknownVectors2.size(); i1++) {
for (uint i1 = 0; i1 < normals.size(); i1++) {
if ( !verbose && ( array_output_count > MAXARRAYDUMP ) ) {
out << "<Data Truncated. Use verbose mode to see complete listing.>" << endl;
break;
......@@ -2401,7 +2401,7 @@ std::string bhkConvexVerticesShape::InternalAsString( bool verbose ) const {
if ( !verbose && ( array_output_count > MAXARRAYDUMP ) ) {
break;
};
out << " Unknown Vectors 2[" << i1 << "]: " << unknownVectors2[i1] << endl;
out << " Normals[" << i1 << "]: " << normals[i1] << endl;
array_output_count++;
};
return out.str();
......@@ -2930,16 +2930,18 @@ void bhkNiTriStripsShape::InternalRead( istream& in, list<uint> & link_stack, un
NifStream( block_num, in, version );
link_stack.push_back( block_num );
};
NifStream( numUnknownInts2, in, version );
unknownInts2.resize(numUnknownInts2);
for (uint i1 = 0; i1 < unknownInts2.size(); i1++) {
NifStream( unknownInts2[i1], in, version );
NifStream( numDataLayers, in, version );
dataLayers.resize(numDataLayers);
for (uint i1 = 0; i1 < dataLayers.size(); i1++) {
NifStream( dataLayers[i1].layer, in, version );
NifStream( dataLayers[i1].colFilter, in, version );
NifStream( dataLayers[i1].unknownShort, in, version );
};
}
 
void bhkNiTriStripsShape::InternalWrite( ostream& out, const map<NiObjectRef,uint> & link_map, unsigned int version, unsigned int user_version ) const {
bhkSphereRepShape::Write( out, link_map, version, user_version );
numUnknownInts2 = uint(unknownInts2.size());
numDataLayers = uint(dataLayers.size());
numStripsData = uint(stripsData.size());
NifStream( unknownFloat1, out, version );
NifStream( unknownInt1, out, version );
......@@ -2956,9 +2958,11 @@ void bhkNiTriStripsShape::InternalWrite( ostream& out, const map<NiObjectRef,uin
else
NifStream( 0xffffffff, out, version );
};
NifStream( numUnknownInts2, out, version );
for (uint i1 = 0; i1 < unknownInts2.size(); i1++) {
NifStream( unknownInts2[i1], out, version );
NifStream( numDataLayers, out, version );
for (uint i1 = 0; i1 < dataLayers.size(); i1++) {
NifStream( dataLayers[i1].layer, out, version );
NifStream( dataLayers[i1].colFilter, out, version );
NifStream( dataLayers[i1].unknownShort, out, version );
};
}
 
......@@ -2966,7 +2970,7 @@ std::string bhkNiTriStripsShape::InternalAsString( bool verbose ) const {
stringstream out;
uint array_output_count = 0;
out << bhkSphereRepShape::asString();
numUnknownInts2 = uint(unknownInts2.size());
numDataLayers = uint(dataLayers.size());
numStripsData = uint(stripsData.size());
out << " Unknown Float 1: " << unknownFloat1 << endl;
out << " Unknown Int 1: " << unknownInt1 << endl;
......@@ -2998,18 +3002,16 @@ std::string bhkNiTriStripsShape::InternalAsString( bool verbose ) const {
out << " Strips Data[" << i1 << "]: " << stripsData[i1] << endl;
array_output_count++;
};
out << " Num Unknown Ints 2: " << numUnknownInts2 << endl;
out << " Num Data Layers: " << numDataLayers << endl;
array_output_count = 0;
for (uint i1 = 0; i1 < unknownInts2.size(); i1++) {
for (uint i1 = 0; i1 < dataLayers.size(); i1++) {
if ( !verbose && ( array_output_count > MAXARRAYDUMP ) ) {
out << "<Data Truncated. Use verbose mode to see complete listing.>" << endl;
break;
};
if ( !verbose && ( array_output_count > MAXARRAYDUMP ) ) {
break;
};
out << " Unknown Ints 2[" << i1 << "]: " << unknownInts2[i1] << endl;
array_output_count++;
out << " Layer: " << dataLayers[i1].layer << endl;
out << " Col Filter: " << dataLayers[i1].colFilter << endl;
out << " Unknown Short: " << dataLayers[i1].unknownShort << endl;
};
return out.str();
}
......@@ -3034,12 +3036,14 @@ std::list<NiObjectRef> bhkNiTriStripsShape::InternalGetRefs() const {
void bhkPackedNiTriStripsShape::InternalRead( istream& in, list<uint> & link_stack, unsigned int version, unsigned int user_version ) {
uint block_num;
AbhkShapeCollection::Read( in, link_stack, version, user_version );
NifStream( numSubparts, in, version );
subparts.resize(numSubparts);
for (uint i1 = 0; i1 < subparts.size(); i1++) {
for (uint i2 = 0; i2 < 3; i2++) {
NifStream( subparts[i1][i2], in, version );
};
NifStream( numSubShapes, in, version );
subShapes.resize(numSubShapes);
for (uint i1 = 0; i1 < subShapes.size(); i1++) {
NifStream( subShapes[i1].layer, in, version );
NifStream( subShapes[i1].colFilter, in, version );
NifStream( subShapes[i1].unknownShort, in, version );
NifStream( subShapes[i1].vertexCount___, in, version );
NifStream( subShapes[i1].material, in, version );
};
for (uint i1 = 0; i1 < 9; i1++) {
NifStream( unknownFloats[i1], in, version );
......@@ -3054,12 +3058,14 @@ void bhkPackedNiTriStripsShape::InternalRead( istream& in, list<uint> & link_sta
 
void bhkPackedNiTriStripsShape::InternalWrite( ostream& out, const map<NiObjectRef,uint> & link_map, unsigned int version, unsigned int user_version ) const {
AbhkShapeCollection::Write( out, link_map, version, user_version );
numSubparts = ushort(subparts.size());
NifStream( numSubparts, out, version );
for (uint i1 = 0; i1 < subparts.size(); i1++) {
for (uint i2 = 0; i2 < 3; i2++) {
NifStream( subparts[i1][i2], out, version );
};
numSubShapes = ushort(subShapes.size());
NifStream( numSubShapes, out, version );
for (uint i1 = 0; i1 < subShapes.size(); i1++) {
NifStream( subShapes[i1].layer, out, version );
NifStream( subShapes[i1].colFilter, out, version );
NifStream( subShapes[i1].unknownShort, out, version );
NifStream( subShapes[i1].vertexCount___, out, version );
NifStream( subShapes[i1].material, out, version );
};
for (uint i1 = 0; i1 < 9; i1++) {
NifStream( unknownFloats[i1], out, version );
......@@ -3078,21 +3084,19 @@ std::string bhkPackedNiTriStripsShape::InternalAsString( bool verbose ) const {
stringstream out;
uint array_output_count = 0;
out << AbhkShapeCollection::asString();
numSubparts = ushort(subparts.size());
out << " Num Subparts: " << numSubparts << endl;
numSubShapes = ushort(subShapes.size());
out << " Num Sub Shapes: " << numSubShapes << endl;
array_output_count = 0;
for (uint i1 = 0; i1 < subparts.size(); i1++) {
for (uint i1 = 0; i1 < subShapes.size(); i1++) {
if ( !verbose && ( array_output_count > MAXARRAYDUMP ) ) {
out << "<Data Truncated. Use verbose mode to see complete listing.>" << endl;
break;
};
for (uint i2 = 0; i2 < 3; i2++) {
if ( !verbose && ( array_output_count > MAXARRAYDUMP ) ) {
break;
};
out << " Subparts[" << i2 << "]: " << subparts[i1][i2] << endl;
array_output_count++;
};
out << " Layer: " << subShapes[i1].layer << endl;
out << " Col Filter: " << subShapes[i1].colFilter << endl;
out << " Unknown Short: " << subShapes[i1].unknownShort << endl;
out << " Vertex Count (?): " << subShapes[i1].vertexCount___ << endl;
out << " Material: " << subShapes[i1].material << endl;
};
array_output_count = 0;
for (uint i1 = 0; i1 < 9; i1++) {
......
......@@ -52,22 +52,23 @@ string NiObjectNET::GetIDString() {
return out.str();
}
void NiObjectNET::AddExtraData( Ref<NiExtraData> & obj, uint version ) {
void NiObjectNET::AddExtraData( NiExtraData * obj, uint version ) {
if ( version >= VER_10_0_1_0 ) {
//In later versions, extra data is just stored in a vector
extraDataList.push_back( obj );
extraDataList.push_back( NiExtraDataRef(obj) );
} else {
//In earlier versions, extra data is a singly linked list
//Insert at begining of list
obj->SetNextExtraData( extraData);
extraData = obj;
extraData = NiExtraDataRef(obj);
}
}
void NiObjectNET::RemoveExtraData( Ref<NiExtraData> obj ) {
void NiObjectNET::RemoveExtraData( NiExtraData * obj ) {
//Search both types of extra data list for the one to remove
NiExtraDataRef ref(obj);
for ( vector< NiExtraDataRef >::iterator it = extraDataList.begin(); it != extraDataList.end(); ) {
if ( *it == obj ) {
if ( *it == ref ) {
it = extraDataList.erase( it );
} else {
++it;
......@@ -76,7 +77,7 @@ void NiObjectNET::RemoveExtraData( Ref<NiExtraData> obj ) {
NiExtraDataRef * extra = &extraData;
while ( (*extra) != NULL ) {
if ( (*extra) == obj ) {
if ( (*extra) == ref ) {
//Cut this reference out of the list
(*extra) = (*extra)->GetNextExtraData();
} else {
......@@ -86,7 +87,7 @@ void NiObjectNET::RemoveExtraData( Ref<NiExtraData> obj ) {
}
}
void NiObjectNET::ShiftExtraData( uint version ) {
void NiObjectNET::ShiftExtraData( unsigned version ) {
//Shift any extra data references that are stored in a way that doesn't match
//the requested version to the way that does
if ( version >= VER_10_0_1_0 ) {
......@@ -132,17 +133,18 @@ list< Ref<NiExtraData> > NiObjectNET::GetExtraData() const {
return extras;
}
void NiObjectNET::AddController( Ref<NiTimeController> & obj ) {
void NiObjectNET::AddController( NiTimeController * obj ) {
//Insert at begining of list
obj->SetTarget( this );
obj->SetNextController( controller );
controller = obj;
}
void NiObjectNET::RemoveController( Ref<NiTimeController> obj ) {
void NiObjectNET::RemoveController( NiTimeController * obj ) {
NiTimeControllerRef ref(obj);
for(NiTimeControllerRef last = controller, cont = last, next; cont != NULL; cont = next ) {
next = cont->GetNextController();
if ( cont == obj ) {
if ( cont == ref ) {
//Cut this reference out of the list
cont->SetTarget( NULL );
cont->SetNextController( NiTimeControllerRef() );
......
......@@ -43,8 +43,10 @@ void bhkNiTriStripsShape::SetNumStripsData(int n)
// This is currently a kludge for compatibility with the max NifExporter as we dont know what this
// does but its always same number of strips and usually 1 or 4
numUnknownInts2 = n;
unknownInts2.assign(n, 1);
//numUnknownInts2 = n;
//unknownInts2.assign(n, 1);
//TODO: Understand why these are gone and what to do about it
}
void bhkNiTriStripsShape::SetStripsData(int i, Ref<NiTriStripsData> &strips)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment