Fixed model flickering, which was also making the BH miss steps when it was trying to restart the default animation.

This commit is contained in:
Kevin Slaughter
2003-08-28 06:36:33 +00:00
parent 2dc4815f04
commit b170ddaf5f
2 changed files with 10 additions and 4 deletions
+7 -2
View File
@@ -598,6 +598,7 @@ bool Model::LoadMilkshapeAsciiBones( CString sAniName, CString sPath )
} }
PlayAnimation( sAniName ); PlayAnimation( sAniName );
m_sMostRecentAnimation = sAniName;
} }
} }
@@ -685,6 +686,9 @@ void Model::DrawPrimitives()
void Model::SetDefaultAnimation( CString sAnimation ) void Model::SetDefaultAnimation( CString sAnimation )
{ {
m_sDefaultAnimation = 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 ) void Model::PlayAnimation( CString sAniName )
@@ -696,6 +700,7 @@ void Model::PlayAnimation( CString sAniName )
pNewAnimation = &m_mapNameToAnimation[sAniName]; pNewAnimation = &m_mapNameToAnimation[sAniName];
m_fCurrFrame = 0; m_fCurrFrame = 0;
m_sMostRecentAnimation = sAniName;
if ( m_pCurAnimation == pNewAnimation ) if ( m_pCurAnimation == pNewAnimation )
return; return;
@@ -768,9 +773,9 @@ Model::AdvanceFrame (float dt)
return; // bail early return; // bail early
m_fCurrFrame += FRAMES_PER_SECOND * dt; 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 ); this->PlayAnimation( m_sDefaultAnimation );
m_fCurrFrame = 0.0f; m_fCurrFrame = 0.0f;
+3 -2
View File
@@ -75,8 +75,9 @@ private:
myBone_t *m_pBones; myBone_t *m_pBones;
typedef vector<RageModelVertex> RageModelVertexVector; typedef vector<RageModelVertex> RageModelVertexVector;
vector<RageModelVertexVector> m_vTempVerticesByBone; vector<RageModelVertexVector> m_vTempVerticesByBone;
float m_fCurrFrame; float m_fCurrFrame;
CString m_sDefaultAnimation; CString m_sDefaultAnimation;
CString m_sMostRecentAnimation;
}; };