From feefff8997a3d2672f29179d0343a10660f288dd Mon Sep 17 00:00:00 2001 From: auria Date: Wed, 3 Mar 2010 19:00:36 +0000 Subject: [PATCH] Fixed slight shaking in end-of-GP scene git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4917 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/states_screens/grand_prix_over.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/states_screens/grand_prix_over.cpp b/src/states_screens/grand_prix_over.cpp index 6d280ade7..2b88e00e6 100644 --- a/src/states_screens/grand_prix_over.cpp +++ b/src/states_screens/grand_prix_over.cpp @@ -175,14 +175,18 @@ void GrandPrixOver::onUpdate(float dt, irr::video::IVideoDriver* driver) if (fabsf(m_kart_z[k] - m_podium_z[k]) > dt) { - if (m_kart_z[k] < m_podium_z[k]) + if (m_kart_z[k] < m_podium_z[k] - dt) { m_kart_z[k] += dt; } - else if (m_kart_z[k] > m_podium_z[k]) + else if (m_kart_z[k] > m_podium_z[k] + dt) { m_kart_z[k] -= dt; } + else + { + m_kart_z[k] = m_podium_z[k]; + } karts_not_yet_done++; } @@ -242,14 +246,15 @@ void GrandPrixOver::onUpdate(float dt, irr::video::IVideoDriver* driver) if (m_phase > 1) { //m_camera_x = 3.0f; - if (m_camera_z < -2.0f) m_camera_z += dt*0.2f; - if (m_camera_x < m_podium_x[1]) m_camera_x += dt*0.1f; - else if (m_camera_x > m_podium_x[1]) m_camera_x -= dt*0.1f; - - if (m_camera_target_x < m_podium_x[1]) m_camera_target_x += dt*0.1f; + if (m_camera_z < -2.0f) m_camera_z += dt*0.2f; - if (m_camera_y > -1.8f) m_camera_y -= dt*0.1f; - //else if (m_camera_y < -3.0f) m_camera_y += dt*0.1f; + if (m_camera_x < m_podium_x[1] - dt*0.1f) m_camera_x += dt*0.1f; + else if (m_camera_x > m_podium_x[1] + dt*0.1f) m_camera_x -= dt*0.1f; + else m_camera_x = m_podium_x[1]; + + if (m_camera_target_x < m_podium_x[1]) m_camera_target_x += dt*0.1f; + + if (m_camera_y > -1.8f) m_camera_y -= dt*0.1f; m_camera->setTarget( core::vector3df(m_camera_target_x, -2.0f, m_camera_target_z) );