Fix #2687, reset cameras properly

This commit is contained in:
auria.mg 2016-12-16 21:03:05 -05:00
parent fc9a51b7f4
commit 488af78fa3
2 changed files with 22 additions and 3 deletions

View File

@ -23,6 +23,7 @@
#include "graphics/camera.hpp"
#include "items/powerup_manager.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/controller/controller.hpp"
#include "states_screens/race_gui_base.hpp"
#include "tracks/track.hpp"
#include "utils/translation.hpp"
@ -83,7 +84,20 @@ void FollowTheLeaderRace::reset()
stk_config->m_leader_time_per_kart*race_manager->getNumberOfKarts();
WorldStatus::setClockMode(WorldStatus::CLOCK_COUNTDOWN,
m_leader_intervals[0]);
const unsigned int kart_amount = (unsigned int)m_karts.size();
int idCamera = 0;
for (unsigned int n = 1; n < kart_amount; n++)
{
if (m_karts[n]->getController()->isPlayerController())
{
Camera *camera = Camera::getCamera(idCamera);
camera->setMode(Camera::CM_NORMAL);
camera->setKart(getKart(n));
idCamera++;
}
}
m_is_over_delay = 2.0f;
} // reset

View File

@ -102,6 +102,7 @@ void ThreeStrikesBattle::reset()
const unsigned int kart_amount = (unsigned int)m_karts.size();
int idCamera = 0;
for(unsigned int n=0; n<kart_amount; n++)
{
if (dynamic_cast<SpareTireAI*>(m_karts[n]->getController()) != NULL)
@ -117,8 +118,12 @@ void ThreeStrikesBattle::reset()
// no positions in this mode
m_karts[n]->setPosition(-1);
Camera *camera = Camera::getCamera(n);
camera->setKart(m_karts[n]);
if (m_karts[n]->getController()->isPlayerController())
{
Camera *camera = Camera::getCamera(idCamera);
camera->setKart(m_karts[n]);
idCamera++;
}
scene::ISceneNode* kart_node = m_karts[n]->getNode();