bugfix for an incompatibility with ipo actuator in play mode, thanks Malachy for the fix.

This commit is contained in:
Erwin Coumans 2007-01-21 00:56:10 +00:00
parent 1ac4b1d5c3
commit 3917b1af5f
2 changed files with 28 additions and 9 deletions

@ -119,6 +119,7 @@ KX_IpoActuator::KX_IpoActuator(SCA_IObject* gameobj,
m_type((IpoActType)acttype) m_type((IpoActType)acttype)
{ {
m_starttime = -2.0*fabs(m_endframe - m_startframe) - 1.0; m_starttime = -2.0*fabs(m_endframe - m_startframe) - 1.0;
m_bIpoPlaying = false;
} }
void KX_IpoActuator::SetStart(float starttime) void KX_IpoActuator::SetStart(float starttime)
@ -211,15 +212,24 @@ bool KX_IpoActuator::Update(double curtime, bool frame)
} }
m_events.clear(); m_events.clear();
if (bNegativeEvent) if (m_type != KX_ACT_IPO_PLAY)
RemoveAllEvents(); {
if (bNegativeEvent)
RemoveAllEvents();
}
} }
double start_smaller_then_end = ( m_startframe < m_endframe ? 1.0 : -1.0); double start_smaller_then_end = ( m_startframe < m_endframe ? 1.0 : -1.0);
bool result=true; bool result=true;
if (m_starttime < -2.0*start_smaller_then_end*(m_endframe - m_startframe)) if (!bNegativeEvent)
m_starttime = curtime - KX_KetsjiEngine::GetSuspendedDelta(); {
if (m_starttime < -2.0*start_smaller_then_end*(m_endframe - m_startframe))
{
m_starttime = curtime - KX_KetsjiEngine::GetSuspendedDelta();
m_bIpoPlaying = true;
}
}
switch (m_type) switch (m_type)
{ {
@ -227,11 +237,18 @@ bool KX_IpoActuator::Update(double curtime, bool frame)
case KX_ACT_IPO_PLAY: case KX_ACT_IPO_PLAY:
{ {
// Check if playing forwards. result = ! finished // Check if playing forwards. result = ! finished
bNegativeEvent = false; // quick fix for message IPO issue
if (start_smaller_then_end > 0.0) if (!bNegativeEvent)
result = (m_localtime < m_endframe && !(m_localtime == m_startframe && 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));
}
else else
result = (m_localtime > m_endframe && !(m_localtime == m_startframe && bNegativeEvent)); {
result = (m_bIpoPlaying && (m_localtime < m_endframe));
}
if (result) if (result)
{ {

@ -81,6 +81,8 @@ protected:
/** Apply a force-ipo locally? */ /** Apply a force-ipo locally? */
bool m_force_ipo_local; bool m_force_ipo_local;
bool m_bIpoPlaying;
public: public:
enum IpoActType enum IpoActType
{ {