diff --git a/include/NIF_IO.h b/include/NIF_IO.h index ed1456cffa7dc1abeb678f2c2ea9f17d5cdfd288..fc1428a3c907c1d144c046cebd1db82061b59733 100644 --- a/include/NIF_IO.h +++ b/include/NIF_IO.h @@ -215,7 +215,7 @@ void NifStream( InertiaMatrix & val, istream& in, const NifInfo & info); void NifStream( InertiaMatrix const & val, ostream& out, const NifInfo & info); //ByteColor4 -class ByteColor4; +struct ByteColor4; void NifStream( ByteColor4 & val, istream& in, const NifInfo & info); void NifStream( ByteColor4 const & val, ostream& out, const NifInfo & info); ostream & operator<<( ostream & out, ByteColor4 const & val ); diff --git a/include/niflib.h b/include/niflib.h index 6d596278b03c7d899df1029999d93c3d3ebdd6d1..6e45c1842ca1bcd472b7af88d02f08a9d1d42234 100644 --- a/include/niflib.h +++ b/include/niflib.h @@ -61,7 +61,7 @@ class NiObject; class NiNode; class NiAVObject; class NiControllerSequence; -class Header; +struct Header; #ifndef NULL #define NULL 0 /*!< Definition used to detect null pointers. */ diff --git a/src/ComplexShape.cpp b/src/ComplexShape.cpp index 307af656a1fe15a3a26ee4c398c195f1baa2b607..920172d5354ea83db31cbaccc949b8b9f75292b4 100644 --- a/src/ComplexShape.cpp +++ b/src/ComplexShape.cpp @@ -152,7 +152,7 @@ vector<int> ComplexShape::GetDismemberPartitionsFaces() const { void ComplexShape::SetDismemberPartitionsFaces(const vector<int>& value ) { dismemberPartitionsFaces.resize(value.size()); - for(int i = 0; i < dismemberPartitionsFaces.size(); i++) { + for(unsigned int i = 0; i < dismemberPartitionsFaces.size(); i++) { dismemberPartitionsFaces[i] = value[i]; } } @@ -552,11 +552,11 @@ void ComplexShape::Merge( NiAVObject * root ) { vector<BodyPartList> current_body_parts; vector<int> current_body_parts_faces; - for(int y = 0; y < dismember_skin->GetPartitions().size(); y++) { + for(unsigned int y = 0; y < dismember_skin->GetPartitions().size(); y++) { current_body_parts.push_back(dismember_skin->GetPartitions().at(y)); } - for(int y = 0; y < shapeTris.size(); y++) { + for(unsigned int y = 0; y < shapeTris.size(); y++) { current_body_parts_faces.push_back(0); } @@ -569,8 +569,8 @@ void ComplexShape::Merge( NiAVObject * root ) { has_vertex_map = true; } - for(int z = 0; z < partition_triangles.size(); z++) { - int w = faces.size() - shapeTris.size(); + for(unsigned int z = 0; z < partition_triangles.size(); z++) { + unsigned int w = faces.size() - shapeTris.size(); int merged_x; int merged_y; @@ -628,10 +628,10 @@ void ComplexShape::Merge( NiAVObject * root ) { } } - for(int y = 0; y < current_body_parts.size(); y++) { + for(unsigned int y = 0; y < current_body_parts.size(); y++) { int match_index = -1; - for(int z = 0; z < dismemberPartitionsBodyParts.size(); z++) { + for(unsigned int z = 0; z < dismemberPartitionsBodyParts.size(); z++) { if(dismemberPartitionsBodyParts[z].bodyPart == current_body_parts[y].bodyPart && dismemberPartitionsBodyParts[z].partFlag == current_body_parts[y].partFlag) { match_index = z; @@ -644,14 +644,14 @@ void ComplexShape::Merge( NiAVObject * root ) { match_index = dismemberPartitionsBodyParts.size() - 1; } - for(int z = 0; z < current_body_parts_faces.size(); z++) { + for(unsigned int z = 0; z < current_body_parts_faces.size(); z++) { if(current_body_parts_faces[z] == y) { current_body_parts_faces[z] = match_index; } } } - for(int x = 0; x < current_body_parts_faces.size(); x++) { + for(unsigned int x = 0; x < current_body_parts_faces.size(); x++) { dismemberPartitionsFaces.push_back(current_body_parts_faces[x]); } } @@ -904,16 +904,16 @@ Ref<NiAVObject> ComplexShape::Split( NiNode * parent, Matrix44 & transform, int //if no face points to a certain dismember partition then that dismember partition must be removed if(use_dismember_partitions == true) { vector<bool> used_dismember_groups(current_dismember_partitions.size(), false); - for(int x = 0; x < current_dismember_partitions_faces.size(); x++) { + for(unsigned int x = 0; x < current_dismember_partitions_faces.size(); x++) { if(used_dismember_groups[current_dismember_partitions_faces[x]] == false) { used_dismember_groups[current_dismember_partitions_faces[x]] = true; } } vector<BodyPartList> cleaned_up_dismember_partitions; - for(int x = 0; x < current_dismember_partitions.size(); x++) { + for(unsigned int x = 0; x < current_dismember_partitions.size(); x++) { if (used_dismember_groups[x] == false) { - for(int y = 0; y < current_dismember_partitions_faces.size(); y++) { + for(unsigned int y = 0; y < current_dismember_partitions_faces.size(); y++) { if(current_dismember_partitions_faces[y] > x) { current_dismember_partitions_faces[y]--; } @@ -1065,7 +1065,7 @@ Ref<NiAVObject> ComplexShape::Split( NiNode * parent, Matrix44 & transform, int if(use_dismember_partitions == true ) { int* face_map = new int[current_dismember_partitions_faces.size()]; - for(int x = 0; x < current_dismember_partitions_faces.size(); x++) { + for(unsigned int x = 0; x < current_dismember_partitions_faces.size(); x++) { face_map[x] = current_dismember_partitions_faces[x]; } shapes[ shape_num]->GenHardwareSkinInfo( max_bones_per_partition, 4, stripify, face_map); diff --git a/src/obj/BSDismemberSkinInstance.cpp b/src/obj/BSDismemberSkinInstance.cpp index 6b0f3483f7cae6d7d14e09df0892250530db1180..182cd7ed748d96edc22bb85489d1ee6c15ae36d5 100644 --- a/src/obj/BSDismemberSkinInstance.cpp +++ b/src/obj/BSDismemberSkinInstance.cpp @@ -128,7 +128,7 @@ vector<BodyPartList > BSDismemberSkinInstance::GetPartitions() const { void BSDismemberSkinInstance::SetPartitions( const vector<BodyPartList >& value ) { partitions.clear(); - for(int i = 0; i < value.size(); i++) { + for(unsigned int i = 0; i < value.size(); i++) { partitions.push_back(value[i]); } } diff --git a/src/obj/NiBSplineData.cpp b/src/obj/NiBSplineData.cpp index 9c41c520761020b8073971bf548afa18c1aa9a79..5923c446e263745dc5b2f8fe7143ea9ae4e6118f 100644 --- a/src/obj/NiBSplineData.cpp +++ b/src/obj/NiBSplineData.cpp @@ -152,7 +152,7 @@ void NiBSplineData::SetFloatControlPoints( vector<float> value ) this->floatControlPoints.clear(); this->numFloatControlPoints = value.size(); - for(int i = 0; i < value.size(); i++) { + for(unsigned int i = 0; i < value.size(); i++) { this->floatControlPoints.push_back(value[i]); } } @@ -161,7 +161,7 @@ void NiBSplineData::AppendFloatControlPoints( vector<float> value ) { this->numFloatControlPoints += value.size(); - for(int i = 0; i < value.size(); i++) { + for(unsigned int i = 0; i < value.size(); i++) { this->floatControlPoints.push_back(value[i]); } } @@ -192,7 +192,7 @@ void NiBSplineData::SetShortControlPoints( vector<short> value ) this->shortControlPoints.clear(); this->numShortControlPoints = value.size(); - for(int i = 0; i < value.size(); i++) { + for(unsigned int i = 0; i < value.size(); i++) { this->shortControlPoints.push_back(value[i]); } } @@ -201,7 +201,7 @@ void NiBSplineData::AppendShortControlPoints( vector<short> value ) { this->numShortControlPoints += value.size(); - for(int i = 0; i < value.size(); i++) { + for(unsigned int i = 0; i < value.size(); i++) { this->shortControlPoints.push_back(value[i]); } } diff --git a/src/obj/NiTriShapeData.cpp b/src/obj/NiTriShapeData.cpp index f9b538c29b919b45c3ce6befdfa777c7aab0c45d..57782cd739be4d7624a35cd73e85f36ca1cd787a 100644 --- a/src/obj/NiTriShapeData.cpp +++ b/src/obj/NiTriShapeData.cpp @@ -49,6 +49,7 @@ void NiTriShapeData::Read( istream& in, list<unsigned int> & link_stack, const N }; if ( info.version <= 0x0A000102 ) { triangles.resize(numTriangles); + hasTriangles = (triangles.size() > 0); for (unsigned int i2 = 0; i2 < triangles.size(); i2++) { NifStream( triangles[i2], in, info ); }; diff --git a/src/obj/bhkMoppBvTreeShape.cpp b/src/obj/bhkMoppBvTreeShape.cpp index ff98faaad97e55af3dd75c452ec480b9054fabaa..d56cae54b81f7c103392a47a62968d214de068d9 100644 --- a/src/obj/bhkMoppBvTreeShape.cpp +++ b/src/obj/bhkMoppBvTreeShape.cpp @@ -97,6 +97,9 @@ void bhkMoppBvTreeShape::Write( ostream& out, const map<NiObjectRef,unsigned int bhkBvTreeShape::Write( out, link_map, missing_link_stack, info ); moppDataSize = (unsigned int)(oldMoppData.size()); + if ( info.version >= 0x0A000102 ) { + moppDataSize = (unsigned int)(moppData.size()); + } if ( info.version < VER_3_3_0_13 ) { WritePtr32( &(*shape), out ); } else {