diff --git a/src/states_screens/grand_prix_lose.cpp b/src/states_screens/grand_prix_lose.cpp index 0649d3b34..d91d8a553 100644 --- a/src/states_screens/grand_prix_lose.cpp +++ b/src/states_screens/grand_prix_lose.cpp @@ -23,6 +23,7 @@ #include "challenges/unlock_manager.hpp" #include "config/player_manager.hpp" #include "graphics/irr_driver.hpp" +#include "graphics/lod_node.hpp" #include "graphics/render_info.hpp" #include "guiengine/engine.hpp" #include "guiengine/scalable_font.hpp" @@ -185,7 +186,26 @@ void GrandPrixLose::setKarts(std::vector ident_arg) { KartModel* kart_model = kart->getKartModelCopy(KRT_DEFAULT); m_all_kart_models.push_back(kart_model); - scene::ISceneNode* kart_main_node = kart_model->attachModel(false, false); + scene::ISceneNode* kart_main_node = kart_model->attachModel(true, false); + LODNode* lnode = dynamic_cast(kart_main_node); + if (lnode) + { + // Lod node has to be animated + auto* a_node = static_cast + (lnode->getAllNodes()[0]); + const unsigned start_frame = + kart_model->getFrame(KartModel::AF_LOSE_LOOP_START) > -1 ? + kart_model->getFrame(KartModel::AF_LOSE_LOOP_START) : + kart_model->getFrame(KartModel::AF_LOSE_START) > -1 ? + kart_model->getFrame(KartModel::AF_LOSE_START) : + kart_model->getFrame(KartModel::AF_STRAIGHT); + const unsigned end_frame = + kart_model->getFrame(KartModel::AF_LOSE_END) > -1 ? + kart_model->getFrame(KartModel::AF_LOSE_END) : + kart_model->getFrame(KartModel::AF_STRAIGHT); + a_node->setLoopMode(true); + a_node->setFrameLoop(start_frame, end_frame); + } core::vector3df kart_pos(m_kart_x + n*DISTANCE_BETWEEN_KARTS, m_kart_y, diff --git a/src/states_screens/grand_prix_win.cpp b/src/states_screens/grand_prix_win.cpp index 30e9bca59..5e18f33fa 100644 --- a/src/states_screens/grand_prix_win.cpp +++ b/src/states_screens/grand_prix_win.cpp @@ -23,6 +23,7 @@ #include "challenges/unlock_manager.hpp" #include "config/player_manager.hpp" #include "graphics/irr_driver.hpp" +#include "graphics/lod_node.hpp" #include "graphics/render_info.hpp" #include "guiengine/engine.hpp" #include "guiengine/scalable_font.hpp" @@ -346,7 +347,26 @@ void GrandPrixWin::setKarts(const std::string idents_arg[3]) KartModel* kart_model = kp->getKartModelCopy(KRT_DEFAULT); m_all_kart_models.push_back(kart_model); - scene::ISceneNode* kart_main_node = kart_model->attachModel(false, false); + scene::ISceneNode* kart_main_node = kart_model->attachModel(true, false); + LODNode* lnode = dynamic_cast(kart_main_node); + if (lnode) + { + // Lod node has to be animated + auto* a_node = static_cast + (lnode->getAllNodes()[0]); + const unsigned start_frame = + kart_model->getFrame(KartModel::AF_WIN_LOOP_START) > -1 ? + kart_model->getFrame(KartModel::AF_WIN_LOOP_START) : + kart_model->getFrame(KartModel::AF_WIN_START) > -1 ? + kart_model->getFrame(KartModel::AF_WIN_START) : + kart_model->getFrame(KartModel::AF_STRAIGHT); + const unsigned end_frame = + kart_model->getFrame(KartModel::AF_WIN_END) > -1 ? + kart_model->getFrame(KartModel::AF_WIN_END) : + kart_model->getFrame(KartModel::AF_STRAIGHT); + a_node->setLoopMode(true); + a_node->setFrameLoop(start_frame, end_frame); + } m_kart_x[i] = KARTS_INITIAL_X[i]; m_kart_y[i] = KARTS_INITIAL_Y[i];