From b170ddaf5f957c1c722d47ac1165691daf21805a Mon Sep 17 00:00:00 2001 From: Kevin Slaughter Date: Thu, 28 Aug 2003 06:36:33 +0000 Subject: [PATCH] Fixed model flickering, which was also making the BH miss steps when it was trying to restart the default animation. --- stepmania/src/Model.cpp | 9 +++++++-- stepmania/src/Model.h | 5 +++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/stepmania/src/Model.cpp b/stepmania/src/Model.cpp index 1894f431ec..48c9450f99 100644 --- a/stepmania/src/Model.cpp +++ b/stepmania/src/Model.cpp @@ -598,6 +598,7 @@ bool Model::LoadMilkshapeAsciiBones( CString sAniName, CString sPath ) } PlayAnimation( sAniName ); + m_sMostRecentAnimation = sAniName; } } @@ -685,6 +686,9 @@ void Model::DrawPrimitives() void Model::SetDefaultAnimation( CString sAnimation ) { m_sDefaultAnimation = sAnimation; + m_sMostRecentAnimation = ""; // Clear this out so if we set a different default + // while the current default is playing, it will + // change to the new one when the current ends. } void Model::PlayAnimation( CString sAniName ) @@ -696,6 +700,7 @@ void Model::PlayAnimation( CString sAniName ) pNewAnimation = &m_mapNameToAnimation[sAniName]; m_fCurrFrame = 0; + m_sMostRecentAnimation = sAniName; if ( m_pCurAnimation == pNewAnimation ) return; @@ -768,9 +773,9 @@ Model::AdvanceFrame (float dt) return; // bail early m_fCurrFrame += FRAMES_PER_SECOND * dt; - if (m_fCurrFrame >= (float) m_pCurAnimation->nTotalFrames) + if (m_fCurrFrame >= (float)m_pCurAnimation->nTotalFrames) { - if( (m_bRevertToDefaultAnimation) && (m_sDefaultAnimation != "") ) + if( (m_bRevertToDefaultAnimation) && (m_sDefaultAnimation != "") && (m_sDefaultAnimation != m_sMostRecentAnimation) ) { this->PlayAnimation( m_sDefaultAnimation ); m_fCurrFrame = 0.0f; diff --git a/stepmania/src/Model.h b/stepmania/src/Model.h index e33a0e7b6e..c23a4655c6 100644 --- a/stepmania/src/Model.h +++ b/stepmania/src/Model.h @@ -75,8 +75,9 @@ private: myBone_t *m_pBones; typedef vector RageModelVertexVector; vector m_vTempVerticesByBone; - float m_fCurrFrame; - CString m_sDefaultAnimation; + float m_fCurrFrame; + CString m_sDefaultAnimation; + CString m_sMostRecentAnimation; };