Work on GP end cutscene
This commit is contained in:
@@ -47,9 +47,6 @@ private:
|
||||
* one time only (which might get triggered more than once). */
|
||||
enum AnimTimeType { ATT_CYCLIC, ATT_CYCLIC_ONCE } m_anim_type;
|
||||
|
||||
/** True if the animation is currently playing. */
|
||||
bool m_playing;
|
||||
|
||||
/** The current time used in the IPOs. */
|
||||
float m_current_time;
|
||||
|
||||
@@ -66,6 +63,9 @@ protected:
|
||||
/** All IPOs for this animation. */
|
||||
PtrVector<Ipo> m_all_ipos;
|
||||
|
||||
/** True if the animation is currently playing. */
|
||||
bool m_playing;
|
||||
|
||||
public:
|
||||
AnimationBase(const XMLNode &node);
|
||||
AnimationBase(Ipo *ipo);
|
||||
|
||||
@@ -81,6 +81,8 @@ void ThreeDAnimation::update(float dt)
|
||||
//m_node->setPosition(xyz.toIrrVector());
|
||||
//m_node->setScale(scale.toIrrVector());
|
||||
|
||||
if (!m_playing) return;
|
||||
|
||||
// Note that the rotation order of irrlicht is different from the one
|
||||
// in blender. So in order to reproduce the blender IPO rotations
|
||||
// correctly, we have to get the rotations around each axis and combine
|
||||
|
||||
@@ -53,8 +53,10 @@ using namespace irr::core;
|
||||
using namespace irr::gui;
|
||||
using namespace irr::video;
|
||||
|
||||
const float KARTS_DELTA_Y = 0.03f;
|
||||
const float INITIAL_Y = -3.0f;
|
||||
const float KARTS_X = -0.62f;
|
||||
const float KARTS_DELTA_X = 0.815f;
|
||||
const float KARTS_DELTA_Y = -0.55f;
|
||||
const float INITIAL_Y = 0.0f;
|
||||
const float INITIAL_PODIUM_Y = -3.6f;
|
||||
const float PODIUM_HEIGHT[3] = { 0.325f, 0.5f, 0.15f };
|
||||
|
||||
@@ -78,16 +80,7 @@ GrandPrixWin::GrandPrixWin() : Screen("grand_prix_win.stkgui", false)
|
||||
parts.push_back("gpwin");
|
||||
((CutsceneWorld*)World::getWorld())->setParts(parts);
|
||||
CutsceneWorld::setUseDuration(false);
|
||||
TrackObjectManager* tom = World::getWorld()->getTrack()->getTrackObjectManager();
|
||||
const KartProperties* kp = kart_properties_manager->getKart("tux");
|
||||
KartModel *kart_model = kp->getKartModelCopy();
|
||||
m_all_kart_models.push_back(kart_model);
|
||||
scene::ISceneNode* kart_main_node = kart_model->attachModel(false);
|
||||
TrackObjectPresentationSceneNode* presentation = new TrackObjectPresentationSceneNode(kart_main_node, core::vector3df(0, -0.6, 0), core::vector3df(0, 0, 0), core::vector3df(0.5, 0.5, 0.5));
|
||||
TrackObject* to = new TrackObject(core::vector3df(0, 0, 0), core::vector3df(0, 0, 0), core::vector3df(1, 1, 1),
|
||||
"ghost", presentation, false /* isDynamic */, NULL /* physics settings */);
|
||||
tom->insertObject(to);
|
||||
|
||||
|
||||
World::getWorld()->setPhase(WorldStatus::RACE_PHASE);
|
||||
} // GrandPrixWin
|
||||
|
||||
@@ -359,6 +352,63 @@ void GrandPrixWin::eventCallback(GUIEngine::Widget* widget,
|
||||
|
||||
void GrandPrixWin::setKarts(const std::string idents_arg[3])
|
||||
{
|
||||
TrackObjectManager* tom = World::getWorld()->getTrack()->getTrackObjectManager();
|
||||
|
||||
// reorder in "podium order" (i.e. second player to the left, first player in the middle, last at the right)
|
||||
std::string idents[3];
|
||||
idents[0] = idents_arg[1];
|
||||
idents[1] = idents_arg[0];
|
||||
idents[2] = idents_arg[2];
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
const KartProperties* kp = kart_properties_manager->getKart(idents[i]);
|
||||
KartModel* kart_model = kp->getKartModelCopy();
|
||||
m_all_kart_models.push_back(kart_model);
|
||||
scene::ISceneNode* kart_main_node = kart_model->attachModel(false);
|
||||
core::vector3df kart_pos(KARTS_X + i*KARTS_DELTA_X, INITIAL_Y + KARTS_DELTA_Y, 1.2f);
|
||||
core::vector3df kart_rot(0, 0, 0);
|
||||
core::vector3df kart_scale(0.5, 0.5, 0.5);
|
||||
|
||||
//FIXME: it's not ideal that both the track object and the presentation know the initial coordinates of the object
|
||||
TrackObjectPresentationSceneNode* presentation = new TrackObjectPresentationSceneNode(
|
||||
kart_main_node, kart_pos, kart_rot, kart_scale);
|
||||
TrackObject* to = new TrackObject(kart_pos, kart_rot, kart_scale,
|
||||
"ghost", presentation, false /* isDynamic */, NULL /* physics settings */);
|
||||
tom->insertObject(to);
|
||||
//to->move(kart_pos, core::vector3df(0, 0, 0), core::vector3df(1, 1, 1), false);
|
||||
}
|
||||
|
||||
m_podium_steps[0] = NULL;
|
||||
m_podium_steps[1] = NULL;
|
||||
m_podium_steps[2] = NULL;
|
||||
|
||||
TrackObject* currObj;
|
||||
PtrVector<TrackObject>& objects = tom->getObjects();
|
||||
for_in(currObj, objects)
|
||||
{
|
||||
TrackObjectPresentationMesh* meshPresentation = currObj->getPresentation<TrackObjectPresentationMesh>();
|
||||
if (meshPresentation != NULL)
|
||||
{
|
||||
if (meshPresentation->getModelFile() == "gpwin_podium1.b3d")
|
||||
{
|
||||
m_podium_steps[0] = currObj;
|
||||
}
|
||||
else if (meshPresentation->getModelFile() == "gpwin_podium2.b3d")
|
||||
{
|
||||
m_podium_steps[1] = currObj;
|
||||
}
|
||||
else if (meshPresentation->getModelFile() == "gpwin_podium3.b3d")
|
||||
{
|
||||
m_podium_steps[2] = currObj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert(m_podium_steps[0] != NULL);
|
||||
assert(m_podium_steps[1] != NULL);
|
||||
assert(m_podium_steps[2] != NULL);
|
||||
|
||||
// TODO
|
||||
|
||||
/*
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
namespace irr { namespace scene { class ISceneNode; class ICameraSceneNode; class ILightSceneNode; class IMeshSceneNode; } }
|
||||
namespace GUIEngine { class LabelWidget; }
|
||||
class KartProperties;
|
||||
class TrackObject;
|
||||
|
||||
/**
|
||||
* \brief Screen shown at the end of a Grand Prix
|
||||
@@ -40,6 +41,8 @@ class GrandPrixWin : public GUIEngine::Screen, public GUIEngine::ScreenSingleton
|
||||
/** Global evolution of time */
|
||||
double m_global_time;
|
||||
|
||||
TrackObject* m_podium_steps[3];
|
||||
|
||||
//irr::scene::IMeshSceneNode* m_podium_step[3];
|
||||
//irr::scene::ISceneNode* m_kart_node[3];
|
||||
|
||||
|
||||
@@ -202,6 +202,7 @@ TrackObjectPresentationMesh::TrackObjectPresentationMesh(const XMLNode& xml_node
|
||||
std::string model_name;
|
||||
xml_node.get("model", &model_name );
|
||||
|
||||
m_model_file = model_name;
|
||||
m_is_in_skybox = false;
|
||||
std::string render_pass;
|
||||
xml_node.get("renderpass", &render_pass);
|
||||
@@ -278,6 +279,8 @@ TrackObjectPresentationMesh::TrackObjectPresentationMesh(
|
||||
bool animated = (UserConfigParams::m_graphical_effects ||
|
||||
World::getWorld()->getIdent() == IDENT_CUTSCENE);
|
||||
|
||||
m_model_file = model_file;
|
||||
|
||||
if (file_manager->fileExists(model_file))
|
||||
{
|
||||
if (animated)
|
||||
|
||||
@@ -203,6 +203,8 @@ private:
|
||||
/** End frame of the animation to be played. */
|
||||
unsigned int m_frame_end;
|
||||
|
||||
std::string m_model_file;
|
||||
|
||||
void init(const XMLNode* xml_node, scene::ISceneNode* parent, bool enabled);
|
||||
|
||||
public:
|
||||
@@ -218,6 +220,8 @@ public:
|
||||
virtual ~TrackObjectPresentationMesh();
|
||||
|
||||
virtual void reset() OVERRIDE;
|
||||
|
||||
const std::string& getModelFile() const { return m_model_file; }
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user