diff --git a/NIF_Blocks.cpp b/NIF_Blocks.cpp index 504d275fc616ae644d0aa74e4f8bb95ab909a44d..077086e87f371548ab8eed8a70834ccb5e5aad02 100644 --- a/NIF_Blocks.cpp +++ b/NIF_Blocks.cpp @@ -1265,7 +1265,7 @@ void AShapeData::Read( istream& in, unsigned int version ){ } /// numTexSets up here up from version 10.0.1.0 on along with an unknown byte - short numTexSets; + ushort numTexSets; bool hasUnknown; if ( version >= VER_10_0_1_0 ) { numTexSets = ReadByte( in ); @@ -2044,7 +2044,7 @@ string NiParticleMeshesData::asString() const { void NiTriShapeData::Read( istream& in, unsigned int version ){ AShapeData::Read( in, version ); - short numTriangles = ReadUShort( in ); + ushort numTriangles = ReadUShort( in ); ReadUInt( in ); // numTriangles * 3, we can throw this away //From version 10.1.0.0 on there is a bool to check whether or not there are any triangles @@ -2063,10 +2063,10 @@ void NiTriShapeData::Read( istream& in, unsigned int version ){ triangles[i].v3 = ReadUShort( in ); } - short matchGroupCount = ReadUShort( in ); + ushort matchGroupCount = ReadUShort( in ); match_group_mode = ( matchGroupCount != 0 ); // Only record whether or not file prefers to have match data generated - short sub_count; + ushort sub_count; for ( int i = 0; i < matchGroupCount; ++i ){ sub_count = ReadUShort( in ); for (ushort j = 0; j < sub_count; ++j) { @@ -2191,10 +2191,10 @@ void NiTriStripsData::Read( istream& in, unsigned int version ){ ReadUShort( in ); //Initialize vectors to number and size of strips - short numStrips = ReadUShort( in ); + ushort numStrips = ReadUShort( in ); strips.resize( numStrips ); for ( uint i = 0; i < strips.size(); ++i ) { - short stripSize = ReadUShort( in ); + ushort stripSize = ReadUShort( in ); strips[i].resize( stripSize ); } @@ -4620,21 +4620,25 @@ void NiPixelData::SetColors( const vector<Color4> & new_pixels, bool generate_mi void NiPosData::Read( istream& file, unsigned int version ) { uint keyCount = ReadUInt( file ); - NifStream( _type, file ); + if ( keyCount > 0 ) { + NifStream( _type, file ); - _keys.resize( keyCount ); - for (uint i = 0; i < _keys.size(); i++) { - NifStream( _keys[i], file, _type ); + _keys.resize( keyCount ); + for (uint i = 0; i < _keys.size(); i++) { + NifStream( _keys[i], file, _type ); + } } } void NiPosData::Write( ostream& file, unsigned int version ) const { WriteUInt( uint(_keys.size()), file ); - NifStream( _type, file ); + if ( _keys.size() > 0 ) { + NifStream( _type, file ); - for (uint i = 0; i < _keys.size(); i++) { - NifStream( _keys[i], file, _type ); - } + for (uint i = 0; i < _keys.size(); i++) { + NifStream( _keys[i], file, _type ); + } +} } string NiPosData::asString() const { diff --git a/docsys_extract.cpp b/docsys_extract.cpp index e9b108769c4b791be02b1348de0e213e0a4d2bdc..72e4dc5a90882a76ffbb6aa044229a53d86ec1ba 100644 --- a/docsys_extract.cpp +++ b/docsys_extract.cpp @@ -384,7 +384,9 @@ NiKeyframeController::NiKeyframeController() { } NiLightColorController::NiLightColorController() { - AddAttr( attr_link, "Interpolator", 0, 0xFFFFFFFF ); + AddAttr( attr_short, "Unknown Short", 167837696, 167837696 ); + AddAttr( attr_link, "Data", 0, 167837696 ); + AddAttr( attr_link, "Interpolator", 167903232, 0xFFFFFFFF ); AddAttr( attr_short, "Unknown Short", 167903232, 0xFFFFFFFF ); Init(); } @@ -523,6 +525,7 @@ NiPlanarCollider::NiPlanarCollider() { AddAttr( attr_short, "Unknown Short", 167772416, 0xFFFFFFFF ); AddAttr( attr_float, "Unknown Float 1", 0, 0xFFFFFFFF ); AddAttr( attr_float, "Unknown Float 2", 0, 0xFFFFFFFF ); + AddAttr( attr_short, "Unknown Short 2", 67240448, 67240448 ); AddAttr( attr_float, "Unknown Float 3", 0, 0xFFFFFFFF ); AddAttr( attr_float, "Unknown Float 4", 0, 0xFFFFFFFF ); AddAttr( attr_float, "Unknown Float 5", 0, 0xFFFFFFFF ); diff --git a/nif_attrs.h b/nif_attrs.h index ef33e96968c742cc429c89adb605ea1f67c4b36e..a8a9af40a202b9671f791a3a62cc8df977f0ddff 100644 --- a/nif_attrs.h +++ b/nif_attrs.h @@ -761,17 +761,17 @@ public: //The only difference is that there is a boolean before this link group bool has_links = ReadBool( in, version ); - if ( has_links || version >= VER_10_2_0_0 ) { + //if ( has_links || version >= VER_10_2_0_0 ) { LinkGroupAttr::ReadAttr( in, version ); - } + //} } void WriteAttr( ostream& out, unsigned int version ) const { //The only difference is that there is a boolean before this link group WriteBool( (links.size() > 0), out, version ); - if ( links.size() > 0 || version >= VER_10_2_0_0) { + //if ( links.size() > 0 || version >= VER_10_2_0_0) { LinkGroupAttr::WriteAttr( out, version ); - } + //} } };