BGE Animations: Fixing the Continue option when using the Flipper play type. Also...
authorMitchell Stokes <mogurijin@gmail.com>
Tue, 9 Aug 2011 03:06:22 +0000 (03:06 +0000)
committerMitchell Stokes <mogurijin@gmail.com>
Tue, 9 Aug 2011 03:06:22 +0000 (03:06 +0000)
source/gameengine/Converter/BL_ActionActuator.cpp
source/gameengine/Ketsji/BL_Action.cpp

index 8efcdd8c551e89c6610f130bd0707cdb0ac51ffa..4e4d838d8ff467bbfb1cc8ce44d4fc74ae799d6e 100644 (file)
@@ -174,8 +174,10 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
                start = end = prop->GetNumber();
        }
 
-       // Continue only really makes sense for play stop. All other modes go until they are complete.
-       if (m_flag & ACT_FLAG_CONTINUE && m_playtype == ACT_ACTION_LOOP_STOP)
+       // Continue only really makes sense for play stop and flipper. All other modes go until they are complete.
+       if (m_flag & ACT_FLAG_CONTINUE &&
+               (m_playtype == ACT_ACTION_LOOP_STOP ||
+               m_playtype == ACT_ACTION_FLIPPER))
                use_continue = true;
        
        
@@ -189,6 +191,9 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
        
        if (bPositiveEvent)
        {
+               if (use_continue && m_flag & ACT_FLAG_ACTIVE)
+                       start = m_localtime = obj->GetActionFrame(m_layer);
+
                if (obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, m_blendin, play_mode, m_layer_weight, m_ipo_flags))
                {
                        m_flag |= ACT_FLAG_ACTIVE;
@@ -215,11 +220,13 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
                        return false;
                }
 
+               
+               m_localtime = obj->GetActionFrame(m_layer);
+               if (m_localtime < min(m_startframe, m_endframe) || m_localtime > max(m_startframe, m_endframe))
+                       m_localtime = m_startframe;
+
                if (m_playtype == ACT_ACTION_LOOP_STOP)
                {
-                       m_localtime = obj->GetActionFrame(m_layer);
-                       if (m_localtime < min(m_startframe, m_endframe) || m_localtime > max(m_startframe, m_endframe))
-                               m_localtime = m_startframe;
                        obj->StopAction(m_layer); // Stop the action after getting the frame
 
                        // We're done
index 4cf6f9820064b0976d2a014db455b39fb6d1c507..6682b0cea41dcef749c9765136890ae06b7af252 100644 (file)
@@ -252,9 +252,7 @@ void BL_Action::ResetStartTime(float curtime)
        float dt = m_localtime - m_startframe;
 
        m_starttime = curtime - dt / (KX_KetsjiEngine::GetAnimFrameRate()*m_speed);
-       printf("Before: %f, ", m_localtime);
        SetLocalTime(curtime);
-       printf("After: %f\n", m_localtime);
 }
 
 void BL_Action::IncrementBlending(float curtime)