From 9ba0c7f137800642c7a18d0572e907d8702b8d50 Mon Sep 17 00:00:00 2001 From: auria Date: Sat, 2 Jun 2012 22:35:09 +0000 Subject: [PATCH] More work to make cutscenes work git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11272 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/config/stk_config.cpp | 2 ++ src/graphics/irr_driver.cpp | 10 ++++++++-- src/modes/cutscene_world.cpp | 6 +++++- src/modes/cutscene_world.hpp | 3 +++ src/race/race_manager.hpp | 1 + 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/config/stk_config.cpp b/src/config/stk_config.cpp index 6a14be78a..cd66b9466 100644 --- a/src/config/stk_config.cpp +++ b/src/config/stk_config.cpp @@ -376,6 +376,8 @@ void STKConfig::getAllData(const XMLNode * root) */ void STKConfig::getAllScores(std::vector *all_scores, int num_karts) { + if (num_karts == 0) return; + assert(num_karts <= m_max_karts); all_scores->resize(num_karts); (*all_scores)[num_karts-1] = 1; // last position gets one point diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp index 35e890149..5d05d543b 100644 --- a/src/graphics/irr_driver.cpp +++ b/src/graphics/irr_driver.cpp @@ -1382,8 +1382,7 @@ void IrrDriver::update(float dt) new ConfirmResolutionDialog(); m_resolution_changing = RES_CHANGE_NONE; } - - + if (!m_device->run()) { main_loop->abort(); @@ -1444,6 +1443,13 @@ void IrrDriver::update(float dt) RaceGUIBase *rg = world->getRaceGUI(); if (rg) rg->update(dt); + + // No kart, this must be a cutscene + if (world->getNumKarts() == 0) + { + m_scene_manager->drawAll(); + } + for(unsigned int i=0; igetNumKarts(); i++) { AbstractKart *kart=world->getKart(i); diff --git a/src/modes/cutscene_world.cpp b/src/modes/cutscene_world.cpp index 92592df10..c3f787932 100644 --- a/src/modes/cutscene_world.cpp +++ b/src/modes/cutscene_world.cpp @@ -19,6 +19,7 @@ #include #include +#include #include "audio/music_manager.hpp" #include "graphics/irr_driver.hpp" @@ -48,6 +49,9 @@ CutsceneWorld::CutsceneWorld() : World() void CutsceneWorld::init() { World::init(); + + m_camera = irr_driver->getSceneManager()->addCameraSceneNode(NULL, core::vector3df(-80.0f, 2.0f, 75.0f), + core::vector3df(-97.230003, -0.010000, 50.610001)); } // CutsceneWorld //----------------------------------------------------------------------------- @@ -71,7 +75,7 @@ void CutsceneWorld::kartHit(const int kart_id) */ const std::string& CutsceneWorld::getIdent() const { - return IDENT_STRIKES; + return IDENT_CUSTSCENE; } // getIdent //----------------------------------------------------------------------------- diff --git a/src/modes/cutscene_world.hpp b/src/modes/cutscene_world.hpp index 594d85680..6a4702613 100644 --- a/src/modes/cutscene_world.hpp +++ b/src/modes/cutscene_world.hpp @@ -25,6 +25,7 @@ #include #include +#include /** @@ -34,6 +35,8 @@ class CutsceneWorld : public World { + scene::ICameraSceneNode* m_camera; + public: CutsceneWorld(); diff --git a/src/race/race_manager.hpp b/src/race/race_manager.hpp index 5705a2fc1..9f81113e4 100644 --- a/src/race/race_manager.hpp +++ b/src/race/race_manager.hpp @@ -43,6 +43,7 @@ static const std::string IDENT_TTRIAL ("STD_TIMETRIAL" ); static const std::string IDENT_FTL ("FOLLOW_LEADER" ); static const std::string IDENT_STRIKES ("BATTLE_3_STRIKES"); static const std::string IDENT_OVERWORLD("OVERWORLD" ); +static const std::string IDENT_CUSTSCENE("CUTSCENE" ); /** * The race manager has two functions: