BGE Animations: Fixing the Continue option when using the Flipper play type. Also removing a couple of debug prints.

This commit is contained in:
Mitchell Stokes 2011-08-09 03:06:22 +00:00
parent cbec4e2768
commit 88786f6fca
2 changed files with 12 additions and 7 deletions

@ -174,8 +174,10 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
start = end = prop->GetNumber(); start = end = prop->GetNumber();
} }
// Continue only really makes sense for play stop. All other modes go until they are complete. // 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) if (m_flag & ACT_FLAG_CONTINUE &&
(m_playtype == ACT_ACTION_LOOP_STOP ||
m_playtype == ACT_ACTION_FLIPPER))
use_continue = true; use_continue = true;
@ -189,6 +191,9 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
if (bPositiveEvent) 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)) 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; m_flag |= ACT_FLAG_ACTIVE;
@ -215,11 +220,13 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
return false; 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) 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 obj->StopAction(m_layer); // Stop the action after getting the frame
// We're done // We're done

@ -252,9 +252,7 @@ void BL_Action::ResetStartTime(float curtime)
float dt = m_localtime - m_startframe; float dt = m_localtime - m_startframe;
m_starttime = curtime - dt / (KX_KetsjiEngine::GetAnimFrameRate()*m_speed); m_starttime = curtime - dt / (KX_KetsjiEngine::GetAnimFrameRate()*m_speed);
printf("Before: %f, ", m_localtime);
SetLocalTime(curtime); SetLocalTime(curtime);
printf("After: %f\n", m_localtime);
} }
void BL_Action::IncrementBlending(float curtime) void BL_Action::IncrementBlending(float curtime)