diff --git a/stepmania/src/Model.cpp b/stepmania/src/Model.cpp index 7b38281e3f..792492b1f1 100644 --- a/stepmania/src/Model.cpp +++ b/stepmania/src/Model.cpp @@ -99,7 +99,9 @@ void Model::LoadPieces( CString sMeshesPath, CString sMaterialsPath, CString sBo LoadMaterialsFromMilkshapeAscii( sMaterialsPath ); - LoadMilkshapeAsciiBones( DEFAULT_ANIMATION_NAME, sBonesPath ); + if( LoadMilkshapeAsciiBones( DEFAULT_ANIMATION_NAME, sBonesPath ) ) + PlayAnimation( DEFAULT_ANIMATION_NAME ); + // // Setup temp vertices (if necessary) @@ -263,7 +265,7 @@ void Model::LoadMaterialsFromMilkshapeAscii( CString sPath ) f.Close(); } -void Model::LoadMilkshapeAsciiBones( CString sAniName, CString sPath ) +bool Model::LoadMilkshapeAsciiBones( CString sAniName, CString sPath ) { FixSlashesInPlace(sPath); const CString sDir = Dirname( sPath ); @@ -275,6 +277,7 @@ void Model::LoadMilkshapeAsciiBones( CString sAniName, CString sPath ) CString sLine; int iLineNum = 0; + bool bLoaded = false; while( f.GetLine( sLine ) > 0 ) { iLineNum++; @@ -394,9 +397,9 @@ void Model::LoadMilkshapeAsciiBones( CString sAniName, CString sPath ) for( unsigned j = 0; j < Bone.RotationKeys.size(); ++j ) Animation.nTotalFrames = max( Animation.nTotalFrames, (int)Bone.RotationKeys[j].fTime ); } - - PlayAnimation( sAniName ); } + + return bLoaded; } bool Model::EarlyAbortDraw() diff --git a/stepmania/src/Model.h b/stepmania/src/Model.h index cc0ce925fd..a4d13ce96a 100644 --- a/stepmania/src/Model.h +++ b/stepmania/src/Model.h @@ -24,7 +24,7 @@ public: void LoadFromModelFile( CString sFile ); void LoadMilkshapeAscii( CString sFile ); void LoadMaterialsFromMilkshapeAscii( CString sPath ); - void LoadMilkshapeAsciiBones( CString sAniName, CString sPath ); + bool LoadMilkshapeAsciiBones( CString sAniName, CString sPath ); void PlayAnimation( CString sAniName, float fPlayRate = 1 ); virtual void Update( float fDelta ); @@ -57,9 +57,13 @@ private: // If any vertex has a bone weight, then then render from m_pTempGeometry. // Otherwise, render directly from m_pGeometry. - vector m_vTempMeshes; RageCompiledGeometry* m_pTempGeometry; + /* Keep a copy of the mesh data only if m_pTempGeometry is in use. The normal and + * position data will be changed; the rest is static and kept only to prevent making + * a complete copy. */ + vector m_vTempMeshes; + void DrawMesh( int i ) const; float m_fCurFrame;