Fix for [#32054] "Animation break after resuming scene" reported by Andreas Esau...
authorMitchell Stokes <mogurijin@gmail.com>
Mon, 6 Aug 2012 00:53:26 +0000 (00:53 +0000)
committerMitchell Stokes <mogurijin@gmail.com>
Mon, 6 Aug 2012 00:53:26 +0000 (00:53 +0000)
source/gameengine/Ketsji/BL_Action.cpp

index fbeb34b70b4969292982faafa253fd8181d89c50..a21c3965be938ec4e58a9f8d0c7c70edffa3329f 100644 (file)
@@ -206,7 +206,7 @@ bool BL_Action::Play(const char* name,
        }
 
        // Now that we have an action, we have something we can play
-       m_starttime = KX_GetActiveEngine()->GetFrameTime();
+       m_starttime = -1.f; // We get the start time on our first update
        m_startframe = m_localtime = start;
        m_endframe = end;
        m_blendin = blendin;
@@ -338,6 +338,11 @@ void BL_Action::Update(float curtime)
 
        curtime -= KX_KetsjiEngine::GetSuspendedDelta();
 
+       // Grab the start time here so we don't end up with a negative m_localtime when
+       // suspending and resuming scenes.
+       if (m_starttime < 0)
+               m_starttime = curtime;
+
        if (m_calc_localtime)
                SetLocalTime(curtime);
        else