diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-02-16 02:12:03 +0300 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-02-16 02:12:03 +0300 |
commit | 13aa413361bf75c89b7c878f7720373cf464c9d8 (patch) | |
tree | e2e054e51ad887304f7771e6a7656b669a32c434 /source/gameengine/Ketsji/KX_IpoActuator.cpp | |
parent | 1597ba07705fbe39c219f1f99b5c92e9b06b8f0c (diff) |
patch 8235 8218 8211 added: various gameengine improvements, fixed windows project files
Diffstat (limited to 'source/gameengine/Ketsji/KX_IpoActuator.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_IpoActuator.cpp | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp index e7f1dea7bbf..287634fc7ec 100644 --- a/source/gameengine/Ketsji/KX_IpoActuator.cpp +++ b/source/gameengine/Ketsji/KX_IpoActuator.cpp @@ -211,12 +211,6 @@ bool KX_IpoActuator::Update(double curtime, bool frame) (*i)->Release(); } m_events.clear(); - - if (m_type != KX_ACT_IPO_PLAY) - { - if (bNegativeEvent) - RemoveAllEvents(); - } } double start_smaller_then_end = ( m_startframe < m_endframe ? 1.0 : -1.0); @@ -226,6 +220,7 @@ bool KX_IpoActuator::Update(double curtime, bool frame) { if (m_starttime < -2.0*start_smaller_then_end*(m_endframe - m_startframe)) { + // start for all Ipo, initial start for LOOP_STOP m_starttime = curtime - KX_KetsjiEngine::GetSuspendedDelta(); m_bIpoPlaying = true; } @@ -238,17 +233,10 @@ bool KX_IpoActuator::Update(double curtime, bool frame) { // Check if playing forwards. result = ! finished - if (!bNegativeEvent) - { - if (start_smaller_then_end > 0.0) - result = (m_localtime < m_endframe && !(m_localtime == m_startframe && bNegativeEvent)); - else - result = (m_localtime > m_endframe && !(m_localtime == m_startframe && bNegativeEvent)); - } + if (start_smaller_then_end > 0.0) + result = (m_localtime < m_endframe && m_bIpoPlaying); else - { - result = (m_bIpoPlaying && (m_localtime < m_endframe)); - } + result = (m_localtime > m_endframe && m_bIpoPlaying); if (result) { @@ -267,7 +255,6 @@ bool KX_IpoActuator::Update(double curtime, bool frame) } else { m_localtime=m_startframe; - SetStartTime(curtime); m_direction=1; } break; @@ -275,7 +262,7 @@ bool KX_IpoActuator::Update(double curtime, bool frame) case KX_ACT_IPO_PINGPONG: { result = true; - if (bNegativeEvent && ((m_localtime == m_startframe )|| (m_localtime == m_endframe))) + if (bNegativeEvent && !m_bIpoPlaying) result = false; else SetLocalTime(curtime); @@ -297,14 +284,18 @@ bool KX_IpoActuator::Update(double curtime, bool frame) } case KX_ACT_IPO_FLIPPER: { - result = !(bNegativeEvent && (m_localtime == m_startframe)); + if (bNegativeEvent && !m_bIpoPlaying) + result = false; if (numevents) { + float oldDirection = m_direction; if (bNegativeEvent) m_direction = -1; else m_direction = 1; - SetStartTime(curtime); + if (m_direction != oldDirection) + // changing direction, reset start time + SetStartTime(curtime); } SetLocalTime(curtime); @@ -332,18 +323,26 @@ bool KX_IpoActuator::Update(double curtime, bool frame) m_bNegativeEvent = false; numevents = 0; } - SetStartTime(curtime); + if (!m_bIpoPlaying) + { + // Ipo was stopped, make sure we will restart from where it stopped + SetStartTime(curtime); + if (!bNegativeEvent) + // positive signal will restart the Ipo + m_bIpoPlaying = true; + } + } // fall through to loopend, and quit the ipo animation immediatly } case KX_ACT_IPO_LOOPEND: { if (numevents){ - if (bNegativeEvent){ + if (bNegativeEvent && m_bIpoPlaying){ m_bNegativeEvent = true; } } - if (bNegativeEvent && m_localtime == m_startframe){ + if (bNegativeEvent && !m_bIpoPlaying){ result = false; } else @@ -414,8 +413,12 @@ bool KX_IpoActuator::Update(double curtime, bool frame) result = false; } - if (!result && m_type != KX_ACT_IPO_LOOPSTOP) - m_starttime = -2.0*start_smaller_then_end*(m_endframe - m_startframe) - 1.0; + if (!result) + { + if (m_type != KX_ACT_IPO_LOOPSTOP) + m_starttime = -2.0*start_smaller_then_end*(m_endframe - m_startframe) - 1.0; + m_bIpoPlaying = false; + } return result; } |