예제 #1
0
void GateAnimObject::UpdateDisplacements(const float dtime)
{
	m_angle += m_anglespeed * dtime;

    if ( m_pgate->m_d.m_twoWay )
    {
	    if (fabsf(m_angle) > m_angleMax)
	    {
            if ( m_angle<0.0f )
		        m_angle = -m_angleMax;
            else
                m_angle = m_angleMax;
		    m_pgate->FireVoidEventParm(DISPID_LimitEvents_EOS, fabsf(RADTOANG(m_anglespeed)));	// send EOS event
		    if (m_anglespeed > 0.0f)
			    m_anglespeed = 0.0f;
	    }
    }
    else
    {
        if (m_angle > m_angleMax)
        {
            m_angle = m_angleMax;
            m_pgate->FireVoidEventParm(DISPID_LimitEvents_EOS, fabsf(RADTOANG(m_anglespeed)));	// send EOS event
            if (m_anglespeed > 0.0f)
                m_anglespeed = 0.0f;
        }
        if (m_angle < m_angleMin)
        {
            m_angle = m_angleMin;
            m_pgate->FireVoidEventParm(DISPID_LimitEvents_BOS, fabsf(RADTOANG(m_anglespeed)));	// send Park event
            if (m_anglespeed < 0.0f)
                m_anglespeed = 0.0f;
        }
    }
}
예제 #2
0
void SpinnerAnimObject::UpdateDisplacements(const float dtime)
{
	if (m_pspinner->m_d.m_angleMin != m_pspinner->m_d.m_angleMax)	//blocked spinner, limited motion spinner
	{
		m_angle += m_anglespeed * dtime;

		if (m_angle > m_angleMax)
		{
			m_angle = m_angleMax;
			m_pspinner->FireVoidEventParm(DISPID_LimitEvents_EOS, fabsf(RADTOANG(m_anglespeed)));	// send EOS event

			if (m_anglespeed > 0)
				m_anglespeed *= -0.005f - m_elasticity;
		}
		if (m_angle < m_angleMin)
		{
			m_angle = m_angleMin;

			m_pspinner->FireVoidEventParm(DISPID_LimitEvents_BOS, fabsf(RADTOANG(m_anglespeed)));	// send Park event

			if (m_anglespeed < 0)
				m_anglespeed *= -0.005f - m_elasticity;
		}
	}
	else
	{
		const float target = (m_anglespeed > 0) ?
			((m_angle < (float)M_PI) ? (float)M_PI : (float)(3.0*M_PI))
			:
			((m_angle < (float)M_PI) ? (float)(-M_PI) : (float)M_PI);

		m_angle += m_anglespeed * dtime;

		if (m_anglespeed > 0)
		{
			if (m_angle > target) 
				m_pspinner->FireGroupEvent(DISPID_SpinnerEvents_Spin);
		}
		else
		{
			if (m_angle < target) 
				m_pspinner->FireGroupEvent(DISPID_SpinnerEvents_Spin);
		}

		while (m_angle > (float)(2.0*M_PI))
			m_angle -= (float)(2.0*M_PI);
		while (m_angle < 0.0f)
			m_angle += (float)(2.0*M_PI);
	}
}
예제 #3
0
파일: spinner.cpp 프로젝트: jsm174/vpinball
STDMETHODIMP Spinner::get_AngleMin(float *pVal)
{
   *pVal = (g_pplayer) ? RADTOANG(m_phitspinner->m_spinnerMover.m_angleMin) :	//player active value
      m_d.m_angleMin;

   return S_OK;
}
예제 #4
0
파일: spinner.cpp 프로젝트: jsm174/vpinball
STDMETHODIMP Spinner::get_CurrentAngle(float *pVal)
{
   if (m_phitspinner)
   {
      *pVal = RADTOANG(m_phitspinner->m_spinnerMover.m_angle);
      return S_OK;
   }
   else
      return E_FAIL;
}
예제 #5
0
STDMETHODIMP Flipper::get_CurrentAngle(float *pVal)
{
   if (m_phitflipper)
   {
      *pVal = RADTOANG(m_phitflipper->m_flipperanim.m_angleCur);
      return S_OK;
   }
   else
      return E_FAIL;
}
예제 #6
0
void GateMoverObject::UpdateDisplacements(const float dtime)
{
   if (m_pgate->m_d.m_twoWay)
   {
      if (fabsf(m_angle) > m_angleMax)
      {
         if (m_angle < 0.0f)
            m_angle = -m_angleMax;
         else
            m_angle = m_angleMax;
         m_pgate->FireVoidEventParm(DISPID_LimitEvents_EOS, fabsf(RADTOANG(m_anglespeed)));	// send EOS event
         if (!m_forcedMove)
         {
            m_anglespeed = -m_anglespeed;
            m_anglespeed *= m_damping * 0.8f; //just some extra damping to reduce the anglespeed a bit faster
         }
         else if (m_anglespeed>0.0f)
            m_anglespeed = 0.0f;
      }
      if (fabsf(m_angle) < m_angleMin)
      {
         if (m_angle < 0.0f)
            m_angle = -m_angleMin;
         else
            m_angle = m_angleMin;
         if (!m_forcedMove)
         {
            m_anglespeed = -m_anglespeed;
            m_anglespeed *= m_damping * 0.8f; //just some extra damping to reduce the anglespeed a bit faster
         }
         else if (m_anglespeed<0.0f)
            m_anglespeed = 0.0f;
      }
   }
   else
   {
      if (m_angle > m_angleMax)
      {
         m_angle = m_angleMax;
         m_pgate->FireVoidEventParm(DISPID_LimitEvents_EOS, fabsf(RADTOANG(m_anglespeed)));	// send EOS event
         if (!m_forcedMove)
         {
            m_anglespeed = -m_anglespeed;
            m_anglespeed *= m_damping * 0.8f; //just some extra damping to reduce the anglespeed a bit faster
         }
         else if (m_anglespeed > 0.0f)
            m_anglespeed = 0.0f;
      }
      if (m_angle < m_angleMin)
      {
         m_angle = m_angleMin;
         m_pgate->FireVoidEventParm(DISPID_LimitEvents_BOS, fabsf(RADTOANG(m_anglespeed)));	// send Park event
         if (!m_forcedMove)
         {
            m_anglespeed = -m_anglespeed;
            m_anglespeed *= m_damping * 0.8f; //just some extra damping to reduce the anglespeed a bit faster
         }
         else if (m_anglespeed<0.0f)
            m_anglespeed = 0.0f;
      }
   }
   m_angle += m_anglespeed * dtime;
}